DrivePX2- OpenCV GStreamer Error opening video file


I’m getting the following error. This is from a simple program trying to open a video file.
According to a Google search, I need to reinstall OpenCV with Gstreamer support.

If so, how would I do that?

Any help is much appreciated.


cap = cv2.VideoCapture(‘highway.mpg’)
Unable to stop the stream: Inappropriate ioctl for device

(python:4177): GStreamer-CRITICAL **: gst_element_link_pads_full: assertion ‘GST_IS_ELEMENT (src)’ failed
OpenCV Error: Unspecified error (GStreamer: cannot link color -> sink
) in cvCaptureFromCAM_GStreamer, file /home/ubuntu/opencv/modules/videoio/src/cap_gstreamer.cpp, line 792
VIDEOIO(cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename)): raised OpenCV exception:

/home/ubuntu/opencv/modules/videoio/src/cap_gstreamer.cpp:792: error: (-2) GStreamer: cannot link color -> sink
in function cvCaptureFromCAM_GStreamer

My OpenCV Info.

import cv2

In addition, OpenCV was made as follows, according to