title: OpenCV + python -- grab frames from a video file
body: <p>I can't seem to capture frames from a file using OpenCV -- I've compiled from source on Ubuntu with all the necessary prereqs according to:  <a href="http://opencv.willowgarage.com/wiki/InstallGuide%20%3A%20Debian" rel="noreferrer">http://opencv.willowgarage.com/wiki/InstallGuide%20%3A%20Debian</a></p>
  
  <pre><code>#!/usr/bin/env python
  
  import cv
  import sys
  
  files = sys.argv[1:]
  
  for f in files:
      capture = cv.CaptureFromFile(f)
      print capture
  
      print cv.GetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_WIDTH)
      print cv.GetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_HEIGHT)
  
      for i in xrange(10000):
          frame = cv.QueryFrame(capture)
          if frame:
              print frame
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>ubuntu@local:~/opencv$ ./test.py bbb.avi 
  &lt;Capture 0xa37b130&gt;
  0.0
  0.0
  </code></pre>
  
  <p>The frames are always None...</p>
  
  <p>I've transcoded a video file to i420 format using:</p>
  
  <pre><code>mencoder $1 -nosound -ovc raw -vf format=i420 -o $2
  </code></pre>
  
  <p>Any ideas?</p>