跳至主要内容

硬件加速编码与编解码器

要求

这四个条件都必须满足才能支持与 Owncast 的硬件加速编码。

  1. 没有在托管提供商提供的 VPS 上运行,因为共享虚拟服务器不允许直接访问硬件。
  2. 您拥有兼容的硬件并可以直接访问它。
  3. 您已安装并配置了任何所需的驱动程序和库,以利用您的硬件。
  4. You have a copy of ffmpeg that is specifically built to utilize these drivers and libraries. Version 4.1.5 or newer is suggested.

需要记住的事项

  1. 大多数人无法利用这个,除非您在自己的硬件上运行。
  2. 仅仅因为特定的硬件加速编解码器出现在 Owncast 管理界面中,并不意味着您的设备已配置为支持它。 Owncast builds that list by running ffmpeg -encoders and 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.
  3. 获取您的硬件正常工作的要求与 Owncast 的关系不大。 您对特定硬件的任何问题都应直接咨询硬件制造商或提供驱动程序和库的人。 网上可能已经有很多信息,请做好您的研究。

兼容的硬件

英特尔图形

如果您拥有英特尔集成显卡,您可能可以通过 VA-APIQuicksync 来使用它。

NVIDIA GPU

NVIDIA GPU 配备了一个通常称为 NVENC 的片上硬件编码器单元。 与 CUDA 核心分开,NVENC 在不减慢同时运行的图形或 CUDA 工作负载的情况下进行编码工作负载。

大多数现代 NVIDIA GPU 配备了 NVENC。 请检查 NVIDIA GPU 支持矩阵 以确认您的 GPU 在 "编码器" 列表中。

AMD GPU

VA-API 通过 libva-mesa-driver 在 AMD 和 ATI GPU 上得到支持。

兼容的编解码器/库

英特尔 QuickSync

"Intel Quick Sync Video" 是带有集成显卡的英特尔处理器上硬件视频解码和编码功能的营销名称。 带有英特尔 iGPU 的处理器可以用于硬件视频编码,只要您安装了 libva,并且处理器的 iGPU 支持您想要使用的视频编解码器和分辨率。

请按照英特尔网站上的说明,在Linux上设置 QuickSync

链接:

VA-API

VA-API(视频加速 API)是支持 Linux 上硬件加速编码的一层。 您需要安装 libva 库才能使其工作。 VA-API 与 ARM 芯片组不兼容。

ffmpeg 5 及更新版本与 VA-API 兼容。

链接:

NVIDIA 编码器(nvenc)

请按照NVIDIA ffmpeg 转码指南上的说明安装所需的所有驱动程序和库。 这需要从 NVIDIA 网站 安装一个驱动程序,下载并安装 CUDA 工具包下载 nv-codec-headers 并构建 ffmpeg。 滚动到 NVIDIA 转码指南 中名为 硬件加速转码与 FFmpeg 的部分以获取更多信息。

您可能能找到一个具有 nvenc 支持的预构建版本的 ffmpeg,然而这超出了本文的范围。 无论如何,您仍然需要 NVIDIA 驱动程序。

链接:

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

一旦您的系统配置为使用所需的正确驱动程序和库,您需要确保您的 ffmpeg 副本支持它。

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.

Contributors to this documentation
Gabe KangasGabe Kangas
B
Bye
T
TheInvincible