I'm working on a low-latency DASH livestream setup where I aim to achieve startup latency close to 1.5 seconds. Here's the current configuration:
Streaming Tool: FFmpeg
Serving Requests: Nginx
UI Player: DASH.js
Below is my FFmpeg command:
ffmpeg -loglevel debug -probesize 32 -analyzeduration 0 -i udp://127.0.0.1:6311?buffer-size=1310172 \
-fflags +nobuffer -flags low_delay -err_detect ignore_err \
-c:v copy -b:v:0 1000k -b:v:1 2000k -c:a copy \
-keyint_min 10 -g 10 -sc_threshold 0 \
-movflags +frag_keyframe+empty_moov+default_base_moof \
-pix_fmt yuv420p -preset ultrafast -tune zerolatency \
-use_template 1 -use_timeline 0 -streaming 1 \
-adaptation_sets "id=0,seg_duration=1.0,streams=v id=1,seg_duration=1.0,streams=a" \
-flags +global_header -format_options "movflags=cmaf" \
-live 1 -ldash 1 -write_prft 1 -target_latency 1.0 \
-http_persistent 1 -f dash /path/manifest.mpd
Challenges I'm Facing:
1> Startup Latency: Despite all the optimizations above, my startup time is still slightly higher than the target of ~1.5 seconds.
2> Chunked Transfer Encoding (CTE): FFmpeg writes to .tmp files until the operation is complete. This prevents real-time data from being accessible for streaming. Is there a way to enable chunked transfer encoding (CTE) to mitigate this, especially when using segment durations greater than 1 second?
Questions:
1> Are there any improvements or adjustments I can make to the FFmpeg command to reduce startup latency further?
2> How can I enable chunked transfer encoding (CTE) so I can use larger segment durations (>1 second) without increasing latency