Loading video in OpenCV in Python

I am desperately trying to upload a video file to OpenCV in Python (on OSX Lion) using the following code:

> import cv
> capture = cv.CaptureFromFile("in.avi")

However, I get the following warning:

> WARNING: Couldn't read movie file in.avi

There is no explanation regarding the problem (it cannot find the file, the wrong codec, etc.). As for Google, I am the only one in the world to receive this exact message in OpenCV.

I read the "codec compatibility documents" here and be sure to convert the video to the correct codec using mencode , but it still doesn't work.

Any ideas on what I'm doing wrong?

+5
source share
2 answers

Answer: see my comment - the wrong way.

+10

, ,

#import os
...
path = os.path.abspath(os.path.expanduser(path))
0

All Articles