问题
Almost exactly the same question : OpenCV error - cannot put pipeline to play in function CvVideoWriter_GStreamer::open
Context : I'm trying to create a video and save it in a .avi file with OpenCV 3.3.0 and Python 2.7.
Problem : This code :
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('data/out/output.avi', fourcc, 30, (800, 600))
Raises :
(python2.7:12345): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
** (python2.7:12345): CRITICAL **: gst_ffmpeg_cfg_set_property: assertion 'qdata->size == sizeof (gint64)' failed
OpenCV Error: Unspecified error (GStreamer: cannot put pipeline to play ) in CvVideoWriter_GStreamer::open, file /soft/OpenCV3.3/opencv-3.3.0/modules/videoio/src/cap_gstreamer.cpp, line 1690
VIDEOIO(cvCreateVideoWriter_GStreamer (filename, fourcc, fps, frameSize, is_color)): raised OpenCV exception:
cap_gstreamer.cpp:1690: error: (-2) GStreamer: cannot put pipeline to play
in function CvVideoWriter_GStreamer::open
Question : How do I solve this problem so I can write video files with OpenCV ?
回答1:
Not using a path in constructor of VideoWriter
solved the problem.
out = cv2.VideoWriter('output.avi', fourcc, 30, (800, 600))
来源:https://stackoverflow.com/questions/53210780/videowriter-opencv-cannot-put-pipeline-to-play-in-function-cvvideowriter-gstre