DrivePX2- OpenCV GStreamer Error opening video file

Hi,

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.

Thanks.

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
cv2.version
‘3.2.0-dev’


In addition, OpenCV was made as follows, according to https://github.com/BVLC/caffe/wiki/OpenCV-3.2-Installation-Guide-on-Ubuntu-16.04


cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_V4L=ON -DWITH_QT=ON -DWITH_OPENGL=ON -DWITH_CUBLAS=ON -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" -DWITH_GDAL=ON -DWITH_XINE=ON -DBUILD_EXAMPLES=ON …