Hardware Accelerated Encoding & Codecs
Requirements
All four of these things need to be true to support hardware accelerated encoding with Owncast.
- You are not running on a VPS provided to you by a hosting provider, as shared virtual servers do not allow for direct access to hardware.
- You have compatible hardware and have direct access to it.
- You installed and configured any drivers and libraries needed to take advantage of your hardware.
- You have a copy of
ffmpegthat is specifically built to utilize these drivers and libraries. Version 4.1.5 or newer is suggested.
Things to keep in mind
- Most people won't be able to take advantage of this unless you're running your own hardware.
- Just because a specific hardware accelerated codec shows in the Owncast admin does not mean your machine is configured to support it. Owncast builds that list by running
ffmpeg -encodersand keeping the H.264 encoders it knows how to use. An entry appearing means your copy of ffmpeg advertises that encoder, not that the drivers and hardware behind it are proven to work. - Very little of what is required to get your hardware working has anything to do with Owncast. Any questions you have about your particular hardware should be directed to your hardware manufacturer or whoever provides the drivers and libraries to utilize it. There's likely a lot of information already online, so please do your research.
Compatible hardware
Intel Graphics
If you have Intel integrated graphics you may be able to use it using VA-API or Quicksync.
NVIDIA GPUs
NVIDIA GPUs ship with an on-chip hardware encoder unit often referred to as NVENC. Separate from the CUDA cores, NVENC run encoding workloads without slowing the execution of graphics or CUDA workloads running at the same time.
Most modern NVIDIA GPUs ship with NVENC. Check the NVIDIA GPU Support Matrix to confirm your GPU appears in the "encoder" list.
AMD GPUs
VA-API is supported on AMD and ATI GPUs by the libva-mesa-driver.
Compatible codecs/libraries
Intel QuickSync
"Intel Quick Sync Video" is the marketing name for the hardware video decoding and encoding features on Intel processors with integrated graphics. Processors with an Intel iGPU can be used to do hardware video encoding as long as you have libva installed and the processors iGPU supports the video codec and resolution you want to use.
Follow the instructions on Intel's site on how to get QuickSync setup on Linux.
Links:
VA-API
VA-API (video acceleration API) is a layer to support hardware accelerated encoding on linux. You need the libva library installed for it to work. VA-API is not compatible with ARM chipsets.
ffmpeg 5 and newer are supported with VA-API.
Links:
NVIDIA Encoder (nvenc)
Follow the instructions on the NVIDIA ffmpeg transcoding guide to install all the required drivers and libraries. This requires installing a driver from the NVIDIA website, Downloading and install the CUDA toolkit, downloading nv-codec-headers, and building ffmpeg. Scroll to the section entitled Hardware accelerated transcoding with FFmpeg at the NVIDIA transcoding guide for more information.
You may be able to find a pre-built version of ffmpeg that has nvenc support, however that's outside the scope of this document. You still need NVIDIA drivers regardless.
Links:
- Tal.org instructions on building ffmpeg with nvenc
- Shell script that claims to automate the process on Ubuntu
OpenMAX (omx)
OpenMAX (h264_omx) is a hardware encoding interface most commonly used on older Raspberry Pi boards. It shows in the admin as "OpenMax (omx) for Raspberry Pi". Your copy of ffmpeg must be built with OpenMAX support, which many distribution builds no longer include.
Apple VideoToolbox
VideoToolbox (h264_videotoolbox) is Apple's hardware video encoding framework. If you run Owncast on macOS, ffmpeg builds from Homebrew and most other sources include it, and it uses the media engine built into Apple hardware.
ffmpeg
Once your system is configured to use the correct drivers and libraries required you'll need to make sure your copy of ffmpeg supports it.
Owncast suggests ffmpeg version 4.1.5 or newer. This is a suggestion, not a hard requirement. Owncast does not refuse to run with an older version, but you may experience issues with video.
$ ffmpeg -version
ffmpeg version 6.1.1 Copyright (c) 2000-2024 the FFmpeg developers
Verify the encoder you expect to use is enabled in your version of ffmpeg. This mirrors what Owncast itself does to populate the codec dropdown in the admin.
$ ffmpeg -hide_banner -encoders | grep 264
V....D libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec: h264)
V....D h264_v4l2m2m V4L2 mem2mem H.264 encoder wrapper (codec: h264)
V....D h264_vaapi H.264/AVC (VAAPI) (codec: h264)
If the encoder you hope to use is not in this list then you may need to build your own copy of ffmpeg that supports it.
Improve this page
See something missing or incorrect? Edit this page and improve the documentation for everyone.
