Sunday, February 26, 2012

If your AVI do not open ( CvCapture* aviSrc = cvCaptureFromAVI(inputVideo); returns a zero pointer)

PS: If your AVI do not open ( CvCapture* aviSrc = cvCaptureFromAVI(inputVideo); returns a zero pointer), it´s probably because the file encoded in a way the openCV can´t read it. Here is the solution:
> Get a copy of GSpot to check the video codec.
> If the file is compressed but no corresponding VFW codec on your
system,
> then cvCaptureFromAVI can not read it.
> If the file is uncompressed, use mencoder to convert it
> to opencv readable format, like this:
> mencoder youravi.avi -ovc raw -vf format=i420 -o new.avi

Cvcapturefromavi Not Working

openCV will only play avi in i420 format. 

To test this try an avi that has been converted by mencoder to i420 format.