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).
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.
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.
If there isn't timeout, is there any sort of library for a nonblocking VideoCapture method for RTSP or HTTP?
VideoCapture is a function of openCV library(used for computer vision, machine learning, and image processing) which allows working with video either by capturing via live webcam or by a video file.
The VideoCapture class returns a video capture object which we can use to display the video. The class has several methods, for example, there is the get() method which takes a property identifier from cv2.
Although this question is quite old, I will supply more summarizing info for other people as well.
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.
To rebuild OpenCV (python cv2) with CMake: Example Visual Studio.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With