[FFmpeg-user] Stable Fmp4 fragmentation

Ronak Patel ronak2121 at yahoo.com
Thu Jun 21 16:09:20 EEST 2018


We are considering using fMP4 assets to power our new audio only streaming. One of our big requirements is to have the ability to deterministically clip the streams at the proper aac frame boundaries.

I've noticed that ffmpeg has been getting more stable in how it fragments the source mp4, but it still is not completely consistent. Just a reminder that this stream is audio only, no video, so keyframes and I-frames are not involved.

Here's an example that illustrates a problematic manifest:

#EXT-X-BYTERANGE:9588 at 0
#EXT-X-BYTERANGE:7708 at 9588
#EXT-X-BYTERANGE:9024 at 17296
#EXT-X-BYTERANGE:7896 at 26320
#EXT-X-BYTERANGE:9024 at 34216
#EXT-X-BYTERANGE:8272 at 43240
#EXT-X-BYTERANGE:8272 at 51512
#EXT-X-BYTERANGE:8648 at 59784

We generated this manifest by running this command:

ffmpeg -i output_44_64_heaac.aac -codec copy -hls_time 0.975238095238095 -hls_segment_type mpegts -hls_flags single_file+append_list+split_by_time -hls_playlist_type vod output_44_64_heaac_1sec_ts.m3u8

And here's information about my version of ffmpeg:

ffprobe version git-2018-05-06-053ee99 Copyright (c) 2007-2018 the FFmpeg developers
  built with Apple LLVM version 9.1.0 (clang-902.0.39.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-053ee99 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-nonfree
  libavutil      56. 18.100 / 56. 18.100
  libavcodec     58. 19.100 / 58. 19.100
  libavformat    58. 13.101 / 58. 13.101
  libavdevice    58.  4.100 / 58.  4.100
  libavfilter     7. 21.100 /  7. 21.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100

Even specifying split_by_time doesn't force ffmpeg to split exactly at the correct amount of AAC frames (42 in this case). Is this a bug in ffmpeg or a limitation of the fMP4 file format? Was this fixed in newer versions?



More information about the ffmpeg-user mailing list