diff --git a/nginx-transcoder/nginx-no-ssl.conf b/nginx-transcoder/nginx-no-ssl.conf index 13d2164..4941ca0 100644 --- a/nginx-transcoder/nginx-no-ssl.conf +++ b/nginx-transcoder/nginx-no-ssl.conf @@ -16,6 +16,13 @@ rtmp { application live { live on; + # Start the exec'd transcoder's input at a keyframe with audio held + # until video flows, so both tracks begin together. Without these, + # the subscriber gets audio up to one GOP before decodable video and + # ffmpeg records that skew as a leading empty edit on the video + # track, which desyncs players that drop edit lists in MSE. + wait_key on; + wait_video on; on_publish http://127.0.0.1/route_to_auth; exec ffmpeg -analyzeduration 10M -i rtmp://127.0.0.1/live/$name -strict -2 -c:a libopus -mapping_family 255 ${FFMPEG_FLAGS} -f dash /opt/data/dash/$name.mpd 2>>/tmp/nginx_rtmp_ffmpeg_log; } diff --git a/nginx-transcoder/nginx.conf b/nginx-transcoder/nginx.conf index 874d7a3..be7d508 100644 --- a/nginx-transcoder/nginx.conf +++ b/nginx-transcoder/nginx.conf @@ -16,6 +16,13 @@ rtmp { application live { live on; + # Start the exec'd transcoder's input at a keyframe with audio held + # until video flows, so both tracks begin together. Without these, + # the subscriber gets audio up to one GOP before decodable video and + # ffmpeg records that skew as a leading empty edit on the video + # track, which desyncs players that drop edit lists in MSE. + wait_key on; + wait_video on; on_publish http://127.0.0.1/route_to_auth; exec ffmpeg -analyzeduration 10M -i rtmp://127.0.0.1/live/$name -strict -2 -c:a libopus -mapping_family 255 ${FFMPEG_FLAGS} -f dash /opt/data/dash/$name.mpd 2>>/tmp/nginx_rtmp_ffmpeg_log; }