[FFmpeg-user] DASH-LL audio & video segment files created at different rates

Danny Wilson danny at klarity.tv
Tue May 25 12:09:41 EEST 2021


I'm trying to use FFmpeg to simulate a "live" DASH-LL from a file.  However, the audio "m4s" files and the video "m4s" files are not being created at the same rate.

The video files lag significantly behind the audio (i.e., they don't exist).  This causes issues with the player since it tries to fetch both audio and video segments with a given index. e.g. it tries to fetch chunk-stream0-018.m4s and chunk-stream1-018.m4s but the stream0 chunk (video) hasn't yet been created by FFmpeg causing the player to give a 404 error.

For example, encoding just 60 seconds ends up with these files in the web root folder:

init-stream0.m4s         
init-stream1.m4s  
chunk-stream0-00001.m4s  chunk-stream1-00019.m4s  
chunk-stream0-00002.m4s  chunk-stream1-00020.m4s  
chunk-stream0-00003.m4s  chunk-stream1-00021.m4s  
chunk-stream0-00004.m4s  chunk-stream1-00022.m4s  
chunk-stream0-00005.m4s  chunk-stream1-00023.m4s  
chunk-stream0-00006.m4s  chunk-stream1-00024.m4s  
chunk-stream0-00007.m4s  chunk-stream1-00025.m4s  
chunk-stream0-00008.m4s  chunk-stream1-00026.m4s  
chunk-stream0-00009.m4s  chunk-stream1-00027.m4s  
chunk-stream0-00010.m4s  chunk-stream1-00028.m4s  
chunk-stream0-00011.m4s  chunk-stream1-00029.m4s  
chunk-stream0-00012.m4s  chunk-stream1-00030.m4s  
                         chunk-stream1-00031.m4s  
                         
So the player requests chunk-stream0-29.m4s which gives a 404 error because it doesn't exist yet.

The command line is:

ffmpeg -loglevel info -re -i /mnt/swdevel/TestStreams/H264/ThreeHourLongMovie.mp4 -t 60 \
-c:v libx264 -x264-params keyint=120:scenecut=0 -b:v 1M -c:a copy \
-f dash -dash_segment_type mp4 \
 -seg_duration 2 \
 -target_latency 3 \
 -frag_type duration \
 -frag_duration 0.2 \
 -window_size 10 \
 -extra_window_size 3 \
 -streaming 1 \
 -ldash 1 \
 -use_template 1 \
 -use_timeline 0 \
 -write_prft 1 \
 -fflags +nobuffer+flush_packets \
 -format_options "movflags=+cmaf" \
 -utc_timing_url "/pelican/testPlayers/time.php" \
 master.mpd

The <SegmentTemplate> in the MPD file shows the same timescale and duration for both stream0 and stream1:

                <SegmentTemplate timescale="1000000" duration="2000000" availabilityTimeOffset="1.800" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="1">

Both dash.js and shaka player and the stream doesn't play.  I've also tried using a VLSI hardware encoder instead of libx264 but same result so the issue is the the mixer (??)

Any suggestions on how fix this?

Danny

OS: Centos 8

ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (GCC)
  configuration: --extra-ldflags='-L/mnt/swdevel/Torque/lib3p64 -L/lib' --extra-cflags='-I/mnt/swdevel/Torque/include -I/mnt/swdevel/Torque/ext/extinclude/ -I/include' --disable-static --enable-shared --disable-cuda --disable-cuvid --disable-nvenc --enable-libx264 --enable-gpl --enable-libfreetype --enable-libfontconfig --enable-libv4l2 --enable-indev=alsa --enable-indev=v4l2 --bindir=/mnt/swdevel/Torque/bin64 --datadir=/mnt/swdevel/Torque/ext/ffmpeg-build --docdir=/mnt/swdevel/Torque/ext/doc --libdir=/mnt/swdevel/Torque/lib3p64 --shlibdir=/mnt/swdevel/Torque/lib3p64 --incdir=/mnt/swdevel/Torque/ext/extinclude/ffmpeg --mandir=/mnt/swdevel/Torque/ext/ffmpeg-build64 --enable-libxcoder --disable-doc --enable-x86asm --extra-ldflags=-lm --enable-pthreads --extra-libs=-lpthread --disable-debug
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100


More information about the ffmpeg-user mailing list