title: Saving videos doesnt work in opencv2-python
body: <p>I am trying to run this example code for saving a video:</p>
  
  <pre><code>cap = cv2.VideoCapture('input.mp4')
  
  fourcc = cv2.VideoWriter_fourcc(*'XVID')
  out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480))
  
  while(cap.isOpened()):
      ret, frame = cap.read()
      if ret==True:
          out.write(frame)
          cv2.imshow('frame',frame)
      else:
          break
  
  cap.release()
  out.release()
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>It shows the video without problems, but 'output.avi' is only a 100kb file that cannot be opened with any video player.
  I tried changing the codec from *'XVID'. I tried at least a 100 different codec types from <a href="http://www.fourcc.org/codecs.php" rel="nofollow">http://www.fourcc.org/codecs.php</a> with the same result. I ran out of ideas unfortunately. 
  How can i solve this issue ?</p>
  
  <p>Thanks in advance.</p>