OvenMediaEngine supports GPU-based hardware decoding and encoding. Currently supported GPU acceleration devices are Intel's QuickSync and NVIDIA. This article explains how to install the drivers for OvenMediaEngine and set up the configuration to use your GPU.
1. Install Drivers
1. Install NVIDIA GPU Driver
If you are using an NVIDIA graphics card, please refer to the following guide to install the driver. The OS that supports installation with the provided script are CentOS 7/8 and Ubuntu 18/20 versions. If you want to install the driver in another OS, please refer to the manual installation guide document.
CentOS environment requires the process of uninstalling the nouveau driver. After uninstalling the driver, the first reboot is required, and a new NVIDIA driver must be installed and rebooted. Therefore, two install scripts must be executed.
If you have finished installing the driver to use the GPU, you need to reinstall the open source library using Prerequisites.sh . The purpose is to allow external libraries to use the installed graphics driver.
Please refer to the NVIDIA Driver installation guide written previously.
2. Install NVIDIA Container Toolkit
To use GPU acceleration in Docker, you need to install NVIDIA drivers on your host OS and install the NVIDIA Container Toolkit. This toolkit includes container runtime libraries and utilities for using NVIDIA GPUs in Docker containers.
If you are using an Intel CPU that supports QuickSync, please refer to the following guide to install the driver. The OSes that support installation using the provided scripts are CentOS 7/8 and Ubuntu 18/20 versions. If you want to install the driver on a different OS, please refer to the Manual Installation Guide document.
When the Intel QuickSync driver installation is complete, the OS must be rebooted for normal operation.
After the driver installation is complete, check whether the driver operates normally with the Matrix Monitor program.
# Use the samples provided in the Intel Media SDK# Check the list of codecs supported by iGPU/MediaSDK-intel-mediasdk-21.1.2/build/__bin/release/simple_7_codec
2. Prerequisites
If you have finished installing the driver to use the GPU, you need to reinstall the open source library using Prerequisites.sh . The purpose is to allow external libraries to use the installed graphics driver.
Please refer to the Netint documentation to install XCODER.
How to check driver installation
After the driver installation is complete, check if the libxcoder exist: the CLI must return something like libxcoder_logan.so (libc6,x86-64) => /usr/local/lib/libxcoder_logan.so
ldconfig-p|greplibxcoder_logan.so
2. Prerequisites
If you have finished installing the driver to use the VPU, you need to reinstall the open source library using Prerequisites.sh . The purpose is to allow external libraries to use the installed graphics driver. You also have to unzip the ffmpeg patch provide by netint in a specfic path
you must include the --gpus all option when running Docker
docker run -d ... --gpus all airensoft/ovenmediaengine:dev
3. Configuration
To use hardware acceleration, set the HardwareAcceleration option to true under OutputProfiles. If this option is enabled, a hardware codec is automatically used when creating a stream, and if it is unavailable due to insufficient hardware resources, it is replaced with a software codec.
<OutputProfiles>
<HWAccels>
<!--
Setting for Hardware Modules.
- nv : Nvidia Video Codec SDK
- xma :Xilinx Media Accelerator
- qsv :Intel Quick Sync Video
- nilogan: Netint VPU
You can use multiple modules by separating them with commas.
For example, if you want to use xma and nv, you can set it as follows.
<Modules>[ModuleName]:[DeviceId],[ModuleName]:[DeviceId],...</Modules>
<Modules>xma:0,nv:0</Modules>
-->
<Decoder>
<Enable>true</Enable>
<Modules>nv</Modules>
</Decoder>
<Encoder>
<Enable>true</Enable>
<Modules>nv</Modules>
</Encoder>
</HWAccels>
<OutputProfile>
...
</OutputProfile>
</OutputProfiles>
The codecs available using hardware accelerators in OvenMediaEngine are as shown in the table below. Different GPUs support different codecs. If the hardware codec is not available, you should check if your GPU device supports the codec.