title: frame is NoneType after a few seconds of video openCV
body: <p>When executing</p>
  <pre><code>cap = cv2.VideoCapture(&quot;vid.mp4&quot;)
  
  while True:
      ret, frame = cap.read()
      
      (height, width) = frame.shape[:2]  ###
      print(height)
      minimap = frame[1648:1920, 800:1080]
  
      if cv2.waitKey(1) == 27:
          exit(0)
  </code></pre>
  <p>I can see that for a few seconds, frame has a height and width but it suddently crashes due to the fact that &quot;'NoneType' object has no attribute 'shape'&quot; (on line with the ###). Any idea why ?</p>