winshining / nginx-http-flv-module

A media streaming server based on nginx-rtmp-module. In addtion to the features nginx-rtmp-module provides, HTTP-FLV, GOP cache, VHosts (one IP for multi domain names) and JSON style statistics are supported now.
BSD 2-Clause "Simplified" License
2.71k stars 567 forks source link

The clock rate during play video by HTTP-FLV is slower compared to the normal clock rate. #259

Closed Sectran closed 5 months ago

Sectran commented 5 months ago

At the beginning, the time interval between the streaming machine's clock and the playback time for the HTTP-FLV was around 10 seconds. After a while, this time interval increased. I'm not sure if it's due to a discrepancy in clock rates between the HTTP-FLV streaming and the actual clock rates, or if there are other reasons. nginx version:1.22 nginx-http-module version:lasted OS:Linux at the begainning: left is rtmp and right is http-flv

image

in a while:

image

You can see he time interval has increased, and what I can confirm is that the clock rate during RTMP streaming is correct.

by the way,I play flv useing flv.min.js,this is a demo:

    <div class="mainContainer">
        <video controls controlslist="nodownload noplaybackrat" id="my-video" autoplay
            class="LiveVideo video-js vjs-default-skin">Your browser is too
            old which doesn't support HTML5 video.</video>
        <br>
    </div>
    <script>
        var player = document.getElementById('my-video');
        var videoPath = 'http://host ipaddr:80/live?port=1935&app=myapp&stream=test'
        function flv_load(urlPath) {
            flvPlayer = flvjs.createPlayer({
                type: 'flv',
                isLive: true,
                url: urlPath
            });
            flvPlayer.attachMediaElement(player);
            flvPlayer.load();
        }
        window.onload = function () {
            flv_load(videoPath);
        }
    </script>
winshining commented 5 months ago

Make sure your network is well. Normally, the delay of HTTP-FLV is about 1~5s (without GOP cache). It seems that HTTP-FLV halted (maybe caused by server timeout). By the way, there is cumulative delay in HTTP-FLV streaming because of network jitter. In other words, TCP is a reliable delivery protocol, it may delay in network, player must wait for delayed packets, that is out of control of server. Further, HTTP-FLV is not as interactive as RTMP, so delay in HTTP-FLV streaming is often larger than RTMP. Players can discard too delayed packets to catch up the streaming pace.