Does anyone know why I keep getting null frames? I tried skipping the first five and still null.
int _tmain(int argc, char** argv)
{
CvCapture *capture = cvCaptureFromFile(argv[1]);
int fps = (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
IplImage* frame;
cvNamedWindow("video", CV_WINDOW_AUTOSIZE);
while(1)
{
frame = cvQueryFrame(capture);
if(!frame)
break;
cvShowImage("video", frame);
char c = cvWaitKey(1000/fps);
if(c == 33)
break;
}
cvReleaseCapture( &capture);
cvDestroyWindow( "video" );
return 0;
}
Video file must UNCOMPRESSED avi! So actually I was getting null frames because cvCapture returned a null because my input video file was not uncompressed.