Node-Media-Server icon indicating copy to clipboard operation
Node-Media-Server copied to clipboard

How to reduce the live delay

Open dev-kang opened this issue 7 years ago • 15 comments

const config = { rtmp: { port: 1935, chunk_size: 4096, gop_cache: false, ping: 1, ping_timeout: 1 }, http: { port: 8000, allow_origin: '*' }, auth: { play: false, publish: false, secret: 'nodemedia2017privatekey' } };

Is there a document for the configure?

dev-kang avatar Nov 06 '17 03:11 dev-kang

First make sure that the publish side uses low latency encoding parameters. E.g : x264 enable "-tune zerolatency"

"gop_cache:false" can reduce the delay. But it is best to turn it on and implement latency reduction logic on the side of player.

illuspas avatar Nov 06 '17 07:11 illuspas

How Can I add the -tune zerolatency into the config object? Is it in dashFlags of config.trans?

pattarmanjunath50 avatar Sep 07 '18 12:09 pattarmanjunath50

I also am interested. Can you give more information on low-latency options? I'm using ffmpeg with a live h.264 stream input, transcoding back to h.264 with a lower bandwidth. I'm seeing about 4-6 seconds of latency on LAN. Latency is NOT decreased if I do a straight -c copy vs transcoding.

ryangriggs avatar Sep 14 '18 05:09 ryangriggs

Hi, I am seeing about 25-30 seconds delay in the live streaming and It increases as the livefeed is kept running for long time. I am using the HLS for live streaming on my web page. Please help

pattarmanjunath50 avatar Dec 03 '18 06:12 pattarmanjunath50

+1

LorenzHope avatar Jul 14 '19 10:07 LorenzHope

Hi! How we can reduce the live delay of hls(m3u8). I have 25-35seconds of delay.

mizoRC avatar Sep 02 '19 14:09 mizoRC

Hi

Did anyone manage to reduce delay time here?

Sigma721 avatar Apr 02 '20 18:04 Sigma721

No, same problem here. I switch to another package now.

Systemcheck avatar Apr 15 '21 16:04 Systemcheck

Hi! How we can reduce the live delay of hls(m3u8). I have 25-35seconds of delay.

Did you ever find a Solution?

danielehrhardt avatar Jun 20 '21 21:06 danielehrhardt

No, same problem here. I switch to another package now.

Which one?

danielehrhardt avatar Jun 20 '21 21:06 danielehrhardt

Hi! How we can reduce the live delay of hls(m3u8). I have 25-35seconds of delay.

Did you ever find a Solution?

No, I did not. I have switched to the Nginx RTMP solution. You can play around with the length of the segments, but remember to stay within Apple's recomodations. https://developer.apple.com/documentation/http_live_streaming/hls_authoring_specification_for_apple_devices

Brandonza avatar Jun 21 '21 05:06 Brandonza

Same problem here.. Delay 25 second

Nemra1 avatar Jun 21 '21 08:06 Nemra1

Hello! I haven't found the same solution but I did find that reducing the chunk size will decrease latency. At a chunk size of 500 I get around 3.5 seconds of latency, where as the default 60000 will get you around 10 seconds.

chunk_size: 500

KCGD avatar Jan 04 '22 03:01 KCGD

Guys. I am not 100% sure but the problem is next: I need 100% accurate low latency live stream for RC vehicles that we are making. Camera stream is cut into segments. In my case this is 8 seconds length segment (You can see this live in m3u8 file). When client joins and needs stream, the newest segment can be sent. But the problem is because in my case, segment length is 8 seconds which means the lowest latency is about 8 seconds. I tried to reduce segment length to 1 using this option: hlsFlags: "[hls_time=1:hls_list_size=1:hls_flags=delete_segments]", But this is not possible for some reason. Node media server ignores it, and use 8 seconds instead. I dug into soruce code and found that ffmpeg works received these arguments from config. This is so far what I got.

AleksandarKomazec avatar Sep 14 '23 08:09 AleksandarKomazec

When client joins and needs stream, the newest segment can be sent. But the problem is because in my case, segment length is 8 seconds which means the lowest latency is about 8 seconds. I tried to reduce segment length to 1 using this option: hlsFlags: "[hls_time=1:hls_list_size=1:hls_flags=delete_segments]", But this is not possible for some reason. Node media server ignores it, and use 8 seconds instead.

This happens because ffmpeg ignores hls_time if it lower than keyframes interval in video stream. In my case i changed in OBS Studio keyframe interval to 1 sec (default 0 is set it to auto), and my segments duration is 1s now. Found this information here.

STingerOid avatar Mar 05 '24 05:03 STingerOid