Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLS m3u8 question #3275

Closed
toots opened this issue Jul 28, 2023 Discussed in #3261 · 0 comments
Closed

HLS m3u8 question #3275

toots opened this issue Jul 28, 2023 Discussed in #3261 · 0 comments
Labels

Comments

@toots
Copy link
Member

toots commented Jul 28, 2023

Discussed in #3261

Originally posted by DennisHeerema July 25, 2023
HI,

I use the HLS setup from the liquidsoap website in combination with nginx. But what i notice is that the live.m3u8 file seems to disapear after a while, looks like it doesn't get recreated, while the other lofi.m3u8, midfi.m3u8 do get recreated and are there all the time.

Here is my liquidsoap script:

log.file.path.set("C:/Program Files/liquidsoaphls/log/HLS.log")
log.stdout.set(true)

# Input the stream,
# from an Icecast server or any other source
url = "http://xx.xxx.xx.xxx:80/studio"
input = mksafe(input.http(url))

s = input
	               
aac_lofi = %ffmpeg(format="mpegts", %audio(codec="libfdk_aac", channels=2, ar=44100, b="48k", afterburner=1, profile="aac_he_v2"))

aac_midfi = %ffmpeg(format="mpegts", %audio(codec="libfdk_aac", channels=2, ar=44100, b="64k"))

streams_info = [("aac_lofi",(40000,"mp4a.40.29","ts")), ("aac_midfi",(110000,"mp4a.40.2","ts"))]

streams = [("aac_lofi",aac_lofi), ("aac_midfi", aac_midfi)]

def segment_name(~position,~extname,stream_name) =
  timestamp = int_of_float(time())
  duration = 4
  "#{stream_name}_#{duration}_#{timestamp}_#{position}.#{extname}"
end

output.file.hls(playlist="live.m3u8", segment_duration=4.0, segments=10, segments_overhead=5, segment_name=segment_name, "C:/nginx/html/hls", streams, input)

and my nginx script

#user  nobody;
# multiple workers works !
worker_processes  2;

events {
    worker_connections  8192;
    # max value 32768, nginx recycling connections+registry optimization = 
    #   this.value * 20 = max concurrent connections currently tested with one worker
    #   C1000K should be possible depending there is enough ram/cpu power
    # multi_accept on;
}


http {
    sendfile off;
    tcp_nopush on;
    directio 512;
    include mime.types;
    default_type application/octet-stream;

    server_names_hash_bucket_size 128;

## Start: Timeouts ##
    client_body_timeout   10;
    client_header_timeout 10;
    keepalive_timeout     30;
    send_timeout          10;
    keepalive_requests    10;




server {
        listen	xxx.xxx.xxx.xxx:8080;
        server_name  video.fzo.nu video.flevoziekenomroep.nl;

        location / {
            root "C:/nginx/html";
        }
		
		location /hls {
            # 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,Content-Range';
            add_header 'Access-Control-Allow-Headers' 'Range';

            # allow CORS preflight requests
            if ($request_method = 'OPTIONS') {
                add_header 'Access-Control-Allow-Origin' '*';
                add_header 'Access-Control-Allow-Headers' 'Range';
                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/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }
			
			root "C:/nginx/html";
		}
    }
}

rtmp {
    server {
        listen 1935;
        allow play all;
        chunk_size 4096;
		buflen 5s;

        application live {
            live on;
            allow publish all;
            allow play all;
			
            #enable HLS
            hls on;
            hls_path "C:/nginx/html/hls";
            hls_fragment 5;
            hls_playlist_length 10m;
        }
		
      application hls {
        live on;
        hls on;
	hls_path "C:/nginx/html/hls";
        hls_fragment 15s;
      }
    }
}

So why does the live.m3u8 created by liquidsoap disapears?

Kind regards,

Dennis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant