在 OpenCV 中读取 AVI 文件时出现未知错误

发布于 2024-09-11 02:35:52 字数 3426 浏览 1 评论 0原文

每当我尝试在 Windows XP 中使用 Opencv 2.1 和 VS 2008 读取 avi 文件并转换为灰度时,

我不明白为什么我会同时出现以下运行时错误,但我无法获得有关它的帮助

错误1

[NULL @ 0x37da10]无效且 低效的 vfw-avi 打包 B 帧 检测到的 fps=23 帧 (w, h) = (640, 272) 输出#0,avi,到“test.avi”: 流#0.0:视频:mpeg4、yuv420p、 640x272,q=2-31,11141 kb/s,90k tbn, 23 .98 待定 [mpeg4 @ 0x37f920] 正在删除 帧速率的共同因素 [mpeg4 @ 0x37da10]无效且低效 检测到 vfw-avi 打包 B 帧 编译器没有对齐堆栈 变量。 Libavcodec 已 编译错误并且可能非常慢或者 碰撞。这不是一个错误 libavcodec,但在编译器中。你 可以尝试使用 gcc >= 4.2 重新编译。 不要向 FFmpeg 报告崩溃 开发商。 [mpeg4 @ 0x37da10]无效 和低效的 vfw-avi 打包 B 检测到帧

如果我尝试其他 avi 文件,则

,然后我收到以下运行时错误ERROR 2

fps=15 帧(宽、高)= (176, 184) 输出#0,avi,到“demo.avi”: 流#0.0:视频:mpeg4、yuv420p、176x184、q=2-31、2072 kb/s、 90k tbn,15 tbc 编译器未对齐 堆栈变量。 Libavcodec 已经 编译错误并且可能非常慢或者 碰撞。这不是一个错误 libavcodec,但在编译器中。你 可以尝试使用 gcc >= 4.2 重新编译。 不要向 FFmpeg 报告崩溃 开发人员。

我真的不知道这是怎么回事,这是我学习 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 );
}

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 );
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

走野 2024-09-18 02:35:52

我的猜测是您的计算机上没有安装正确的编解码器。
尝试安装一些合适的编解码器。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文