title: Creating a video using OpenCV 2.4.0 in python
body: <p>I am trying to create a video using <code>OpenCV 2.4.0</code> in <code>python 2.7.2</code>. But the <code>avi</code> file size is 0.</p>
  
  <p>My code:</p>
  
  <pre><code>from cv2 import *
  
  im1 = cv.LoadImage("1.jpg")
  
  fps = 20
  frame_size = cv.GetSize(im1)
  
  #writer = cv.CreateVideoWriter("out.avi", CV_FOURCC('M', 'J', 'P', 'G'), fps, frame_size, True)
  
  v = VideoWriter()
  
  v.open("out.avi", cv.CV_FOURCC('F', 'M', 'P', '4'), fps, (800,600), True)
  print v.isOpened()
  </code></pre>
  
  <p><code>isOpened()</code> is always returning <code>false</code>.</p>
  
  <p>Another try:</p>
  
  <pre><code>#!/usr/bin/env python
  import sys
  
  from cv2 import *
  
  im1 = cv.LoadImage("1.jpg")
  
  if not im1:
      print "Error loading image"
  
  im2 = cv.LoadImage("2.jpg")
  
  if not im1:
      print "Error loading image"
  
  fps = 20
  frame_size = cv.GetSize(im1)
  
  writer = cv.CreateVideoWriter("out.avi", cv.CV_FOURCC('M', 'J', 'P', 'G'), fps, frame_size, True)
  
  if not writer:
      print "Error in creating video writer"
      sys.exit(1)
  else:
      cv.WriteFrame(writer, im1)
      cv.WriteFrame(writer, im2)
  
  del writer
  </code></pre>
  
  <p>No errors, but the output is empty.</p>
  
  <p>What am I missing?</p>