Reducing Latency
Overview
It is natural for you to want to have as little latency as possible between when you stream and when your viewers see the stream. However, there are a number of factors that contribute to latency in a streaming system like Owncast.
Try decreasing your latency buffer level in the admin. This will keep the user closer to live, but give the client less playable segments to work with, possibly reducing the resiliency for errors and network speed issues. If you have a machine that is able to process video quickly you may be able to get down to only a handful of seconds of latency, but with little room for error.
It's up to you to decide you want lower delays over less reliability or a more reliable stream with additional delay.
Warning for Video Passthrough
If you are using Video Passthrough in your video configuration it will likely increase your latency. Because you're telling Owncast not to re-encode your video it can't optimally segment your video into the sized chunks required to manage your latency. If you really want to optimize latency then you should absolutely turn off Passthrough.
Drawbacks
Network requests
Lower latency results in more, smaller, video segments to be served to your viewers. This results in more web requests. Not necessarily more bandwidth used, but simply more requests needing to be served by your server.
Error tolerance
Because each segment of video is smaller, the error tolerance when it comes to network blips, or the rare network requests failing will result in the viewer buffering. With larger latency, it gives the viewer more playable video queued up to play while the network request is retried or is able to recover.
Considerations
If you're in a scenario where you're paying for object storage or a CDN where the number of requests impact your bill, you may want to consider the tradeoffs of lower latency or change your infrastructure configuration.
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.
Related Documents
- Content Delivery Networks (CDNs)A CDN can help improve the network performance of your Owncast instance by caching and distributing content from servers located closer to users.
- Video quality and performanceHow broadcasting software, video settings, object storage, latency, and metrics combine to shape your stream.
