1

I have setup nginx in ubuntu machine for rtmp to hls streaming my webcam according to many articles that there are in the web but it has an unacceptable latency of 35-45 secs!!!

  • How low of latency is desirable for you? If you need very low latency, don't use a protocol based on segmentation. – Brad May 22 '22 at 00:50
  • Like? Can you be more specific? As a I understood the problem is the HLS that is based on segmentation. –  May 23 '22 at 11:32
  • Yes, any segmented method like this will have more latency. If ~10 seconds is acceptable, HLS can work if you've configured your segment sizes and what not accordingly. If you need to go super low latency, you'll have to use WebRTC. – Brad May 23 '22 at 20:48
  • I guessed it but WebRTC is twisted and labyrinthine. Thanks –  May 24 '22 at 15:33
  • Yeah, it's complicated for sure. What is your specific use case? What level of latency do you require? And, at what sort of quality and resolution? – Brad May 24 '22 at 18:08
  • No. I need real time. WebRTC is the only way. You are right. I just thought that somehow I could do without it. Thanks anyway –  May 25 '22 at 13:11

1 Answers1

1

HLS is normally about 10s+ latency, and if you want ~100ms latency you MUST use WebRTC, but WebRTC is complex and not only about the good things.

Generally we want low latency, and we also want as more as posssible devices to publish and play streams, and we want CDN to support it if we want to scale out our system.

In short, if 10s latency is ok for you, never try to build a 3s latency system. If 3s is ok to you, never build a 100ms one. There is no free thing in this world.

The baseline latency about protocols:

  • HLS, about 5~10s latency, friendly to CDN.
  • HTTP-FLV, about 1~3s latency, only supported by some CDN.
  • WebRTC, about 0.5~1s latency, few of CDN support it.
  • SRT, about 0.3~0.5ms latency, only supported by encoder.

There are some issues about the latency:

  • About players for theses protocol, please read this.
  • How to benchmark the latency, please read this.
  • Use WebRTC to do live streaming, coverting RTMP to WebRTC, please read this.
  • If use FFmpeg, there is a post to reduce the latency.

So it really depends on the use scenario, for example:

  • If your users only use H5, you could use WebRTC or FLV.
  • If your users use OBS to publish stream, you could use SRS to covert RTMP to WebRTC, for viewers to play the stream.
  • If your users are using broadcasting devices, you could use SRT.
users --RTMP/SRT/WebRTC--> SRS --SRT/WebRTC/FLV --> Viewers

If you want more discussion, you could join the community of SRS.

Winlin
  • 1,136
  • 6
  • 25