ffmpegvideo-streamingmpeg-dashlow-latency

FFMPEG ldash 1 low latency option but dash.js not low latency and buggy with lag and start always at 0 cannot control


I can't figure out how to fix this. playing a supposed low latency mpeg-dash manifest but it's with lots of lag, and play-stop-wait-play-stop-wait....

I have latest ubuntu with latest ffmpeg

here the command

ffmpeg -re -i file.webm -c:v libx264 -preset ultrafast -tune zerolatency -c:a aac -ac 2 -strict -2 -crf 18 -profile:v baseline -maxrate 1000k -pix_fmt yuv420p -bufsize 969k -ldash 1 -streaming 1 -use_template 0 -use_timeline 1 -seg_duration 1 -remove_at_exit 0 -f dash index.mpd

and player side

<script src="/templates/account_js/dashjs/dash.3.1.0.min.js"></script>
    <center><video width="90%" height="600" id="videoPlayer" controls="" src="" playsinline="true" preload="metadata" ></video></center>
    <script>
    (function(){
        var url = "index.mpd";
        var player = dashjs.MediaPlayer().create();
        player.initialize(document.querySelector("#videoPlayer"), url, true);
        player.updateSettings({
            streaming: {
                 lowLatencyEnabled: true, 
                 liveDelay: 3,
                 liveCatchup: {
                    enabled: true,
                    minDrift: 0.05,
                    maxDrift: 0,
                    playbackRate: 0.5,
                    latencyThreshold: 30    
                  }
            }
        });
    })();     
    video = document.getElementById("videoPlayer");
    video.addEventListener("loadedmetadata", function(){ video.muted = true; video.play(); }, false);
    </script>

but it's NOT low latency, It forces to start at 0 and cannot control the video

is there a better config setup and what need to be fixed : ffmpeg options or dash.js config


Solution

  • You are using an older version of dash.js. Try using the latest stable one which is currently version 3.2.1: http://cdn.dashjs.org/v3.2.1/dash.all.min.js

    In your version 3.1.0 the settings look different:

      player.updateSettings({
                streaming: {
                     lowLatencyEnabled: true, 
                     liveDelay: 3,
                     liveCatchUpMinDrift: 0.02,
                     liveCatchUpMaxDrift: 0,
                     liveCatchUpPlaybackRate: 0.5
                      }
                }
            });