title: How to terminate cv2.VideoCapture(rtsp_url) call if execution stalls due to RTSP camera issues?
body: <p>I have RTSP URLs for 80 total cameras. I am trying to get a screenshot from every camera using <code>cv2.VideoCapture(rtsp_url)</code>. I am doing some image processing operations on the captured screenshots from each camera. I have total 80 such URLs for each camera. A sample RTSP URL is:</p>
  <pre><code>rtsp://192.168.0.101:554/user=admin_password=oyXv12aW_channel=1_stream=0.sdp?real_stream
  </code></pre>
  <p>Now, sometimes due to the network or other technical issues, some of the cameras temporarily don't function. In that case <code>cv2.VideoCapture(rtsp_url)</code> takes more than 30 seconds to return. In a normal scenario it usually takes 2-3 seconds to return with screenshots. But if a camera is down, it takes too much time. Since my application is running in a <code>for</code> loop on many cameras, I cannot afford to wait. Sometimes the inactive camera count is high and it takes forever to execute the loop. What can be done to reduce the waiting time for <code>cv2.VideoCapture</code>?</p>
  <p>I have also used <code>multiprocessing</code> and have tried terminating processes if they exceed a given time threshold. I don't want to use <code>multiprocessing</code> though it is working very fine. I want to find a solution using only <code>opencv</code></p>