Voo
Voo

Reputation: 30235

opencv codecs under Windows

I followed these instructions to install opencv for python (i.e. copying the pyd file into site-packages). It works fine, except opencv cannot open any video files I try to open:

capture = cv2.VideoCapture("some_file.avi") 
capture.isOpened() # False

I tried videos with h264 and mpeg2 encodings without success. Windows 7 x64, 32bit Python 2.7.5 and opencv 2.4.7. So that presumably means that opencv cannot find the right codecs, but I made sure that opencv_ffmpeg247.dll is in the path.

Upvotes: 1

Views: 5939

Answers (2)

karlphillip
karlphillip

Reputation: 93468

Install the newest FFmpeg available from the repository:

git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg

The version you have installed is probably not compatible with OpenCV 2.4.7. The easiest way to test this hypothesis is to downgrade OpenCV to version 2.4.5.

And remember: cv2.VideoCapture("some_file.avi") will succeed only if some_file.avi is in the same directory as your source code. If that's not the case, you should use the full path to the file!

I want to quote another post from this forum:

The cause of your problem could be bug #2281: VideoCapture::read fails on uncompressed video.

Anyway, please try OpenCV 2.4.5 and let us know if it worked.

Upvotes: 1

GregPhil
GregPhil

Reputation: 475

I'm struggling with same issue, I guess (OpenCV 2.4.7 with FFMpeg support build with VS 2010 (x86)). Just to make sure, you tried to open an existing video, including the full path, right?

Best

Upvotes: 0

Related Questions