检测到无效和低效的vfw-avi打包B帧[英] Invalid and inefficient vfw-avi packed B frames detected

本文是小编为大家收集整理的关于检测到无效和低效的vfw-avi打包B帧的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我收到了消息Invalid and inefficient vfw-avi packed B frames detected视频转换时.

转换视频后,我在视频中检查了像素值.值与原始视频不同.为什么值转换后变化?

我使用无损框内视频编解码器'ffv1'

命令: ffmpeg -i input_video -vcodec ffv1 -acodec pcm_s16le output_video

ffmpeg version 1.1.1 Copyright (c) 2000-2013 the FFmpeg developers  
built on Jan 20 2013 23:05:28 with gcc 4.7.2 (GCC)   configuration:
--enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib   libavutil      52. 13.100 / 52. 13.100   libavcodec     54. 86.100 / 54. 86.100   libavformat    54. 59.106 / 54. 59.106   libavdevice    54.  3.102 / 54.  3.102   libavfilter     3. 32.100 /  3. 32.100   libswscale      2.  1.103 / 
2.  1.103   libswresample   0. 17.102 /  0. 17.102   libpostproc    52.  2.100 / 52.  2.100 [mpeg4 @ 02e218c0] Invalid and inefficient vfw-avi packed B frames detected Input #0, avi, from
'D:\video_output\avi\1.avi':   Metadata:
    encoder         : Lavf54.59.106   Duration: 00:04:25.52, start: 0.000000, bitrate: 2744 kb/s
    Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (DX50 / 0x30355844), yuv420p, 720x544 [SAR 1:1 DAR 45:34], 25 tbr, 25 tbn, 25
tbc
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s Output #0, matroska, to 'D:\video_output\avi\1_2.mkv': 
Metadata:
    encoder         : Lavf54.59.106
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv420p, 720x544 [SAR 1:1 DAR 45:34], q=2-31, 200 kb/s, 1k tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Stream mapping:   Stream #0:0 -> #0:0 (mpeg4 -> ffv1)   Stream #0:1 ->
#0:1 (ac3 -> pcm_s16le) Press [q] to stop, [?] for help [mpeg4 @ 02e27920] Invalid and inefficient vfw-avi packed B frames detected
frame=   36 fps=0.0 q=0.0 size=    1916kB time=00:00:01.56
bitrate=10008.5kbits/s
...
frame= 6565 fps= 46 q=0.0 size=  862611kB time=00:04:22.72
bitrate=26897.5kbits/s     frame= 6594 fps= 46 q=0.0 size=  864799kB
time=00:04:23.87 bitrate=26848.0kbits/s     frame CRC mismatch frame=
6629 fps= 46 q=0.0 size=  866407kB time=00:04:25.20
bitrate=26763.2kbits/s     frame= 6638 fps= 46 q=0.0 Lsize=  866521kB
time=00:04:25.56 bitrate=26730.5kbits/s    

video:816725kB audio:49668kB subtitle:0 global headers:0kB muxing
overhead 0.014713%

C ++代码

void ProcessVideo::processFrame1(string fileName1, string fileName2) {
this->capture.open(fileName1);
if (!this->capture.isOpened())
    cout<<"video1 error";

get_videoInfo();

set_videoInfo();

this->capture1.open(fileName2);
if (!this->capture1.isOpened())
    cout<<"video2 error";

cv::Mat frame; // current video frame
cv::Mat frame1; // current video frame

cv::namedWindow("image1");
cv::namedWindow("image2");

int count = 0;
int count1 = 0;

while (1) {
    capture >> frame;
    capture1 >> frame1;

    if (frame.empty()) {
        //break;
        cout<<"Frame1 Empty"<<endl;
    }
    cv::Mat_<cv::Vec3b>::iterator it=frame.begin<cv::Vec3b>();
    cv::Mat_<cv::Vec3b>::iterator itend=frame.end<cv::Vec3b>();

    if (frame1.empty()) {
        //break;
        cout<<"Frame2 Empty"<<endl;
    }

    cv::Mat_<cv::Vec3b>::iterator it1=frame1.begin<cv::Vec3b>();
    cv::Mat_<cv::Vec3b>::iterator itend1=frame1.end<cv::Vec3b>();

    if(frame.empty() && frame1.empty()) {
        break;
    }

    count1++;

    int i=0,j=0,k=0;

    while(it!=itend && it1!=itend1) {
        ++it;
        ++it1;

        count++;

        if((*it)[0] != (*it1)[0]){
            i++;
        }
        else if((*it)[1] != (*it1)[1]){
            j++;
        }
        else if((*it)[2] != (*it1)[2]){
            k++;
        }
    }
    cout<<"count diffrent pixel : "<<i<<"\t"<<j<<"\t"<<k<<"\t";

    cout<<"\n------------------------"<<count1<<"finish frame-----------------------\n"<<endl;

    cv::imshow("image1", frame);
    cv::imshow("image2", frame1);
    cv::waitKey(1);
}

this->capture.release();
this->capture1.release();

}

推荐答案

AVI容器格式不支持B帧.有些人用来将B框架放入AVI容器中. FFMPEG只是显示警告,让您知道,由于未支持的输入文件,它可能会在转换过程中遇到问题.至于不同的"像素值",您需要详细说明.视频压缩是一个有损过程.您不会得到与投入的相同值.只是"足够接近"的值.

如果要传输(从一个容器转换为另一个容器而无需转码),则使用 ffpmeg -acodec copy -vcodec copy

其他推荐答案

感谢Andreas Cadhalpun ffmpeg现在有了新的过滤器:mpeg4_unpack_bframes(请参阅 ref ).

