Trying capture video to read frame by frame with OpenCV on MAC, but my ".avi" file has been encoded as mpeg4
<p>I am able to read an avi file encoded as mjpeg, but I can't succeed when the case for encoding is mpeg4 unfortunately. Any help from you would be really helpful and be appreciated. 
Here is my code snippet:</p>

<pre><code>while(cap.isOpened()):
 ret, frame = cap.read()
 if ret:
      frame=cv2.resize(frame(img_rows,img_cols),interpolation=cv2.INTER_AREA)         
      gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
      frames.append(gray)
      cv2.imshow('frame',gray)
 if cv2.waitKey(1) &amp; 0xFF == ord('q'):
                break
cap.release()
cv2.destroyAllWindows()
</code></pre>