title: OpenCV 2.4 - Playing Video from file on OSX
body: <p>I install Open CV and all the deps with <code>brew</code></p>
  
  <p>Following this tutorial:</p>
  
  <p><a href="http://docs.opencv.org/3.1.0/dd/d43/tutorial_py_video_display.html#gsc.tab=0" rel="nofollow">http://docs.opencv.org/3.1.0/dd/d43/tutorial_py_video_display.html#gsc.tab=0</a></p>
  
  <p>I'm able to have it working with my webcam but unable to read a AVI or MP4 file. Every time, when I execute this command:</p>
  
  <p><code>ret, frame = cap.read()</code>, <code>frame</code> is <code>None</code>.</p>
  
  <pre><code>Python 2.7.10 (default, Sep 23 2015, 04:34:14) 
  [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import cv2
  &gt;&gt;&gt; cv2.__version__
  '2.4.12'`
  </code></pre>
  
  <p>Here is the script:</p>
  
  <pre><code>import cv2
  cap = cv2.VideoCapture('drop.avi')
  
  while cap.isOpened():
      ret, frame = cap.read() # frame is ALWAYS None.
      gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
      cv2.imshow('frame', gray)
      if cv2.waitKey(1) &amp; 0xFF == ord('q'):
          break
  cap.release()
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>Thanks in advance for your help!</p>