Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #394 from jellyfin/nv-driver
Browse files Browse the repository at this point in the history
Add guidance for AMF and QSV, update NV driver requirements
  • Loading branch information
joshuaboniface authored Sep 15, 2020
2 parents 13f996c + 04fee7e commit ddf0ba4
Showing 1 changed file with 96 additions and 9 deletions.
105 changes: 96 additions & 9 deletions general/administration/hardware-acceleration.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,39 @@ 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.
Expand Down Expand Up @@ -92,7 +105,7 @@ services:
- /dev/vchiq:/dev/vchiq
```
## Debian Docker Nvidia
### Debian Docker Nvidia
In order to achieve hardware acceleration using docker, several steps are required.
Expand All @@ -103,7 +116,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.
Expand Down Expand Up @@ -310,6 +323,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-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. 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
```
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.
Expand Down Expand Up @@ -347,6 +388,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.
Expand Down Expand Up @@ -391,7 +478,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.
Expand Down

0 comments on commit ddf0ba4

Please sign in to comment.