arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.38k stars 3.51k forks source link

latency between rtmp published to hls app and m3u8 #753

Open godivyam opened 8 years ago

godivyam commented 8 years ago

there is a latency between the rtmp published to hls app and the m3u8 generated by nginx-rtmp-module. Around 5 secs. I am using hls_fragment 2s; hls_playlist_length 6s. In the ffmpeg process publishing to hls app I am forcing key frames every 2.2 secs (here I tried different values e.g.:1s,5s 2.2 secs gave me the best results). Any hints as to what is introducing this delay and how I can reduce it ? I am directly watching the m3u8 on safari.

victusfate commented 8 years ago

It sounds like the hls playlist length is related to your latency (ie it's generating the mpegts and then writing them when it has at least a full playlist?). One thing worth exploring is the hls_playlist_length, I've seen 30s playlists have a latency of around 35s with wowza etc. Just getting started with nginx rtmp.

Also is there a best fork that folks are using to bug patching/updates? https://github.com/sergey-dryabzhinsky/nginx-rtmp-module

Maybe @arut can pass over maintenance to @sergey-dryabzhinsky ?

sergey-dryabzhinsky commented 8 years ago

It's not defined in wiki, but nginx-rtmp have param: hls_max_fragment == hls_fragment * 10. So set it to 2s too.

And yes, encoding with keyframe interval or GOP defined as much close to hls_fragment value can be solution too.

Because fragments slised by keyframes.