capture one frame from a video file after every 10 seconds
<p>I want to capture from a video file one frame after every 10 seconds, So if anyone can help me for that i will be very thankful. my python code is like that:</p>

<pre><code>import cv2


print(cv2.__version__)
vidcap = cv2.VideoCapture('Standoff.avi')
vidcap.set(cv2.CAP_PROP_POS_MSEC,96000)  
success,image = vidcap.read()
count = 0
success = True
while success:
  success,image = vidcap.read()
  print 'Read a new frame: ', success
  cv2.imwrite("frame%d.jpg" % count, image)     # save frame as JPEG file
  cv2.waitKey(200)
  count += 1
</code></pre>

<p>If you can get the framerate of the video from the file the following should work (You may need to check the syntax as I have not tested it):</p>

<pre class="lang-js prettyprint-override"><code>import numpy as np
import cv2

cap = cv2.VideoCapture('Standoff.avi')
framerate = cap.get(cv2.cv.CV_CAP_PROP_FPS)
framecount = 0

while(True):
    # Capture frame-by-frame
    success, image = cap.read()
    frame count += 1

    # Check if this is the frame closest to 10 seconds
    if framecount = (framerate * 10)
      framecont = 0
      cv2.imshow('image',image)

    # Check end of video
    if cv2.waitKey(1) &amp; 0xFF == ord('q'):
          break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
</code></pre>

python video video-capture