Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Cancel VideoCapture::open from an other thread

Hi all,

I'm developping a C++ application using Qt (5.12), OpenCv (4.1.0) and GStreamer on Ubuntu 18.04 I instanciate a VideoCapture object in a dedicaced thread, then I try to open a RSTP connection with a deconnected video camera. The timeout of VideoCapture::open("rtspsrc location=rtsp://...) is about 20 seconds. When I close my application, my main thread wait the open failed to close properly the GUI. 20 seconds are too long for a GUI. I think there are 2 solutions to solve my problem, but I don't manage to implement them... any help is appreciated :)

  • Reduce the timeout, but it seems to be implemented in the interface (cv::CAP_GSTREAMER in my case), and need to compile opencv :(
  • Cancel the open() from the main Thread, the best solution. I already tryed to call VideoCapture::release(), or to delete my object (desperate solution I know ^^'), but the open() doesn't exit before its timeout...

Cancel VideoCapture::open from an other thread

Hi all,

I'm developping a C++ application using Qt (5.12), OpenCv (4.1.0) and GStreamer on Ubuntu 18.04 I instanciate a VideoCapture object in a dedicaced thread, then I try to open a RSTP connection with a deconnected video camera. The timeout of VideoCapture::open("rtspsrc location=rtsp://...) is about 20 seconds. When I close my application, my main thread wait the open failed to close properly the GUI. 20 seconds are too long for a GUI. I think there are 2 solutions to solve my problem, but I don't manage to implement them... any help is appreciated :)

  • Reduce the timeout, but it seems to be implemented in the interface (cv::CAP_GSTREAMER in my case), and need to compile opencv :(
  • Cancel the open() from the main Thread, the best solution. I already tryed to call VideoCapture::release(), or to delete my object (desperate solution I know ^^'), but the open() doesn't exit before its timeout...