Ask Your Question

Video Capture not working in OpenCV 2.4.2 Windows7 32bit vs9

asked 2012-08-10 03:20:20 -0600

Luc gravatar image

Hi all,

I'm using the precompiled version of opencv 2.4.2. for windows 7 32bit on Visual Studio 2008. All sample projects compile just fine.

However when I initialize a VideoCapture with: "cv::VideoCapture cap( "in.avi" );"

and then start reading frames with: "cv::Mat in; cap >> in;"

I can read the first 2 frames of the video just fine, but get a crash at the third frame.

How can I solve this problem?

Many thanks.

edit retag flag offensive close merge delete


Install codecs, convert your file to a more friendly codec, etc.

sammy gravatar imagesammy ( 2012-08-10 03:42:22 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2012-09-17 05:17:39 -0600

jav_rock gravatar image

updated 2012-09-17 05:23:02 -0600

I had the same problem with the precompiled version, the version compiled by myself and with the latest version 2.4.9, so I guess it could be a bug of the 2.4 version related to ffmpeg.

I found this bug report.

How I solved it

  • I downloaded VirtualDub

  • I opened my AVI video file and re-encoded with "microsoft video 1" codecs. You have to select video -> compress and there you will have the drivers available at your computer.

It looks like OpenCV can deal with this compression. It is just a temporary solution but you can keep working, at least.

edit flag offensive delete link more

Question Tools


Asked: 2012-08-10 03:20:20 -0600

Seen: 1,024 times

Last updated: Sep 17 '12