[FFmpeg-trac] #10458(undetermined:new): MPEG4 AAC decoding: end padding not trimmed

FFmpeg trac at avcodec.org
Mon Jul 10 21:53:11 EEST 2023


#10458: MPEG4 AAC decoding: end padding not trimmed
-------------------------------------+-------------------------------------
             Reporter:  John Regan   |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 It seems like ffmpeg is properly removing the front padding from m4a
 files, but doesn't account for the end padding added to round frames up to
 1024 samples.

 How to reproduce:
 {{{
 % ffmpeg -f lavfi -i anullsrc=r=48000:d=2 source.wav

 # verify the created audio file as exactly 96000 samples
 % soxi -s source.wav
 96000

 # encode to aac
 % ffmpeg -i source.wav -c:a aac encoded.m4a

 # decode back to wav
 % ffmpeg -i encoded.m4a destination.wav

 # observe the sample count != 96000
 % soxi -s destination.wav
 96256
 }}}

 Using boxdumper from l-smash, I can verify that ffmpeg correctly added an
 edit list box:

 {{{
 [edts: Edit Box]
     position = 845
     size = 36
     [elst: Edit List Box]
         position = 853
         size = 28
         version = 0
         flags = 0x000000
         entry_count = 1
         entry[0]
             segment_duration = 2000
             media_time = 1024
             media_rate = 1.000000
 }}}

 Additionally, there's a media header box with a duration set to 97024 -
 and subtracting the 1024 from the edit list box yields 96000:

 {{{
 [mdhd: Media Header Box]
     position = 889
     size = 32
     version = 0
     flags = 0x000000
     creation_time = UTC 1904/01/01, 00:00:00
     modification_time = UTC 1904/01/01, 00:00:00
     timescale = 48000
     duration = 97024 (00:00:02.021)
     language = und
     pre_defined = 0x0000
 }}}

 and the Decoding Time to Sample Box also adds up to 97024 - 94 samples at
 1024 frames and 1 sample at 768 frames.

 {{{
 [stts: Decoding Time to Sample Box]
     position = 1140
     size = 32
     version = 0
     flags = 0x000000
     entry_count = 2
     entry[0]
         sample_count = 94
         sample_delta = 1024
     entry[1]
         sample_count = 1
         sample_delta = 768
 }}}

 ffmpeg version info:
 {{{
 ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers
   built with gcc 13.1.1 (GCC) 20230429
   configuration: --prefix=/usr --disable-debug --disable-static --disable-
 stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto
 --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-
 ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b
 --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi
 --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libjxl
 --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-
 libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg
 --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e
 --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt
 --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2
 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx
 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb
 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec
 --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-
 version3 --enable-vulkan
   libavutil      58.  2.100 / 58.  2.100
   libavcodec     60.  3.100 / 60.  3.100
   libavformat    60.  3.100 / 60.  3.100
   libavdevice    60.  1.100 / 60.  1.100
   libavfilter     9.  3.100 /  9.  3.100
   libswscale      7.  1.100 /  7.  1.100
   libswresample   4. 10.100 /  4. 10.100
   libpostproc    57.  1.100 / 57.  1.100
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10458>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list