Dear All,
First of all, I do not know if this is the correct place or not but I am having problems about playing video by using opencv. I am trying to play an .avi video. I did exactly the same thing as tutorial but the code below does not work. Video and source code are in the same folder. Even though program is built successfully, it can not play the video.
Can someone please help me ?
I appreciate for helps,

#include <cv.h>
#include <highgui.h>
int main()
{
	cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE );
	CvCapture* capture = cvCreateFileCapture( "MGC_RC_ATV.avi" );
	IplImage* frame;
	while(1) {
		frame = cvQueryFrame( capture );
		if( !frame ) break;
		cvShowImage( "Example2", frame );
		char c = cvWaitKey(33);
		if( c == 27 ) break;
	}
	cvReleaseCapture( &capture );
	cvDestroyWindow( "Example2" );
	return 0;	
}

Does it show the cvNamedWindow or close immediately?

You could also try something like this (with cvCaptureFromAVI):

CvCapture* capture = cvCaptureFromAVI( "MGC_RC_ATV.avi" );

if( !capture ) {
    //fail 
}  else {
   // work with the capture
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.