简体   繁体   English

GStreamer和Opencv3 VideoCapture-打开bin错误:不允许使用空管道

[英]GStreamer and Opencv3 VideoCapture - Error opening bin: empty pipeline not allowed

I've searched and searched and I cannot find anyone else with this error so here I am! 我已经搜索了,但找不到其他人遇到此错误,所以我在这里!

I am using OpenCV 3.1.0 and GStreamer 1.0 in python for video/image processing tasks. 我在python中使用OpenCV 3.1.0和GStreamer 1.0进行视频/图像处理任务。 Everything functions perfectly (and has for multiple versions of OpenCV in the past and both GStreamer and ffmpeg) but continually gives an error before functioning as intended. 一切都能正常运行(并且过去具有多个版本的OpenCV以及GStreamer和ffmpeg),但在按预期运行之前会不断出现错误。

The Error is as follows: 错误如下:

GStreamer: Error opening bin: empty pipeline not allowed  
GStreamer: Error opening bin: empty pipeline not allowed  

This error occurs due to 2 OpenCV calls: 由于2个OpenCV调用而发生此错误:

# video_src is a valid .h264 video

# First GStreamer Error
self.cam = cv2.VideoCapture(video_src)

self.operator = BackgroundSubtractor(2000, self.threshold, True)

# Second GStreamer Error
self.operator.model_bg2(video_src)

For the life of me I cannot isolate the cause of this GStreamer error. 为了我的一生,我无法找出导致GStreamer错误的原因。 After I get this error; 得到这个错误之后; however, OpenCV functions completely as expected and encounters no errors. 但是,OpenCV可以完全按预期运行,并且不会出错。 I only get an error upon calls to cv2.VideoCapture() initialization and BackgroundSubtractor's model_bg2. 我仅在调用cv2.VideoCapture()初始化和BackgroundSubtractor的model_bg2时收到错误。

Any ideas, suggestions, or questions are welcome! 欢迎任何想法,建议或问题!

It seems like OpenCv is trying to open the video file with Gstreamer instead of FFMPEG. 似乎OpenCv正在尝试使用Gstreamer而不是FFMPEG打开视频文件。 Probably, you're missing FFMPEG from your OpenCv build. 可能您的OpenCv版本中缺少FFMPEG。 You might want to re-build OpenCv making sure that all sub components of FFMPEG are marked YES in cmake. 您可能需要重新构建OpenCv,以确保FFMPEG的所有子组件在cmake中都标记为YES

--     FFMPEG:         YES
--       codec:        YES     
--       format:       YES     
--       util:         YES         
--       swscale:      YES    

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM