[FFmpeg-trac] #9471(ffmpeg:new): EAC3 native encoder is only gapless in the beginning, not in the end

FFmpeg trac at avcodec.org
Sat Oct 23 15:45:42 EEST 2021


#9471: EAC3 native encoder is only gapless in the beginning, not in the end
-------------------------------------+-------------------------------------
             Reporter:  Balling      |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  ffmpeg       |                  Version:  git-
             Keywords:  mp4 eac3     |  master
  editlist gapless                   |               Blocked By:
             Blocking:               |  Reproduced by developer:  1
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 edts atmos (editlist) has media time and media duration, yet even though
 media time is correctly written for EAC3 and AAC (native EAC3 encoder has
 256 sample of silence (a.k.a. encoder delay) that are then removed from
 the beginning with native encoder and native AAC has 1024 samples that are
 also working great) the media duration is not correctly written. Even if
 it were to be correctly written media duration is not applied on decoding
 even for AAC, see for example
 https://bugs.chromium.org/p/chromium/issues/detail?id=668999 that is still
 present in git-master!!!
 How to reproduce:
 {{{
 % ffmpeg -f lavfi -i "sine=frequency=1000:duration=5" -c:a eac3
 outeac3.mp4
 ffmpeg version N-104341-g933765aa0e-20211013 Copyright (c) 2000-2021 the
 FFmpeg developers
   built with gcc 10-win32 (GCC) 20210408
   configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static
 --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64
 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug
 --enable-shared --disable-static --disable-w32threads --enable-pthreads
 --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype
 --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig
 --enable-libvorbis --enable-opencl --enable-libvmaf --enable-vulkan
 --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-
 avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac
 --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libglslang
 --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame
 --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp
 --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-
 libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-
 librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-
 libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d
 --disable-libdrm --disable-vaapi --enable-libvidstab --enable-libx264
 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg
 --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags=
 --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-
 version=20211013
   libavutil      57.  7.100 / 57.  7.100
   libavcodec     59. 12.100 / 59. 12.100
   libavformat    59.  6.100 / 59.  6.100
   libavdevice    59.  0.101 / 59.  0.101
   libavfilter     8. 14.100 /  8. 14.100
   libswscale      6.  1.100 /  6.  1.100
   libswresample   4.  0.100 /  4.  0.100
   libpostproc    56.  0.100 / 56.  0.100
 Input #0, lavfi, from 'sine=frequency=1000:duration=5':
   Duration: N/A, start: 0.000000, bitrate: 705 kb/s
   Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (pcm_s16le (native) -> eac3 (native))
 Press [q] to stop, [?] for help
 Output #0, mp4, to 'outeac3.mp4':
   Metadata:
     encoder         : Lavf59.6.100
   Stream #0:0: Audio: eac3 (ec-3 / 0x332D6365), 44100 Hz, mono, fltp, 96
 kb/s
     Metadata:
       encoder         : Lavc59.12.100 eac3
 size=      60kB time=00:00:05.00 bitrate=  98.2kbits/s speed= 487x
 video:0kB audio:59kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: 2.166617%
 }}}

 {{{
 Track duration:                    5010 (0x00001392) - 5010 (0x1392) ms
 Media time:                        256 (0x00000100) - 256 (0x100) ms
 Media rate:                        65536 (0x00010000) - 1.000
 }}}

 Now compare it to aac: ffmpeg -f lavfi -i "sine=frequency=1000:duration=5"
 -c:a aac fileaac.mp4:

 {{{
 Track duration:                    5000 (0x00001388) - 5000 (0x1388) ms
 Media time:                        1024 (0x00000400) - 1024 (0x400)
 Media rate:                        65536 (0x00010000) - 1.000
 }}}
 Unfortunately a) Mediainfo tracer is buggy in that part:
 https://github.com/MediaArea/MediaInfoLib/issues/1441
 b) I am not sure that media duration is really buggy since it is not
 applied anyway!
 c) I checked it all decoding to wav and checking in Audacity.
 d) I dunno whether sbgp and sgpd are needed (whether EAC3 depends on
 previous frames)

 Patches should be submitted to the ffmpeg-devel mailing list and not this
 bug tracker.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9471>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list