From fad71af4ad21a0d9af28b992fe5085546f524745 Mon Sep 17 00:00:00 2001 From: Nyanmisaka Date: Fri, 31 Jul 2020 15:42:39 +0800 Subject: [PATCH 1/4] update nvidia driver version requirements --- .../administration/hardware-acceleration.md | 107 ++++++++++++++++-- 1 file changed, 98 insertions(+), 9 deletions(-) diff --git a/general/administration/hardware-acceleration.md b/general/administration/hardware-acceleration.md index ce68884d7..c89113074 100644 --- a/general/administration/hardware-acceleration.md +++ b/general/administration/hardware-acceleration.md @@ -11,26 +11,41 @@ Jellyfin supports [hardware acceleration](https://trac.ffmpeg.org/wiki/HWAccelIn OS | Recommended HW Acceleration ------- | ------------- -Linux | QSV, NVENC, VAAPI +Linux | QSV, NVENC, AMF, VAAPI Windows | QSV, NVENC, AMF -MacOS | None (VideoToolbox Coming Soon) +MacOS | VideoToolbox Android | MediaCodec, OMX RPi | OMX [Graphics Cards comparison using HWA](https://www.elpamsoft.com/?p=Plex-Hardware-Transcoding) -[NVIDIA using ffmpeg official list](https://developer.nvidia.com/ffmpeg). Not every card has been tested. These [drivers](https://github.com/keylase/nvidia-patch) are recommended for Linux and Windows. Here is the official list of [NVIDIA Graphics Cards](https://developer.nvidia.com/video-encode-decode-gpu-support-matrix) for supported codecs. Example of Ubuntu working with [NVENC](https://www.reddit.com/r/jellyfin/comments/amuyba/nvenc_nvdec_working_in_jellyfin_on_ubuntu_server/). H264 10-bit is [not supported](https://devtalk.nvidia.com/default/topic/1039388/video-codec-and-optical-flow-sdk/is-there-nvidia-encoder-decoder-which-supports-hdr-10-bpp-for-avc-h-264-/) by NVIDIA acceleration. +### NVIDIA NVENC -List of supported codecs for [VAAPI](https://wiki.archlinux.org/index.php/Hardware_video_acceleration#Comparison_tables). +[NVIDIA using ffmpeg official list](https://developer.nvidia.com/ffmpeg). Not every card has been tested. These [drivers](https://github.com/keylase/nvidia-patch) are recommended for Linux and Windows. Here is the official list of [NVIDIA Graphics Cards](https://developer.nvidia.com/video-encode-decode-gpu-support-matrix) for supported codecs. Example of Ubuntu working with [NVENC](https://www.reddit.com/r/jellyfin/comments/amuyba/nvenc_nvdec_working_in_jellyfin_on_ubuntu_server/). H264 10-bit is [not supported](https://devtalk.nvidia.com/default/topic/1039388/video-codec-and-optical-flow-sdk/is-there-nvidia-encoder-decoder-which-supports-hdr-10-bpp-for-avc-h-264-/) by NVIDIA acceleration. **The minimum required driver version is: Linux: 418.30, Windows: 450.51.** -AMF Linux Support still [not official](https://github.com/GPUOpen-LibrariesAndSDKs/AMF/issues/4) and AMD GFX Cards are required to use VAAPI on Linux. +### VAAPI -Zen is CPU only. No hardware acceleration for any form of video decoding/encoding. You will need an APU or dGPU for hardware acceleration. +List of supported codecs for [VAAPI](https://wiki.archlinux.org/index.php/Hardware_video_acceleration#Comparison_tables). Both Intel iGPU and AMD GPU can use VAAPI. +> [!NOTE] +> AMD GPU requires open source driver Mesa 20.1 or higher to support hardware decoding HEVC. + +### AMD AMF + +AMF is now available on Windows and Linux, but since AMD has not implemented the HW decoder and scaler in ffmpeg, the decoding speed may not be as expected. The closed source driver`amdgpu-pro` is required when using AMF on Linux. +> [!NOTE] +> +> Zen is CPU only. No hardware acceleration for any form of video decoding/encoding. You will need an APU or dGPU for hardware acceleration. + +### Intel QuickSync Intel QSV Benchmarks on [Linux](https://www.intel.com/content/www/us/en/cloud-computing/cloud-computing-quicksync-video-ffmpeg-white-paper.html). On Windows, you can use the DXVA2/D3D11VA libraries for decoding and the libmfx library for encoding. +> [!NOTE] +> +> To use QSV on Windows, please do not install Jellyfin as a system service. + Issues: [FFmpeg Windows version with QSV hwaccel fails over TERMINAL](https://trac.ffmpeg.org/ticket/7511) and [Intel QSV: "Failed to create Direct3D device" on Core i7-7700K (Skylake) on Windows 10](https://trac.ffmpeg.org/ticket/6827) CentOS may require [additional drivers](https://www.getpagespeed.com/server-setup/how-to-enable-intel-hardware-acceleration-for-video-playback-in-rhel-centos-8) for QSV. @@ -92,7 +107,7 @@ services: - /dev/vchiq:/dev/vchiq ``` -## Debian Docker Nvidia +### Debian Docker Nvidia In order to achieve hardware acceleration using docker, several steps are required. @@ -103,7 +118,7 @@ Prerequisites: - GNU/Linux x86_64 with kernel version > 3.10 - Docker >= 1.12 - NVIDIA GPU with Architecture > Fermi (2.1) -- NVIDIA drivers ~= 361.93 (untested on older versions) +- NVIDIA drivers >= 418.30 Confirm that your GPU shows up with this command. @@ -310,6 +325,34 @@ To check information about VAAPI on your system install and run `vainfo` from th 4. Watch a movie, and verify that transcoding is occurring by watching the `ffmpeg-transcode-*.txt` logs under `/var/log/jellyfin` and using `radeontop` or similar tools. + + +### Configuring Intel QuickSync(QSV) on Debian/Ubuntu + +1. QSV is based on VAAPI device on Linux, so please confirm whether you have completed the VAAPI configuration first. + +2. Make sure that `jellyfin-ffmpeg 4.3.1-1` or higher is installed. + +3. Install the non-free iHD driver. +```bash +$ sudo apt update +$ sudo apt install vainfo intel-media-va-driver intel-media-va-driver-non-free -y +``` +> [!NOTE] +> intel-media-va-driver-non-free is avaliable from apt since Debian buster and Ubuntu 19.04. Otherwise you have to build from source. + +4. Verify iHD driver using `vainfo`. You will find `iHD` from the result if it goes well. +```bash +$ vainfo | grep iHD +``` + +5. Fallback to i965 driver. +```bash +$ sudo apt remove intel-media-va-driver intel-media-va-driver-non-free -y +``` + +6. QSV in docker. Due to incompatible licenses, we will not integrate non-free drivers in the docker image. You need to perform the above operations manually in docker and add `--privileged` to the docker configuration. + ### LXC or LXD Container This has been tested with LXC 3.0 and may or may not work with older versions. @@ -347,6 +390,52 @@ Useful Resources: - [LXD Documentation - GPU instance configuration](https://github.com/lxc/lxd/blob/master/doc/instances.md#type-gpu) - [NVidia CUDA inside a LXD container](https://stgraber.org/2017/03/21/cuda-in-lxd/) +### Configuring AMD AMF encoding on Ubuntu 18.04 or 20.04 LTS + +1. Install `amdgpu-pro` closed source graphics driver by following the [installation instructions](https://amdgpu-install.readthedocs.io/en/latest/). + +2. Then install `amf-amdgpu-pro`: + +```bash +$ sudo apt install amf-amdgpu-pro +``` + +3. Make sure your `jellyfin-ffmpeg` or `ffmpeg` contains `h264_amf` encoder: + +```bash +$ cd /usr/lib/jellyfin-ffmpeg/ +$ ./ffmpeg -encoders | grep h264_amf +V..... h264_amf AMD AMF H.264 Encoder (codec h264) +``` + +> [!NOTE] +> If not contain, update your `jellyfin-ffmpeg` to the latest version and try again. +For compiling ffmpeg with AMF library, refer to [this page](https://www.ffmpeg.org/general.html#AMD-AMF_002fVCE). + +4. Choose AMD AMF video acceleration in Jellyfin and check the `Enable hardware encoding` option. + +5. Watch a movie, then verify that `h264_amf` encoder is working by watching the `ffmpeg-transcode-*.txt` transcoding logs under `/var/log/jellyfin` and using `radeontop` or similar tools. + + +### Configuring AMD AMF encoding on Arch Linux + +AMD does not provide official `amdgpu-pro` driver support for Arch Linux, but fortunately, a third-party packaged `amdgpu-pro-installer` is provided in the archlinux user repository. + +1. Clone [this repository](https://aur.archlinux.org/pkgbase/amdgpu-pro-installer/) using `git`: + +```bash +$ git clone https://aur.archlinux.org/amdgpu-pro-installer.git +``` + +2. Enter that folder and make the installation package and install it: + +```bash +$ cd amdgpu-pro-installer +$ makepkg -si +``` + +3. Go to step 3 of **on Ubuntu 18.04 or 20.04 LTS** above. + ### Raspberry Pi 3 and 4 1. Add the Jellyfin service user to the video group to allow Jellyfin's FFMpeg process access to the encoder, and restart Jellyfin. @@ -391,7 +480,7 @@ Useful Resources: > [!NOTE] > For RPi3 in testing, transcoding was not working fast enough to run in real time because the video was being resized. -### Verifying Transcodes +## Verifying Transcodes To verify that you are using the proper libraries, run this command against your transcoding log. This can be found at Admin Dashboard > Logs, and /var/log/jellyfin if instead via the repository. From cdad46b604a61804353ae31fb8ec0badfdc99ed2 Mon Sep 17 00:00:00 2001 From: Nyanmisaka Date: Fri, 31 Jul 2020 15:56:31 +0800 Subject: [PATCH 2/4] minor changes --- general/administration/hardware-acceleration.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/general/administration/hardware-acceleration.md b/general/administration/hardware-acceleration.md index c89113074..aabe00177 100644 --- a/general/administration/hardware-acceleration.md +++ b/general/administration/hardware-acceleration.md @@ -33,7 +33,6 @@ List of supported codecs for [VAAPI](https://wiki.archlinux.org/index.php/Hardwa AMF is now available on Windows and Linux, but since AMD has not implemented the HW decoder and scaler in ffmpeg, the decoding speed may not be as expected. The closed source driver`amdgpu-pro` is required when using AMF on Linux. > [!NOTE] -> > Zen is CPU only. No hardware acceleration for any form of video decoding/encoding. You will need an APU or dGPU for hardware acceleration. ### Intel QuickSync @@ -43,7 +42,6 @@ Intel QSV Benchmarks on [Linux](https://www.intel.com/content/www/us/en/cloud-co On Windows, you can use the DXVA2/D3D11VA libraries for decoding and the libmfx library for encoding. > [!NOTE] -> > To use QSV on Windows, please do not install Jellyfin as a system service. Issues: [FFmpeg Windows version with QSV hwaccel fails over TERMINAL](https://trac.ffmpeg.org/ticket/7511) and [Intel QSV: "Failed to create Direct3D device" on Core i7-7700K (Skylake) on Windows 10](https://trac.ffmpeg.org/ticket/6827) From 08c1224b70e167c5cd4f2f98ca5c0aa443205b2a Mon Sep 17 00:00:00 2001 From: Nyanmisaka Date: Fri, 31 Jul 2020 16:32:24 +0800 Subject: [PATCH 3/4] update as per suggestions --- general/administration/hardware-acceleration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/general/administration/hardware-acceleration.md b/general/administration/hardware-acceleration.md index aabe00177..334970b84 100644 --- a/general/administration/hardware-acceleration.md +++ b/general/administration/hardware-acceleration.md @@ -31,7 +31,7 @@ List of supported codecs for [VAAPI](https://wiki.archlinux.org/index.php/Hardwa ### AMD AMF -AMF is now available on Windows and Linux, but since AMD has not implemented the HW decoder and scaler in ffmpeg, the decoding speed may not be as expected. The closed source driver`amdgpu-pro` is required when using AMF on Linux. +AMF is now available on Windows and Linux, but since AMD has not implemented the HW decoder and scaler in ffmpeg, the decoding speed may not be as expected. The closed source driver `amdgpu-pro` is required when using AMF on Linux. > [!NOTE] > Zen is CPU only. No hardware acceleration for any form of video decoding/encoding. You will need an APU or dGPU for hardware acceleration. @@ -334,7 +334,7 @@ To check information about VAAPI on your system install and run `vainfo` from th 3. Install the non-free iHD driver. ```bash $ sudo apt update -$ sudo apt install vainfo intel-media-va-driver intel-media-va-driver-non-free -y +$ sudo apt install vainfo intel-media-va-driver-non-free -y ``` > [!NOTE] > intel-media-va-driver-non-free is avaliable from apt since Debian buster and Ubuntu 19.04. Otherwise you have to build from source. From 04fee7e01770cc4a6bcb59e8b14462910b3357b1 Mon Sep 17 00:00:00 2001 From: Nyanmisaka Date: Tue, 25 Aug 2020 19:57:18 +0800 Subject: [PATCH 4/4] update i965 fallback guidance --- general/administration/hardware-acceleration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/general/administration/hardware-acceleration.md b/general/administration/hardware-acceleration.md index 334970b84..6105dcd32 100644 --- a/general/administration/hardware-acceleration.md +++ b/general/administration/hardware-acceleration.md @@ -344,7 +344,7 @@ $ sudo apt install vainfo intel-media-va-driver-non-free -y $ vainfo | grep iHD ``` -5. Fallback to i965 driver. +5. If you want to uninstall iHD driver and fallback to i965 driver. ```bash $ sudo apt remove intel-media-va-driver intel-media-va-driver-non-free -y ```