title: OpenCV Python cv2.VideoCapture.read() returns wrong images
body: <p>I have just started using <code>OpenCV 2.4.8.2</code> in <code>Python 2.7.6</code> on a MacBook Pro Retina running <code>OS X 10.9.2</code>. My main goal is to make a video file using a few <code>NumPy</code>-arrays. I would also like to do the inverse: decompose a video into separate frames (and consequently in <code>NumPy</code>-arrays).</p>
  
  <p>To make a video, I use the following piece of code:</p>
  
  <pre><code>import cv2
  
  # Composes a movie from separate frames.
  videoMaker = cv2.VideoWriter("videoTest.mov", cv2.cv.CV_FOURCC('m', 'p', '4', 'v'), 1, (256, 256))
  if (videoMaker.isOpened()):
      videoMaker.write(cv2.imread("videoTestFrame0.jpg"))
      videoMaker.write(cv2.imread("videoTestFrame1.jpg"))
      videoMaker.write(cv2.imread("videoTestFrame2.jpg"))
      videoMaker.release()
  </code></pre>
  
  <p>This piece of code seems to work fine - <code>videoTest.mov</code> is created, can be played in Quicktime, is 3 seconds long and consists of 3 different frames.</p>
  
  <p>To load a video, I have put directly under the above code piece:</p>
  
  <pre><code># Decomposes a movie into separate frames.
  videoReader = cv2.VideoCapture("videoTest.mov")
  count = 0
  while True:
      gotImage, image = videoReader.read()
      if (gotImage):
          cv2.imwrite("videoTestDecomposedFrame%d.jpg" %count, image)
          count += 1
      else:
          break
  </code></pre>
  
  <p><strong>The problem:</strong> When inspecting the 3 decomposed frames, the first frame of the movie (<code>videoTestFrame0.jpg</code>) is <em>not</em> one of them, while the last frame of the movie (<code>videoTestFrame2.jpg</code>) is stored <em>twice</em>.</p>
  
  <p>How can I fix this problem and retrieve <code>videoTestFrame0.jpg</code> from the video without having to modify it by putting in this first frame twice? Might something be wrong with <code>cv2.VideoCapture.read()</code>? I have tried saving the movie as <code>videoTest.avi</code> instead of <code>videoTest.mov</code>, but the behavior at decomposition is the same.</p>
  
  <p>Thanks in advance for your kind help! Martijn</p>