VideoWriter OpenCV-无法在函数CvVideoWriter_GStreamer :: open中播放管道 [英] VideoWriter OpenCV - cannot put pipeline to play in function CvVideoWriter_GStreamer::open
本文介绍了VideoWriter OpenCV-无法在函数CvVideoWriter_GStreamer :: open中播放管道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
几乎完全相同的问题: OpenCV错误-无法在函数CvVideoWriter_GStreamer :: open
Almost exactly the same question : OpenCV error - cannot put pipeline to play in function CvVideoWriter_GStreamer::open
上下文:我正在尝试创建视频,并使用OpenCV 3.3.0和Python 2.7将其保存在.avi文件中.
Context : I'm trying to create a video and save it in a .avi file with OpenCV 3.3.0 and Python 2.7.
问题:此代码:
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('data/out/output.avi', fourcc, 30, (800, 600))
提高:
(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
问题:如何解决此问题,以便可以使用OpenCV编写视频文件?
推荐答案
在 VideoWriter
的构造函数中不使用路径解决了该问题.
Not using a path in constructor of VideoWriter
solved the problem.
out = cv2.VideoWriter('output.avi', fourcc, 30, (800, 600))
这篇关于VideoWriter OpenCV-无法在函数CvVideoWriter_GStreamer :: open中播放管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文