检测到无效且效率低下的vfw-avi打包B帧

时间:2013-08-20 09:40:03

标签: video ffmpeg frame

视频转换时收到了消息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();

}

1 个答案:

答案 0 :(得分:2)

avi容器格式不支持b帧。有些人使用“黑客”将b帧放入avi容器中。 ffmpeg只是显示一条警告,通知您在转换过程中由于输入文件不受支持而可能会遇到问题。至于不同的“像素值”,您需要详细说明。视频压缩是一个有损的过程。你不会得到你输入的相同值。只需'足够接近'值。

如果你想transmux(从一个容器转换到另一个容器而不转码)使用 ffpmeg -acodec copy -vcodec copy