I've been trying to open a video file using OpenCV and process its frames. I have both avi file and mp4 file, the mp4 file works well in Java but in Python (where I really need it...) it doesn't work (I keep getting None in videocapture.read()).
Any ideas what can this be? how can it be solved?
EDIT: Here's the code I have:
import cv2
video_capture = cv2.VideoCapture('myfile.mp4')
video_capture.set(propId=cv2.cv.CV_CAP_PROP_FRAME_WIDTH, value=1280.0)
video_capture.set(propId=cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, value=720.0)
ret, frame = self.video_capture.read()
if frame is not None:
# processing code...never reaches here
Thanks.