How to open video files with various codecs and files extensions?

I'm rather new to OpenCV, and I have this simple code to play a video clip:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
.
.
.
	cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE );
	CvCapture* capture = cvCreateFileCapture( argv );
	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" );


But, it only plays SOME codecs and file extentions (such as MJPG and DivX codecs of .avi file). What should I do to be able to play other types of files. I've wasted many hours on it, and I couldn't find a way. I'll appreciate any type of help! (should I install some codecs, or use a *.dll or #include something? how?) (I can play them with media player but not with my code.)
p.s.: I need to open these filetypes: avi (DivX, Xvid, uncompressed), flv, wmv, mpg.
Last edited on
Topic archived. No new replies allowed.