#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
int main()
{
cvNamedWindow("origin", CV_WINDOW_AUTOSIZE);
CvCapture *capture = cvCaptureFromAVI("C:\\j.avi");
IplImage *frameOrigin;
if(capture==NULL) {
return -1;
cout<<"VIDEO NOT READ"<<endl;
}
int key = 0;
int fps = (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
while(key != 'q')
{
frameOrigin = cvQueryFrame(capture);
if(frameOrigin == NULL)
break;
cvShowImage("origin", frameOrigin);
key = cvWaitKey(1000/fps);
}
cvReleaseCapture(&capture);
cvDestroyWindow("origin");
return 0;
}
try the above code...it works for me on windows platform...put the avi fie address correctly..