can't read mpeg video files

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

can't read mpeg video files

i have to extract frames from a mpeg video file.i'm using opencv1.0
i used the following code

#include "stdafx.h"
#include <stdio.h>
#include <cv.h>
#include <highgui.h>

int main()

CvCapture* capture = cvCaptureFromFile("D:\\sample2.MPEG");
IplImage* img = 0;
if(!cvGrabFrame(capture)){    // capture a frame
        printf("Could not grab a frame\n\7");  
cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE);
cvMoveWindow("mainWin", 100, 100);
cvShowImage("mainWin", img );
reurn 0;}

the output is: could not grab a frame
hoping for help... thanks