[FFmpeg-trac] #5162(avcodec:new): aac encoder adds extra frame(s)

FFmpeg trac at avcodec.org
Sat Jan 16 14:54:09 CET 2016


#5162: aac encoder adds extra frame(s)
---------------------------------+--------------------------------------
             Reporter:  slhck    |                     Type:  defect
               Status:  new      |                 Priority:  normal
            Component:  avcodec  |                  Version:  git-master
             Keywords:  aac      |               Blocked By:
             Blocking:           |  Reproduced by developer:  0
Analyzed by developer:  0        |
---------------------------------+--------------------------------------
 Summary of the bug: The aac encoder adds one extra audio frame when
 encoding

 How to reproduce:
 {{{
 ffmpeg -i out.mp4 -c:v copy -c:a aac out2.mp4
 ffmpeg version N-78077-g5989add-tessus Copyright (c) 2000-2016 the FFmpeg
 developers
   built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM
 3.5svn)
   configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --as=yasm
 --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl
 --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm
 --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
 --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger
 --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab
 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-
 libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-
 libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-
 ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
   libavutil      55. 13.100 / 55. 13.100
   libavcodec     57. 22.100 / 57. 22.100
   libavformat    57. 21.101 / 57. 21.101
   %
 !3491
   libavdevice    57.  0.100 / 57.  0.100
   libavfilter     6. 25.100 /  6. 25.100
   libswscale      4.  0.100 /  4.  0.100
   libswresample   2.  0.101 /  2.  0.101
   libpostproc    54.  0.100 / 54.  0.100
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2avc1mp41
     encoder         : Lavf56.40.101
   Duration: 00:12:53.97, start: 0.000000, bitrate: 2180 kb/s
     Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
 1920x1080, 1857 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
     Metadata:
       handler_name    : VideoHandler
     Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
 stereo, fltp, 317 kb/s (default)
     Metadata:
       handler_name    : SoundHandler
 [mp4 @ 0x7f8f8b842a00] Codec for stream 0 does not use global headers but
 container format requires global headers
 Output #0, mp4, to 'out2.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2avc1mp41
     encoder         : Lavf57.21.101
     Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p,
 1920x1080, q=2-31, 1857 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc
 (default)
     Metadata:
       handler_name    : VideoHandler
     Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz,
 stereo, fltp, 128 kb/s (default)
     Metadata:
       handler_name    : SoundHandler
       encoder         : Lavc57.22.100 aac
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #0:1 -> #0:1 (aac (native) -> aac (native))
 Press [q] to stop, [?] for help
 frame=19348 fps=353 q=-1.0 Lsize=  188726kB time=00:12:53.97
 bitrate=1997.5kbits/s speed=14.1x
 video:175481kB audio:12669kB subtitle:0kB other streams:0kB global
 headers:0kB muxing overhead: 0.306213%
 [aac @ 0x7f8f8b806600] Qavg: 691.497
 }}}

 The input file:

 {{{
 ffprobe -i out.mp4 -show_streams | grep nb_frames
 …
 nb_frames=36280
 }}}

 The output file has one extra (audio) frame:

 {{{
 ffprobe -i out2.mp4 -show_streams | grep nb_frames
 …
 nb_frames=36281
 }}}

 This means that if you re-encode a file multiple times, audio and video
 will become more and more asynchronous.

 The same bug affects libfdk_aac as well, although it adds two frames. When
 I add `-shortest`, I get one frame ''less'' than the original file.

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


More information about the FFmpeg-trac mailing list