[FFmpeg-trac] #3145(FFmpeg:new): Header inconsistencies for a certain range of video bit rate

FFmpeg trac at avcodec.org
Sat Nov 16 06:24:09 CET 2013


#3145: Header inconsistencies for a certain range of video bit rate
-------------------------------------+-------------------------------------
             Reporter:  olitoli      |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  FFmpeg       |                  Version:  2.1
             Keywords:  xvid avi     |               Blocked By:
  video bitrate                      |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Hi,

 I am trying to transcode from any format (.mkv, .avi, .m4v, etc) to this
 format: XVID avi.

 I am seeing a problem that I did not see reported before (I googled a lot
 but did not find anything that closely match my problem).

 I have been using the Mac OS X Tessus standalone builds 1.2.1 and 2.1.0
 and both have the same problem.

 The input file and format does not really matter, I tried with various and
 still see the same problem.

 The problem: For a certain RANGE of video rate, the output file has
 (apparently) some header inconsistencies (wrong lengths/sizes for the
 audio and/or video streams).

 The symptoms: On my Philips DVD Player DVP 3680, when I play the file, I
 first see the 0%-100% loading message twice (it should be seen only once),
 then if I play the file, it stops playing after a certain mark (roughly
 1GB). Also, if I try to fast forward, I can go until the end, but if I try
 to play after that certain mark, the file won't play.

 Additionally, if I use the GUI version of MediaInfo Mac 0.7.36.0, I can
 see the inconsistencies mentioned above. If I use the CLI mediainfo
 0.7.64, I do not see those inconsistencies. If I use ffmpeg -v 9 -loglevel
 99 -i, I do not see any inconsistencies either.

 Furthermore, ALL files play correctly in VLC.

 The Tests:

 First, I thought that this problem was the infamous 1GB avi limit issue
 but it is not so as my tests below reveal.

 For any 1 hour 40 minutes 720x400 movie (I tried with both an XVID .avi
 and a x264 .m4v, like mentioned before, the source does not matter):

 ffmpeg -i DIT.avi -c:v mpeg4 -vtag XVID -b:v 1300k -r 23.976 -c:a ac3 -b:a
 128k -ar 48000 -ac 2 D_1300.avi

 ffmpeg -i DIT.avi -c:v mpeg4 -vtag XVID -b:v 1350k -r 23.976 -c:a ac3 -b:a
 128k -ar 48000 -ac 2 D_1350.avi

 ffmpeg -i DIT.avi -c:v mpeg4 -vtag XVID -b:v 1900k -r 23.976 -c:a ac3 -b:a
 128k -ar 48000 -ac 2 D_1900.avi

 ffmpeg -i DIT.avi -c:v mpeg4 -vtag XVID -b:v 2000k -r 23.976 -c:a ac3 -b:a
 128k -ar 48000 -ac 2 D_2000.avi

 The files encoded at 1300k (or below) are fine.
 The files encoded from 1350k to 1900k are incorrect.
 The files encoded at 2000k (and above, ie. 2100k) are fine.

 D_1300.avi is 1.00GB with a 927MB video stream and a 92MB audio stream.
 D_2000.avi is 1.49GB with a 1.39GB video stream and a 92MB audio stream.

 For any 2 hours 11 minutes 720x304 movie (I tried with 2 different x264
 .m4v):

 ffmpeg -i PR.m4v -c:v mpeg4 -vtag XVID -b:v 900k -r 23.976 -c:a ac3 -b:a
 128k -ar 48000 -ac 2 P_900.avi

 ffmpeg -i PR.m4v -c:v mpeg4 -vtag XVID -b:v 1000k -r 23.976 -c:a ac3 -b:a
 128k -ar 48000 -ac 2 P_1000.avi

 ffmpeg -i PR.m4v -c:v mpeg4 -vtag XVID -b:v 1900k -r 23.976 -c:a ac3 -b:a
 128k -ar 48000 -ac 2 P_1900.avi

 ffmpeg -i PR.m4v -c:v mpeg4 -vtag XVID -b:v 2000k -r 23.976 -c:a ac3 -b:a
 128k -ar 48000 -ac 2 P_2000.avi

 The files encoded at 900k (or below) are fine.
 The files encoded from 1000k to 1900k are incorrect.
 The files encoded at 2000k (and above, ie. 2100k) are fine.

 Fine means that file will play on the DVD Player and the GUI MediaInfo
 reports correct values for the Streams Lengths and Sizes.
 Incorrect means that the file will not play beyond a certain mark and the
 GUI MediaInfo reports incorrect values for the Streams Lengths and/or
 Sizes.

 P_900.avi is 975MB with a 844MB video stream and a 120MB audio stream.
 P_2000.avi is 1.96GB with a 1.83GB video stream and a 120MB audio stream.

 You will see below the info generated by ffmpeg -v 9 -loglevel 99 -i for
 P_1900.avi and P_2000.avi, as well as the info generated by mediainfo CLI
 for the same files. Except for the names and bitrates, there are no
 differences between those files.

 However, when I inspect P_2000.avi with the GUI MediaInfo, it shows the
 same values for Video and Audio Stream Size than its CLI counterpart, but
 when I inspect P_1900.avi with the GUI MediaInfo, it presents a wrong
 Audio Stream Size (58MB instead of 120) and a wrong Audio Stream Length
 (1h 3mn instead of 2h 11mn).

 When I inspect P_1000.avi with the GUI MediaInfo, it presents a wrong
 Video Stream Size (74MB instead of 938) and Audio Stream Size (4MB instead
 of 120) but both Stream Lengths are presented correctly (2h 11mn).

 My theory (but I'm not certain...): This leads me to think that there
 might be a file header issue. Each Stream has its own header and that
 header is correct and is the one that is being dumped by ffmpeg or
 mediainfo, but there might be a general file header that should contain
 redundant information and this header is incorrect and is the one being
 dumped by the MediaInfo GUI, and used (unfortunately) by my DVD Player...

 Additional notes:

 Using libmp3lame instead of ac3 makes thing worse, both D_MP3_1700.avi and
 D_MP3_2000.avi are incorrect.

 I hope that this is detailed enough for you to figure out what is
 happening.

 Regards,
 Toshiro

 ------------ P_1900.avi ffmpeg info ------------------------

 ffmpeg version 1.2.1-tessus Copyright (c) 2000-2013 the FFmpeg developers
   built on May  9 2013 21:58:14 with llvm-gcc 4.2.1 (LLVM build 2336.1.00)
   configuration: --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm
 --extra-version=tessus --disable-shared --enable-static --disable-ffplay
 --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame
 --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid
 --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb
 --enable-libopencore-amrwb --enable-libxavs --enable-version3 --enable-
 libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm
 --enable-libopus --enable-fontconfig --enable-libfreetype --enable-libass
 --enable-filters --enable-runtime-cpudetect
   libavutil      52. 18.100 / 52. 18.100
   libavcodec     54. 92.100 / 54. 92.100
   libavformat    54. 63.104 / 54. 63.104
   libavdevice    54.  3.103 / 54.  3.103
   libavfilter     3. 42.103 /  3. 42.103
   libswscale      2.  2.100 /  2.  2.100
   libswresample   0. 17.102 /  0. 17.102
   libpostproc    52.  2.100 / 52.  2.100
 Splitting the commandline.
 Reading option '-v' ... matched as option 'v' (set libav* logging level)
 with argument '9'.
 Reading option '-loglevel' ... matched as option 'loglevel' (set libav*
 logging level) with argument '99'.
 Reading option '-i' ... matched as input file with argument
 '/Users/tlees/Movies/More Tests 11:11/P_1900.avi'.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option v (set libav* logging level) with argument 9.
 Successfully parsed a group of options.
 Parsing a group of options: input file /Users/tlees/Movies/More Tests
 11:11/P_1900.avi.
 Successfully parsed a group of options.
 Opening an input file: /Users/tlees/Movies/More Tests 11:11/P_1900.avi.
 [avi @ 0x10200f000] Format avi probed with size=2048 and score=100
 [avi @ 0x101b00d20] use odml:1
 [avi @ 0x10200f000] File position before avformat_find_stream_info() is
 9900
 [avi @ 0x10200f000] All info found
 rfps: 23.750000 0.011839
     Last message repeated 1 times
 rfps: 23.833333 0.004718
     Last message repeated 1 times
 rfps: 23.916667 0.000816
     Last message repeated 1 times
 rfps: 24.000000 0.000134
     Last message repeated 1 times
 rfps: 24.083333 0.002670
     Last message repeated 1 times
 rfps: 24.166667 0.008427
     Last message repeated 1 times
 rfps: 24.250000 0.017403
     Last message repeated 1 times
 rfps: 47.666667 0.018872
     Last message repeated 1 times
 rfps: 47.750000 0.009458
     Last message repeated 1 times
 rfps: 47.833333 0.003264
     Last message repeated 1 times
 rfps: 47.916667 0.000289
     Last message repeated 1 times
 rfps: 48.000000 0.000534
     Last message repeated 1 times
 rfps: 48.083333 0.003998
     Last message repeated 1 times
 rfps: 48.166667 0.010682
     Last message repeated 1 times
 rfps: 23.976024 0.000000
     Last message repeated 1 times
 rfps: 47.952048 0.000000
     Last message repeated 1 times
 [avi @ 0x10200f000] File position after avformat_find_stream_info() is
 58351
 Input #0, avi, from '/Users/tlees/Movies/More Tests 11:11/P_1900.avi':
   Metadata:
     encoder         : Lavf54.63.104
   Duration: 02:11:17.46, start: 0.000000, bitrate: 2036 kb/s
     Stream #0:0, 41, 125/2997: Video: mpeg4 (Simple Profile) (XVID /
 0x44495658), yuv420p, 720x404 [SAR 1:1 DAR 180:101], 1/2997, 23.98 fps,
 23.98 tbr, 23.98 tbn, 2997 tbc
     Stream #0:1, 53, 4/125: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz,
 stereo, fltp, 128 kb/s
 Successfully opened the file.
 At least one output file must be specified
 [AVIOContext @ 0x101b00c40] Statistics: 3730528 bytes read, 8 seeks

 ------------ P_2000.avi ffmpeg info ------------------------

 ffmpeg version 1.2.1-tessus Copyright (c) 2000-2013 the FFmpeg developers
   built on May  9 2013 21:58:14 with llvm-gcc 4.2.1 (LLVM build 2336.1.00)
   configuration: --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm
 --extra-version=tessus --disable-shared --enable-static --disable-ffplay
 --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame
 --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid
 --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb
 --enable-libopencore-amrwb --enable-libxavs --enable-version3 --enable-
 libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm
 --enable-libopus --enable-fontconfig --enable-libfreetype --enable-libass
 --enable-filters --enable-runtime-cpudetect
   libavutil      52. 18.100 / 52. 18.100
   libavcodec     54. 92.100 / 54. 92.100
   libavformat    54. 63.104 / 54. 63.104
   libavdevice    54.  3.103 / 54.  3.103
   libavfilter     3. 42.103 /  3. 42.103
   libswscale      2.  2.100 /  2.  2.100
   libswresample   0. 17.102 /  0. 17.102
   libpostproc    52.  2.100 / 52.  2.100
 Splitting the commandline.
 Reading option '-v' ... matched as option 'v' (set libav* logging level)
 with argument '9'.
 Reading option '-loglevel' ... matched as option 'loglevel' (set libav*
 logging level) with argument '99'.
 Reading option '-i' ... matched as input file with argument
 '/Users/tlees/Movies/More Tests 11:11/P_2000.avi'.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option v (set libav* logging level) with argument 9.
 Successfully parsed a group of options.
 Parsing a group of options: input file /Users/tlees/Movies/More Tests
 11:11/P_2000.avi.
 Successfully parsed a group of options.
 Opening an input file: /Users/tlees/Movies/More Tests 11:11/P_2000.avi.
 [avi @ 0x10200f000] Format avi probed with size=2048 and score=100
 [avi @ 0x101b00d20] use odml:1
 [avi @ 0x10200f000] File position before avformat_find_stream_info() is
 9900
 [avi @ 0x10200f000] All info found
 rfps: 23.750000 0.011839
     Last message repeated 1 times
 rfps: 23.833333 0.004718
     Last message repeated 1 times
 rfps: 23.916667 0.000816
     Last message repeated 1 times
 rfps: 24.000000 0.000134
     Last message repeated 1 times
 rfps: 24.083333 0.002670
     Last message repeated 1 times
 rfps: 24.166667 0.008427
     Last message repeated 1 times
 rfps: 24.250000 0.017403
     Last message repeated 1 times
 rfps: 47.666667 0.018872
     Last message repeated 1 times
 rfps: 47.750000 0.009458
     Last message repeated 1 times
 rfps: 47.833333 0.003264
     Last message repeated 1 times
 rfps: 47.916667 0.000289
     Last message repeated 1 times
 rfps: 48.000000 0.000534
     Last message repeated 1 times
 rfps: 48.083333 0.003998
     Last message repeated 1 times
 rfps: 48.166667 0.010682
     Last message repeated 1 times
 rfps: 23.976024 0.000000
     Last message repeated 1 times
 rfps: 47.952048 0.000000
     Last message repeated 1 times
 [avi @ 0x10200f000] File position after avformat_find_stream_info() is
 58351
 Input #0, avi, from '/Users/tlees/Movies/More Tests 11:11/P_2000.avi':
   Metadata:
     encoder         : Lavf54.63.104
   Duration: 02:11:17.46, start: 0.000000, bitrate: 2135 kb/s
     Stream #0:0, 41, 125/2997: Video: mpeg4 (Simple Profile) (XVID /
 0x44495658), yuv420p, 720x404 [SAR 1:1 DAR 180:101], 1/2997, 23.98 fps,
 23.98 tbr, 23.98 tbn, 2997 tbc
     Stream #0:1, 53, 4/125: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz,
 stereo, fltp, 128 kb/s
 Successfully opened the file.
 At least one output file must be specified
 [AVIOContext @ 0x101b00c40] Statistics: 3714504 bytes read, 8 seeks

 ------------ P_1900.avi media info ------------------------

 General
 Complete name                            : /Users/tlees/Movies/More Tests
 11:11/P_1900.avi
 Format                                   : AVI
 Format/Info                              : Audio Video Interleave
 Format profile                           : OpenDML
 File size                                : 1.87 GiB
 Duration                                 : 2h 11mn
 Overall bit rate                         : 2 036 Kbps
 Writing application                      : Lavf54.63.104

 Video
 ID                                       : 0
 Format                                   : MPEG-4 Visual
 Format profile                           : Simple at L1
 Format settings, BVOP                    : No
 Format settings, QPel                    : No
 Format settings, GMC                     : No warppoints
 Format settings, Matrix                  : Default (H.263)
 Codec ID                                 : XVID
 Codec ID/Hint                            : XviD
 Duration                                 : 2h 11mn
 Bit rate                                 : 1 897 Kbps
 Width                                    : 720 pixels
 Height                                   : 404 pixels
 Display aspect ratio                     : 16:9
 Frame rate                               : 23.976 fps
 Color space                              : YUV
 Chroma subsampling                       : 4:2:0
 Bit depth                                : 8 bits
 Scan type                                : Progressive
 Compression mode                         : Lossy
 Bits/(Pixel*Frame)                       : 0.272
 Stream size                              : 1.74 GiB (93%)
 Writing library                          : Lavc54.92.100

 Audio
 ID                                       : 1
 Format                                   : AC-3
 Format/Info                              : Audio Coding 3
 Mode extension                           : CM (complete main)
 Format settings, Endianness              : Big
 Codec ID                                 : 2000
 Duration                                 : 2h 11mn
 Bit rate mode                            : Constant
 Bit rate                                 : 128 Kbps
 Channel count                            : 2 channels
 Channel positions                        : Front: L R
 Sampling rate                            : 48.0 KHz
 Bit depth                                : 16 bits
 Compression mode                         : Lossy
 Stream size                              : 120 MiB (6%)
 Alignment                                : Aligned on interleaves
 Interleave, duration                     : 32 ms (0.77 video frame)

 ------------ P_2000.avi media info ------------------------

 General
 Complete name                            : /Users/tlees/Movies/More Tests
 11:11/P_2000.avi
 Format                                   : AVI
 Format/Info                              : Audio Video Interleave
 Format profile                           : OpenDML
 File size                                : 1.96 GiB
 Duration                                 : 2h 11mn
 Overall bit rate                         : 2 136 Kbps
 Writing application                      : Lavf54.63.104

 Video
 ID                                       : 0
 Format                                   : MPEG-4 Visual
 Format profile                           : Simple at L1
 Format settings, BVOP                    : No
 Format settings, QPel                    : No
 Format settings, GMC                     : No warppoints
 Format settings, Matrix                  : Default (H.263)
 Codec ID                                 : XVID
 Codec ID/Hint                            : XviD
 Duration                                 : 2h 11mn
 Bit rate                                 : 1 997 Kbps
 Width                                    : 720 pixels
 Height                                   : 404 pixels
 Display aspect ratio                     : 16:9
 Frame rate                               : 23.976 fps
 Color space                              : YUV
 Chroma subsampling                       : 4:2:0
 Bit depth                                : 8 bits
 Scan type                                : Progressive
 Compression mode                         : Lossy
 Bits/(Pixel*Frame)                       : 0.286
 Stream size                              : 1.83 GiB (94%)
 Writing library                          : Lavc54.92.100

 Audio
 ID                                       : 1
 Format                                   : AC-3
 Format/Info                              : Audio Coding 3
 Mode extension                           : CM (complete main)
 Format settings, Endianness              : Big
 Codec ID                                 : 2000
 Duration                                 : 2h 11mn
 Bit rate mode                            : Constant
 Bit rate                                 : 128 Kbps
 Channel count                            : 2 channels
 Channel positions                        : Front: L R
 Sampling rate                            : 48.0 KHz
 Bit depth                                : 16 bits
 Compression mode                         : Lossy
 Stream size                              : 120 MiB (6%)
 Alignment                                : Aligned on interleaves
 Interleave, duration                     : 32 ms (0.77 video frame)

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/3145>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list