nginx实时流延迟延迟45秒

发布于 2025-01-30 19:31:49 字数 92 浏览 5 评论 0原文

我在Ubuntu Machine的RTMP中设置了NGINX,可以根据网络中有许多文章的摄像头进行HLS流式传输我的网络摄像头,但它具有35-45秒的不可接受的延迟!!!

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!!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半暖夏伤 2025-02-06 19:31:49

HLS通常是关于10s+延迟,如果您想要〜100ms延迟,您必须使用webrtc,但是WebRTC很复杂,不仅涉及良好事物。

通常,我们想要低潜伏期,并且我们也希望更多的可能性设备发布和播放流,并且如果我们想扩展我们的系统,我们希望CDN支持它。

简而言之,如果10S延迟对您来说还可以,请切勿尝试构建3S延迟系统。如果3s对您来说还可以,请切勿建造100ms。这个世界上没有免费的东西。

关于协议的基线延迟:

  • HLS,约5〜10S延迟,对CDN友好。
  • HTTP-FLV,约1〜3s延迟,仅由某些CDN支持。
  • webrtc,约0.5〜1s延迟,很少有CDN支持它。
  • SRT,约0.3〜0.5ms的延迟,仅由编码器支持。

关于延迟存在一些问题:

  • 关于论文协议的玩家,请阅读 this
  • 如何基准等待延迟,请阅读 this
  • 使用WEBRTC进行实时流媒体,覆盖RTMP到WebRTC,请阅读 this
  • 如果使用ffmpeg,则有一个 post 以减少延迟。

因此,这实际上取决于使用方案,例如:

  • 如果您的用户仅使用H5,则可以使用WEBRTC或FLV。
  • 如果您的用户使用obs发布流,则可以使用SRS将RTMP掩盖到WEBRTC,以供观众播放流。
  • 如果您的用户使用广播设备,则可以使用SRT。
users --RTMP/SRT/WebRTC--> SRS --SRT/WebRTC/FLV --> Viewers

如果您想进行更多讨论,则可以加入 srs 的社区。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文