Avi write

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Avi write

Romeo Foxtrot
Hi guys I've been having trouble running this code. what i want to do
is to basically read an AVI file (1.avi) and write it to another file
(2.avi) but when i run it i get the following message:

"compiler did not align stack variables. libavcodec has been
miscompiled and may be very slow or crash. This is not a bug in
libavcodec, but in the compiler. Do not report crashes to FFmpeg
developers."
program outputs the 2.avi file but i'm unable to run it.  
I'm using FFdshow codec pack. i also tried to use my camera as a
source but program is unable to get the fps for some reason here is a
copy of the code. please help.

#include <cv.h>
#include <highgui.h>

main( int argc, char* argv[] )
{

 CvCapture* capture = 0;       //create image struc
 capture = cvCreateFileCapture("1.avi");
 //or cvCaptureFromCAM(0);
 if(!capture)                  // terminate if capture fails
 {
  return -1;                            
 }
 IplImage *bgr_frame=cvQueryFrame(capture);//create image from the capture
 double fps = cvGetCaptureProperty (capture,CV_CAP_PROP_FPS);//get FPS
from source
 CvSize size = cvSize((int)cvGetCaptureProperty( capture,
CV_CAP_PROP_FRAME_WIDTH),(int)cvGetCaptureProperty( capture,
CV_CAP_PROP_FRAME_HEIGHT));//get image size
 CvVideoWriter *writer =
cvCreateVideoWriter("2.avi",CV_FOURCC('M','J','P','G'),fps,size);
//write to 2.avi PROBLEM HERE with fps when capturing from camera

 IplImage* logpolar_frame = cvCreateImage(size,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);
}

Reply | Threaded
Open this post in threaded view
|

Re: Avi write

Abdullah-4
I tried once to use "CvVideoWriter" but it didn't work at all!
What I get from running the program is a file "x.avi" and its size is 0!

I think this is a bug in opencv?

On Sat, Jan 3, 2009 at 7:18 AM, Romeo Foxtrot <[hidden email]>wrote:

>   Hi guys I've been having trouble running this code. what i want to do
> is to basically read an AVI file (1.avi) and write it to another file
> (2.avi) but when i run it i get the following message:
>
> "compiler did not align stack variables. libavcodec has been
> miscompiled and may be very slow or crash. This is not a bug in
> libavcodec, but in the compiler. Do not report crashes to FFmpeg
> developers."
> program outputs the 2.avi file but i'm unable to run it.
> I'm using FFdshow codec pack. i also tried to use my camera as a
> source but program is unable to get the fps for some reason here is a
> copy of the code. please help.
>
> #include <cv.h>
> #include <highgui.h>
>
> main( int argc, char* argv[] )
> {
>
> CvCapture* capture = 0; //create image struc
> capture = cvCreateFileCapture("1.avi");
> //or cvCaptureFromCAM(0);
> if(!capture) // terminate if capture fails
> {
> return -1;
> }
> IplImage *bgr_frame=cvQueryFrame(capture);//create image from the capture
> double fps = cvGetCaptureProperty (capture,CV_CAP_PROP_FPS);//get FPS
> from source
> CvSize size = cvSize((int)cvGetCaptureProperty( capture,
> CV_CAP_PROP_FRAME_WIDTH),(int)cvGetCaptureProperty( capture,
> CV_CAP_PROP_FRAME_HEIGHT));//get image size
> CvVideoWriter *writer =
> cvCreateVideoWriter("2.avi",CV_FOURCC('M','J','P','G'),fps,size);
> //write to 2.avi PROBLEM HERE with fps when capturing from camera
>
> IplImage* logpolar_frame = cvCreateImage(size,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);
> }
>
>  
>


[Non-text portions of this message have been removed]

Reply | Threaded
Open this post in threaded view
|

Re: Avi write

ugur
1. what is your OS? if you are using linux cvGetCaptureProperty doesn't work
well you use
http://www.ymer.org/amir/?s=cvgetcaptureproperty(in this page how to get
number of frames is explained but you can modify to get fps)

2. are you sure about fps problem ? what value is it ? and the problem may
be because of codecs you don't have

2009/1/6 Abdullah <[hidden email]>

>   I tried once to use "CvVideoWriter" but it didn't work at all!
> What I get from running the program is a file "x.avi" and its size is 0!
>
> I think this is a bug in opencv?
>
> On Sat, Jan 3, 2009 at 7:18 AM, Romeo Foxtrot <[hidden email]<darkness_cracker%40yahoo.com>
> >wrote:
>
>
> > Hi guys I've been having trouble running this code. what i want to do
> > is to basically read an AVI file (1.avi) and write it to another file
> > (2.avi) but when i run it i get the following message:
> >
> > "compiler did not align stack variables. libavcodec has been
> > miscompiled and may be very slow or crash. This is not a bug in
> > libavcodec, but in the compiler. Do not report crashes to FFmpeg
> > developers."
> > program outputs the 2.avi file but i'm unable to run it.
> > I'm using FFdshow codec pack. i also tried to use my camera as a
> > source but program is unable to get the fps for some reason here is a
> > copy of the code. please help.
> >
> > #include <cv.h>
> > #include <highgui.h>
> >
> > main( int argc, char* argv[] )
> > {
> >
> > CvCapture* capture = 0; //create image struc
> > capture = cvCreateFileCapture("1.avi");
> > //or cvCaptureFromCAM(0);
> > if(!capture) // terminate if capture fails
> > {
> > return -1;
> > }
> > IplImage *bgr_frame=cvQueryFrame(capture);//create image from the capture
> > double fps = cvGetCaptureProperty (capture,CV_CAP_PROP_FPS);//get FPS
> > from source
> > CvSize size = cvSize((int)cvGetCaptureProperty( capture,
> > CV_CAP_PROP_FRAME_WIDTH),(int)cvGetCaptureProperty( capture,
> > CV_CAP_PROP_FRAME_HEIGHT));//get image size
> > CvVideoWriter *writer =
> > cvCreateVideoWriter("2.avi",CV_FOURCC('M','J','P','G'),fps,size);
> > //write to 2.avi PROBLEM HERE with fps when capturing from camera
> >
> > IplImage* logpolar_frame = cvCreateImage(size,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);
> > }
> >
> >
> >
>
> [Non-text portions of this message have been removed]
>
>  
>


[Non-text portions of this message have been removed]