# Revision history [back]

First of all, if you use ffmpeg as a backend for cv::VideoCapture, cap.open() will actually return after some time (more specifically, the timeout is defined in ffmpeg (somewhere in source):

#define LIBAVFORMAT_INTERRUPT_OPEN_TIMEOUT_MS 30000


If you are unsatisfied with these timeout values, I see two options. First - compile ffmpeg with changed constants and link against it, and second - try to use another backend (the list is here) like this:

cap.open(url, cv::CAP_XIAPI); // or cv::CAP_<something else>


First of all, if you use ffmpeg as a backend for cv::VideoCaptureVideoCapture, cap.open() will actually return after some time (more specifically, the timeout is defined in ffmpeg (somewhere in source):

#define LIBAVFORMAT_INTERRUPT_OPEN_TIMEOUT_MS 30000


If you are unsatisfied with these timeout values, I see two options. First - compile ffmpeg with changed constants and link against it, and second - try to use another backend (the list is here) like this:

cap.open(url, cap.open(0, cv::CAP_XIAPI); // or cv::CAP_<something else>


Update: this example is valid in C++, but maybe there is a similar workaround in Java.

First of all, if you use ffmpeg as a backend for VideoCapture, cap.open() will actually return after some time (more specifically, the timeout is defined in ffmpeg (somewhere somewhere in source):

#define LIBAVFORMAT_INTERRUPT_OPEN_TIMEOUT_MS 30000

cap.open(0, cv::CAP_XIAPI); // or cv::CAP_<something else>