OpenCV VideoCapture在Open或Constructor上超时? [英] OpenCV VideoCapture timeout on Open or Constructor?

查看:1649
本文介绍了OpenCV VideoCapture在Open或Constructor上超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OpenCV具有 VideoCapture 类可从外部加载视频资料来源.我的网络上有一个网络摄像机,正在使用RTSP(使用FFMPEG插件)进行访问.

OpenCV has the VideoCapture class to load video from external sources. I have a network camera on my network that I'm accessing with RTSP (using the FFMPEG plugin).

可悲的是,似乎打开视频流时使用open方法和构造函数块.这意味着如果流关闭,则程序将永远停留在那里.

The sad thing is that it seems the open method and the constructor block on opening the video stream. This means if the stream is down, the program is stuck there forever.

是否有某种超时功能?我尝试查找源代码,但最终它调用了我相信的外部FFMPEG函数,因此无法继续进行操作.

Is there any sort of timeout ability? I tried looking in the source code, but in the end it calls external FFMPEG functions I believe and I'm unable to go further.

如果没有超时,是否存在用于RTSP或HTTP的非阻塞VideoCapture方法的任何类型的库?

If there isn't timeout, is there any sort of library for a nonblocking VideoCapture method for RTSP or HTTP?

推荐答案

尽管这个问题已经很久了,但我还将为其他人提供更多摘要信息.

Although this question is quite old, I will supply more summarizing info for other people as well.

可以使用包装器库为opencv的ffmpeg构建dll Github问题使用包装文件引用Peter的回购协议(第198行是可以设置的超时). (对不起,我无法发布更多链接). 只要您对Make'ing感到满意,就应该设置好它(声明这个包装器非常简单).如果您要在github上查找实际问题,请阅读上面链接的问题.在那里,您可以找到有关已解决的实际问题的更多信息.

There is the possibility to build the dll for ffmpeg for opencv with a wrapper library Github issue refers to Peter's repo with a wrapper file (on line 198 is a timeout which can be set). (Sorry, I can't post more links). As long as you are comfortable with Make'ing this, then you should be set (this wrapper is quite easy, it's stated). If you are looking for the actual issue on github, read the issue linked above. There you can find more information on the actual problem fixed.

要使用CMake重建OpenCV(python cv2),请执行以下操作: Visual Studio示例.

To rebuild OpenCV (python cv2) with CMake: Example Visual Studio.

这篇关于OpenCV VideoCapture在Open或Constructor上超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