views:

392

answers:

1

Hi,

whenever i am trying to read out the avi file and converting into grayscal using Opencv 2.1 and VS 2008 in windows xp

i don't why i am getting following run time error at the same time i am unable to get the help on it

ERROR 1

[NULL @ 0x37da10]Invalid and inefficient vfw-avi packed B frames detected fps=23 frame (w, h) = (640, 272) Output #0, avi, to 'test.avi': Stream #0.0: Video: mpeg4, yuv420p, 640x272, q=2-31, 11141 kb/s, 90k tbn, 23 .98 tbc [mpeg4 @ 0x37f920]removing common factors from framerate [mpeg4 @ 0x37da10]Invalid and inefficient vfw-avi packed B frames detected 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. You may try recompiling using gcc >= 4.2. Do not report crashes to FFmpeg developers. [mpeg4 @ 0x37da10]Invalid and inefficient vfw-avi packed B frames detected

if i try some other avi file then i am getting following runtime error

ERROR 2

fps=15 frame (w, h) = (176, 184) Output #0, avi, to 'demo.avi': Stream #0.0: Video: mpeg4, yuv420p, 176x184, q=2-31, 2072 kb/s, 90k tbn, 15 tbc 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. You may try recompiling using gcc >= 4.2. Do not report crashes to FFmpeg developers.

I really don't know whats going on here is my code from Learning OpenCV ,

// VideoCon.cpp : Defines the entry point for the console application.


#include "stdafx.h"


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



int main( int argc, char* argv[] ) {
    cvNamedWindow( "Example2_10", CV_WINDOW_AUTOSIZE );
    cvNamedWindow( "Log_Polar", CV_WINDOW_AUTOSIZE );
    CvCapture* capture = cvCreateFileCapture( "Rambo.avi" );
    if (!capture){
        return -1;
    }
    IplImage* bgr_frame;
    double fps = cvGetCaptureProperty (
        capture,
        CV_CAP_PROP_FPS
    );
 printf("fps=%d\n",(int)fps);

    CvSize size = cvSize(
        (int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH),
        (int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT)
    );

    printf("frame (w, h) = (%d, %d)\n",size.width,size.height);
    #ifndef NOWRITE
   CvVideoWriter* writer = cvCreateVideoWriter(  
   // On linux Will only work if you've installed     ffmpeg development files correctly, 
       "test.avi",                               
    // otherwise segmentation fault.  Windows probably better.
        CV_FOURCC('D','X','5','0'),    
        fps,
        size
    );
#endif
    IplImage* logpolar_frame = cvCreateImage(
        size,
        IPL_DEPTH_8U,
        3
    );

    IplImage* gray_frame = cvCreateImage(
        size,
        IPL_DEPTH_8U,
        1
    );

    while( (bgr_frame=cvQueryFrame(capture)) != NULL ) {
        cvShowImage( "Example2_10", bgr_frame );
        cvConvertImage(   //We never make use of this gray image
            bgr_frame,
            gray_frame,
            CV_RGB2GRAY
        );
        cvLogPolar( bgr_frame, logpolar_frame,  
           //This is just a fun conversion the mimic's the human visual system
                    cvPoint2D32f(bgr_frame->width/2,
                    bgr_frame->height/2), 
                    40, 
                    CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS );
        cvShowImage( "Log_Polar", logpolar_frame );
        //Sigh, on linux, depending on your ffmpeg, this often won't work ...
#ifndef NOWRITE
       cvWriteToAVI( writer, logpolar_frame );
#endif
        char c = cvWaitKey(10);
        if( c == 27 ) break;
    }
#ifndef NOWRITE
    cvReleaseVideoWriter( &writer );
#endif
    cvReleaseImage( &gray_frame );
    cvReleaseImage( &logpolar_frame );
    cvReleaseCapture( &capture );
}
A: 

my GUESS is that you do not have the right codecs installed on your machine. try installing some proper codecs.

MBZ
If he is able to play the video then he already has the right codec installed. I suggest you submit this question to libavcoded mailing list.
karlphillip
I had a very same problem afew months ago. I was able to play the movie with VLC (which has built in codecs) but the opencv gave me crap.
MBZ
i have Divx codec , Xvid and ffdshow installed , now m really frustrate don't know what else required
Hunt