My problem in saving the video ( Image processing )

4 views
Skip to first unread message

bahador saket

unread,
May 28, 2010, 12:27:07 AM5/28/10
to FIT Cafeteria
Dear All

I wrote the program, it should save the video but unfortunately I do
not know why it does not work correct.
Exactly , it represent the error like following statement:

[avi @0x1da1060] could not find codec parametrs.<video mjpeg>


my program:


#include <cv.h>
#include <highgui.h>
int main(int argc, char* argv[]) {

CvCapture* capture = NULL;
capture = cvCreateFileCapture(argv[1]);

if(!capture){
return -1;
}

IplImage *bgr_frame=cvQueryFrame(capture);//Init the video read
double fps = cvGetCaptureProperty (capture,CV_CAP_PROP_FPS);

CvSize imgSize;
imgSize.width = bgr_frame->width;
imgSize.height = bgr_frame->height;

CvVideoWriter *writer =
cvCreateVideoWriter("bahador",CV_FOURCC('M','J','P','G'),fps,imgSize);

IplImage* logpolar_frame =
cvCreateImage(imgSize,IPL_DEPTH_8U,3);

while( (bgr_frame=cvQueryFrame(capture)) != NULL ) {

cvLogPolar( bgr_frame,
logpolar_frame,cvPoint2D32f(bgr_frame->width/
2,
bgr_frame->height/2),
40,
CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS );

cvWriteFrame( writer, logpolar_frame );

}

cvReleaseVideoWriter( &writer );
cvReleaseImage( &logpolar_frame );
cvReleaseCapture( &capture );
return(0);
}

Regards,
Bahador Saket

bahador saket

unread,
May 29, 2010, 12:24:21 PM5/29/10
to FIT Cafeteria
Dear all

I can solved my mistake(exactly Mr Victor solved it :D:D ) the
problem was in this line:



cvCreateVideoWriter("bahador",CV_FOURCC('M','J','P','G'),fps,imgSize);

it should be:

CvVideoWriter *writer =
cvCreateVideoWriter("bahador.avi",CV_FOURCC('D','I','V','X'),fps,imgSize);


Best Regards,
Bahador
Reply all
Reply to author
Forward
0 new messages