title: Python - Extracting and Saving Video Frames
body: <p>So I've followed <a href="https://web.archive.org/web/20161010175545/https://tobilehman.com/blog/2013/01/20/extract-array-of-frames-from-mp4-using-python-opencv-bindings/" rel="noreferrer">this tutorial</a> but it doesn't seem to do anything. Simply nothing. It waits a few seconds and closes the program. What is wrong with this code? </p>
  
  <pre><code>import cv2
  vidcap = cv2.VideoCapture('Compton.mp4')
  success,image = vidcap.read()
  count = 0
  success = True
  while success:
    success,image = vidcap.read()
    cv2.imwrite("frame%d.jpg" % count, image)     # save frame as JPEG file
    if cv2.waitKey(10) == 27:                     # exit if Escape is hit
        break
    count += 1
  </code></pre>
  
  <p>Also, in the comments it says that this limits the frames to 1000? Why?</p>
  
  <p>EDIT:
  I tried doing <code>success = True</code> first but that didn't help. It only created one image that was 0 bytes. </p>