用法很简单:

ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.avi

本文地址:https://www.itbaoku.cn/post/2091169.html

问题描述

I got message Invalid and inefficient vfw-avi packed B frames detected while video was converted.

After converting the video, I checked pixel values in video. Values are different from original video. Why values change after converting?

and I use lossless intra-frame video codec 'ffv1'

command : ffmpeg -i input_video -vcodec ffv1 -acodec pcm_s16le output_video

ffmpeg version 1.1.1 Copyright (c) 2000-2013 the FFmpeg developers  
built on Jan 20 2013 23:05:28 with gcc 4.7.2 (GCC)   configuration:
--enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib   libavutil      52. 13.100 / 52. 13.100   libavcodec     54. 86.100 / 54. 86.100   libavformat    54. 59.106 / 54. 59.106   libavdevice    54.  3.102 / 54.  3.102   libavfilter     3. 32.100 /  3. 32.100   libswscale      2.  1.103 / 
2.  1.103   libswresample   0. 17.102 /  0. 17.102   libpostproc    52.  2.100 / 52.  2.100 [mpeg4 @ 02e218c0] Invalid and inefficient vfw-avi packed B frames detected Input #0, avi, from
'D:\video_output\avi\1.avi':   Metadata:
    encoder         : Lavf54.59.106   Duration: 00:04:25.52, start: 0.000000, bitrate: 2744 kb/s
    Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (DX50 / 0x30355844), yuv420p, 720x544 [SAR 1:1 DAR 45:34], 25 tbr, 25 tbn, 25
tbc
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s Output #0, matroska, to 'D:\video_output\avi\1_2.mkv': 
Metadata:
    encoder         : Lavf54.59.106
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv420p, 720x544 [SAR 1:1 DAR 45:34], q=2-31, 200 kb/s, 1k tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Stream mapping:   Stream #0:0 -> #0:0 (mpeg4 -> ffv1)   Stream #0:1 ->
#0:1 (ac3 -> pcm_s16le) Press [q] to stop, [?] for help [mpeg4 @ 02e27920] Invalid and inefficient vfw-avi packed B frames detected
frame=   36 fps=0.0 q=0.0 size=    1916kB time=00:00:01.56
bitrate=10008.5kbits/s
...
frame= 6565 fps= 46 q=0.0 size=  862611kB time=00:04:22.72
bitrate=26897.5kbits/s     frame= 6594 fps= 46 q=0.0 size=  864799kB
time=00:04:23.87 bitrate=26848.0kbits/s     frame CRC mismatch frame=
6629 fps= 46 q=0.0 size=  866407kB time=00:04:25.20
bitrate=26763.2kbits/s     frame= 6638 fps= 46 q=0.0 Lsize=  866521kB
time=00:04:25.56 bitrate=26730.5kbits/s    

video:816725kB audio:49668kB subtitle:0 global headers:0kB muxing
overhead 0.014713%

c++ code

void ProcessVideo::processFrame1(string fileName1, string fileName2) {
this->capture.open(fileName1);
if (!this->capture.isOpened())
    cout<<"video1 error";

get_videoInfo();

set_videoInfo();

this->capture1.open(fileName2);
if (!this->capture1.isOpened())
    cout<<"video2 error";

cv::Mat frame; // current video frame
cv::Mat frame1; // current video frame

cv::namedWindow("image1");
cv::namedWindow("image2");

int count = 0;
int count1 = 0;

while (1) {
    capture >> frame;
    capture1 >> frame1;

    if (frame.empty()) {
        //break;
        cout<<"Frame1 Empty"<<endl;
    }
    cv::Mat_<cv::Vec3b>::iterator it=frame.begin<cv::Vec3b>();
    cv::Mat_<cv::Vec3b>::iterator itend=frame.end<cv::Vec3b>();

    if (frame1.empty()) {
        //break;
        cout<<"Frame2 Empty"<<endl;
    }

    cv::Mat_<cv::Vec3b>::iterator it1=frame1.begin<cv::Vec3b>();
    cv::Mat_<cv::Vec3b>::iterator itend1=frame1.end<cv::Vec3b>();

    if(frame.empty() && frame1.empty()) {
        break;
    }

    count1++;

    int i=0,j=0,k=0;

    while(it!=itend && it1!=itend1) {
        ++it;
        ++it1;

        count++;

        if((*it)[0] != (*it1)[0]){
            i++;
        }
        else if((*it)[1] != (*it1)[1]){
            j++;
        }
        else if((*it)[2] != (*it1)[2]){
            k++;
        }
    }
    cout<<"count diffrent pixel : "<<i<<"\t"<<j<<"\t"<<k<<"\t";

    cout<<"\n------------------------"<<count1<<"finish frame-----------------------\n"<<endl;

    cv::imshow("image1", frame);
    cv::imshow("image2", frame1);
    cv::waitKey(1);
}

this->capture.release();
this->capture1.release();

}

推荐答案

The avi container format does not support b frames. There is a 'hack' that some people use to put b frames into avi containers. ffmpeg is just displaying a warning letting you know that it may run into problems during the conversion due to an unsupported input file. As far as different 'pixel values' You will need to elaborate. Video compression is a lossy process. You will not get the same values out that you put in. Just 'close enough' values.

If you want to transmux (convert from one container to another without transcoding) use ffpmeg -acodec copy -vcodec copy

其他推荐答案

Thanks to Andreas Cadhalpun ffmpeg now has new filter: mpeg4_unpack_bframes (see ref).

Usage is as simple as:

ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.avi