减少延迟
概述
您自然希望在直播与观众看到直播之间的延迟尽可能小。 然而,有许多因素会导致像 Owncast 这样的流媒体系统中的延迟。
尝试在管理员中减少您的延迟缓冲区级别。 这将使用户更接近实时,但会给客户端较少可播放的片段,可能会降低对错误的弹性和网络速度问题。 如果您拥有一台能够快速处理视频的机器,您也许可以将延迟降到仅仅数秒,但几乎没有容错空间。
您可以选择希望降低延迟以换取可靠性较低,或选择更可靠的流媒体但增加延迟。
视频直通警告
如果您在视频配置中使用视频直通,这可能会增加您的延迟。 由于您告诉Owncast不对视频进行重新编码,因此无法将视频最佳划分为管理延迟所需的大小块。 如果您确实想优化延迟,则必须关闭直通功能。
缺点
网络请求
降低延迟会导致向您的观众提供更多、更小的视频片段。 这将导致更多的网络请求。 不一定增加更多带宽,但只会有更多请求需要由您的服务器提供。
错误容忍度
由于每个视频片段较小,因此在网络波动或少量网络请求失败的情况下,错误容忍度会导致观众缓冲。 具有更大的延迟时,它使观众能够播放更多排队视频,当网络请求重试或能够恢复时可以播放。
注意事项
如果您处于为对象存储或CDN付费的场景中,并且请求数量会影响您的账单,您可能想考虑降低延迟的权衡,或更改基础设施配置。
Latency buffer levels
The Latency Buffer setting on the admin's Video configuration page selects one of five levels. Each level trades latency for stability by changing how long each video segment is and how many segments the playlist holds for viewers.
| Level | Seconds per segment | Segments in playlist | Approximate latency |
|---|---|---|---|
| 0 (lowest) | 1 | 25 | ~5 seconds |
| 1 | 2 | 15 | ~8-9 seconds |
| 2 (default) | 3 | 10 | ~10 seconds |
| 3 | 4 | 8 | ~15 seconds |
| 4 (highest) | 5 | 5 | ~18 seconds |
Changing the level while you are live does not affect the current stream. The new setting takes effect the next time you begin a stream.
The Minimize latency player setting
This option may not be the best for everyone. People should try it for themselves in the player settings.
Viewers can turn on Minimize latency in the player's settings menu. It slightly speeds up playback to bring the viewer closer to live. It only acts when there is spare bandwidth and enough buffered video, it backs off immediately when playback conditions degrade, and it disables itself for the rest of the session after repeated buffering. Viewers with an unstable connection can leave it off.
Improve this page
See something missing or incorrect? Edit this page and improve the documentation for everyone.
