josephnhtam / live-streaming-server-net

A .NET implementation of RTMP live streaming server, supporting HTTP-FLV, WebSocket-FLV, HLS, Kubernetes, cloud storage services integration and more.
https://josephnhtam.github.io/live-streaming-server-net/
MIT License
74 stars 11 forks source link

HLS Url not opening #38

Closed vishalsmart closed 2 weeks ago

vishalsmart commented 3 weeks ago

Hi, Can you guide which HLS url in Video Player. I am trying to use https://localhost:8080/hls/live/test10IMIE.m3u8 as video src url and it's not playing.

josephnhtam commented 3 weeks ago

Hi @vishalsmart You can't simply use html video tag to play HLS. Generally, you need a JavaScript library like hls.js or video.js.

vishalsmart commented 3 weeks ago

Hi @josephnhtam it's working fine, but there is very much delay on my local wifi for hls. I am using ffmpeg. It's approx 15-17 seconds delay. Can you suggest best arguments to reduce latency?

josephnhtam commented 3 weeks ago

The latency primarily depends on the keyframe interval and the client-side buffer time. You can transcode your source video to have a specific keyframe interval using the -g option like this

ffmpeg -re -i "video.mp4" -f flv -c:v libx264 -c:a aac -g 24 rtmp://127.0.0.1:1935/live/demo

As a result, a video with 24fps will have a keyframe interval of 1 second.

vishalsmart commented 3 weeks ago

@josephnhtam great, it improved performance. How to reduce this duration using config? - image

josephnhtam commented 3 weeks ago

@vishalsmart This is currently the largest duration of the TS segments in the m3u8 playlist. You can reduce it by reducing the keyframe interval.

vishalsmart commented 3 weeks ago

@josephnhtam can you please guide how to set keyframe interval?

josephnhtam commented 3 weeks ago

@vishalsmart Please refer to the comment above

vishalsmart commented 2 weeks ago

@josephnhtam while using FLV, binding custom certification

Giving error: Hosting failed to start System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified,

My bindings - using var liveStreamingServer = LiveStreamingServerBuilder.Create() .ConfigureServer(options => options.ConfigureSecurity(options => options.ServerCertificate = serverCertificate)) .ConfigureRtmpServer(options => options.AddStandaloneServices().AddFlv()) .ConfigureLogging(options => options.AddConsole()) .Build();

Server certificate (pfx) is valid, working fine.

josephnhtam commented 2 weeks ago

@vishalsmart options.ConfigureSecurity(options => options.ServerCertificate = serverCertificate) only configure the certificate for rtmps. Have you also configured the certificate for the ASP.Net Core Kestrel server?

vishalsmart commented 2 weeks ago

@josephnhtam yes, I applied Kestrel and it worked. Thanks!