HLS fragment length and playlist length with nginx-rtmp module

10,989

It seem likes your video source has a special keyframe, which is minimum at 8s, you can't cut it into 1s segments. And the hls_playlist_length must be longer than each segment'length. You should change hls_playlist_length to 20s for example.

Share:
10,989
asiagohan
Author by

asiagohan

Updated on June 04, 2022

Comments

  • asiagohan
    asiagohan almost 2 years

    I installed nginx and the nginx-rtmp module on Amazon Linux. RTMP stream works fine, but some configure about HLS does not work.

    On configuration file,

    rtmp {    
        server {    
            listen 1935;    
            max_streams 32;    
            chunk_size 4096;    
    
            access_log /var/log/nginx/rtmp_access.log;    
             application live {    
                live on;    
                hls on;    
                hls_path /usr/local/nginx/html/hls;    
                hls_playlist_length 4s;    
                hls_fragment 1s;    
                hls_continuous on;    
            }    
        }    
    

    but when I start streaming, .m3u8 file is created like this

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-MEDIA-SEQUENCE:0
    #EXT-X-TARGETDURATION:8
    #EXT-X-DISCONTINUITY
    #EXTINF:8.333,
    test-0.ts
    #EXTINF:8.333,
    test-1.ts
    #EXTINF:8.334,
    test-2.ts
    

    These .ts file length and playlist length are not expected. Why?