Hardware Utilization

If your hardware is being maxed out then your video may not be processed and delivered fast enough to keep up with the real-time requirements of live video.

Each stream output quality adds significant CPU usage and slows down the overall generation of video segments. It’s generally advised to start with one output, and then add additional, one at a time, to see how it impacts your CPU usage.

If your CPU is being over-utilized, here are some steps you can try taking to resolve this.

  1. You may have too many video outputs defined in your settings. Try limiting yourself to a single output, and go from there.
  2. Change your settings to use less cpu.
  3. Experiment with reducing the bitrate and framerate of your video.
  4. If you’ve gone down to a single output, changed to using less cpu, and experimented with different qualities in your broadcasting software, it’s possible the server you’re running Owncast is just not powerful enough for the task and you might need to try a different environment to run this on.
  5. For your highest quality, match your Owncast server output bitrate exactly to what your broadcasting software is sending to minimize the amount of work your server has to do.
  6. If you find you cannot accomplish encoding of any sort due to your server hardware, you may want to experiment with enabling video passthrough, where your video is not re-encoded. However, this may not be a solution in all environments and there are often side effects. Read more.

In general, the easiest way to save CPU is to decrease the input size, decrease the output size, or both.

Reduce your framerate

The fewer frames of video that needs to be processed result in less hardware resources that will be used to process them. You can reduce both the framerate of what you send to Owncast and the framerate sent out to the viewers.

Drawback: Reducing the framerate may visibly decrease the quality of your stream for some content.

Reduce the amount of hardware (CPU or GPU) allocated in the video settings

Each video output variant has a certain amount of hardware allocated based on the video configuration. Reducing this value can greatly free up the amount of server resources being utilized.

Drawback: The less hardware time you allocate to video encoding the worse quality the output will be. Lower settings are also less efficient when it comes to file size, possibly leading to larger video sizes that your viewers have to download that result in buffering for some.

Reduce the number of stream output variants you offer

Each stream output variant configuration results in more hardware utilization.

Drawback: As a streamer you’ll want to offer as many different stream qualities as you can so people in all locations and network conditions can enjoy your content. Removing stream options may decrease the availability of your stream for some with slower networks, leading to buffering.

Match your highest output quality

One easy optimization for CPU usage is to make sure your inbound video matches your highest output quality.

The highest bitrate, resolution and framerate quality you have configured in Owncast to offer your viewers should match what you’re sending Owncast in your broadcasting software to reduce the amount of extra CPU work it needs to do. Start with your highest quality matching your broadcasting software and then go from there. Lower qualities, of course, should be offered for people with slower network connections or are geographically distant.

Experiment with Passthrough Mode

Note: This is generally not recommended and can often cause playback issues for your viewers.

This is an advanced setting that most people should not use.

Owncast has an optional setting to turn off re-encoding of your inbound stream, potentially saving substantial hardware utilization and supporting a higher quality stream with less resources. However, because your video will not be re-encoded it’s possible that certain video from certain sources may end up not being playable at all. This is the risk of enabling this.

To enable, visit the advanced settings for a specific stream output. You can turn on “Video Passthrough”.

  1. Turn it on if you require it.
  2. Test it.
  3. If your video won’t play, then turn it off.
  4. Only one output should be set as “passthrough”.

Because enabling Passthrough tells Owncast to not encode your video at all, your stream is at the mercy of what your broadcasting software is sending, and that is often not highly compatible with live streaming. For example your live latency may be substantially higher than expected because the stream is not able to be broken up into the specifically sized chunks, as expected. This can also cause issues when switching between different video qualities. For example, switching between a passthrough quality and an properly encoded quality. Worst case your stream may not be playable at all with passthrough enabled.

Drawback: Passthrough bypasses the Owncast video encoding pipeline, leading to video that is not processed for live streaming. This can lead to unexpected results including longer than expected latency, skips or “blips” in video playback. Or worst case, the video is not playable at all. This setting is not encouraged.

If you are running on physical hardware, try hardware acceleration

Note: Most people will not be able to take advantage of this.

If you have access to a physical CPU that supports video encoding, or a GPU with a dedicated encoding chipset you can greatly improve your performance. Read more about what hardware is supported.

Drawback: This will not be available to most people unless you have access to physical hardware that supports accelerated video encoding.

Move to a more powerful server

If you find you’re unable to configure your Owncast instance to support the number of output variants and the framerate and quality you desire you may simply have to move to a server that can handle the load with more CPU resources.

If you’re on a hosted VPS you may be able to change your server with one that has more CPU resources available.

Read more

You can’t be told exactly how much CPU you need, or what server or environment is going to serve you best. But read the Resources and Requirements document to understand more.