Click here to Skip to main content
15,868,158 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi I had some code to save stream of images into a video file using cvWriteToAVI function (from OpenCV) in c++ and my OS was Ubuntu and it worked perfectly,
But because of some problems I reinstalled ubuntu and installed all needed things(I think so):
OpenCV , codeBlocks , Buildessential , libavformat-dev and other libs
but that same code doesn't work now, I mean other parts are okay except cvWriteToAVI() function
in my code I first create the video file(which works too)

code :

CvSize size = cvSize(640,480);
int codec = CV_FOURCC('M', 'J', 'P', 'G');
CvVideoWriter* writer = cvCreateVideoWriter("video",codec,30,size);

// Get an image (works okay)
IplImage* image = ardrone.getImage();

//shows the image here
cvShowImage("camera", image);

cvWriteToAVI(writer,image);       // seems this line doesn't work!


any help would be appreciated
Posted
Comments
KarstenK 17-Feb-14 5:16am    
check the return codes and "follow the first error" ;-)
The_Inventor 17-Feb-14 22:57pm    
Check your fourCC : int codec = CV_FOURCC('M','P', 'E', 'G');
Rage 17-Mar-14 10:13am    
What does not work ?
Do you have the codecs installed on the machine (you did reinstall the OS, so...) ?

1 solution

Use

cvWriteFrame(writer,image);

instead of

cvWriteToAVI(writer,image);

may works.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900