VideoWriter OpenCV - cannot put pipeline to play in function CvVideoWriter_GStreamer::open

微笑、不失礼 提交于 2021-02-10 15:01:36

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!