HLS Stream delay

Forum home -> Tech Talk -> View topic

Post

Posted
Rating:
#361 (In Topic #74)
Avatar
Standard member

Decrease delay

I have just setup HLS Streaming server and theres about a 1m 20s delay is there any way I could decrease this alot, Its only an audio stream so if video quality is effected by reducing delay I don't mind atall.

This is my config.

worker_processes  auto;
events {
    worker_connections  1024;
}

# RTMP configuration
rtmp {
    server {
        listen 1935; # Listen on standard RTMP port
        chunk_size 2000;

        application show {
            live on;
            # Turn on HLS
            hls on;
            hls_path /nginx/hls/;
            hls_fragment 3;
            hls_playlist_length 60;
            # disable consuming the stream from nginx as rtmp
            deny play all;

        }
    }
}

http {
    sendfile off;
    tcp_nopush on;
   #  aio on;
    directio 512;
    default_type application/octet-stream;

    server {
        listen 8080;

        location / {
            # Disable cache
            add_header 'Cache-Control' 'no-cache';

            # CORS setup
            add_header 'Access-Control-Allow-Origin' '*' always;
            add_header 'Access-Control-Expose-Headers' 'Content-Length';

            # allow CORS preflight requests
            if ($request_method = 'OPTIONS') {
                add_header 'Access-Control-Allow-Origin' '*';
                add_header 'Access-Control-Max-Age' 1728000;
                add_header 'Content-Type' 'text/plain charset=UTF-8';
                add_header 'Content-Length' 0;
                return 204;
            }

            types {
                application/dash+xml mpd;
                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }

            root /nginx/;
        }
    }
}

Edit I have managed to get the delay down to about 30 seconds by changing


 hls_fragment 3;
hls_playlist_length 60;

to

hls_fragment 1;
            hls_playlist_length 10;


Would it be possible to get it any lower?

Last edit: by Matthew1106

Online now: No Back to the top

Post

Posted
Rating:
#400
Avatar
Standard member
Just a quick question, how have you tested this? What is the current upstream of the PC uploading the data? Have you tested this on the same connection as the stream? On a seperate connection? Perhaps a mobile device? I do know based on routing of the "good ole internet" that this can in fact cause latency.
Online now: No Back to the top
1 guest and 0 members have just viewed this.