Skip to content
Johith Iype
Go back

Configure Jellyfin Media Server for Hardware Accelerated Transcoding

This is a quick post on how to configure your existing Jellyfin instance for hardware acceleration, assuming you have a setup similar or close to below:

Hardware accelerated transcoding takes the burden away from your client’s CPU by off loading video transcoding tasks to your server’s GPU.

You can however bypass this behavior by forcing Direct Play on some client media player. Some clients may choose to make the switch on their own depending on their capabilities (like Chrome’s HTML Player).

Additionally, hardware acceleration also enables Tone Mapping which is an entire domain of it self. I didn’t play around with this because I don’t have any media that need it so far …

Choosing the GPU

RAM Requirements

Jellyfin recommends at least 8GB of ram. You may run out of memory if your server is trying to transcode a huge 4K file and when this happens you may see an Out of Memory error on your host resulting from a memory usage spike.

In some instances it may even bring down your host. To prevent this I’d recommend setting a memory limit of 8GB for your Jellyfin container (assuming you have already supplied more RAM for the host).

deploy:
      resources:
        limits:
          memory: 8G

Passthrough GPU to VM host

Add a new PCI Device hardware resource to your Linux host VM, select the GPU from the list. Reboot host.

pcie-passthrough

Then verify if the host can see the GPU:

lspci -nn | grep -Ei "3d|display|vga"

Check if the host is exposing the GPU. We’ll need this for Jellyfin later:

ls /dev/dri/dev/render128

Configure Container

  1. Get render group ID from Linux host

    This is a user group that gives access to GPU rendering capabilities without requiring root privileges.

    getent group render

  2. Config container to use your render group to access host GPU

    group_add:
    	- '992' # replace with the ID shown in your host 
  3. Tap into the GPU device node exposed by the host

    devices:
    	- /dev/dri/renderD128:/dev/dri/renderD128
  4. Note the video codecs supported by your hardware

    docker exec -it jellyfin /usr/lib/jellyfin-ffmpeg/vainfo

  5. Enable Intel QSV under Jellyfin dashboard settings and remove the codecs not listed above.

  6. Check if OpenCL is loaded and running for tone mapping abilities

    docker exec -it jellyfin /usr/lib/jellyfin-ffmpeg/ffmpeg -v verbose -init_hw_device vaapi=va -init_hw_device opencl@va

Configure Jellyfin Dashboard Setting

  1. Enable Hardware Acceleration

    Under Dashboard > Playback > Transcoding > Hardware Acceleration > Intel Quicksync (QSV)

  2. Disable video codecs not listed in Step 4 of above section

    Some video codecs may not be supported by your processor generation, in this case you can try to convert the video file to the supported version.

  3. Set the Transcode Path to /cache/transcodes for transcode cache files.

    Make sure if you’re using volume mount, that you have at least 2GB of free space at all times.

Verify transcoding

Play a large 4K content from Jellyfin on a browser. On the bottom right of the player, choose Playback Info under the Gear icon.

If it says Transcoding under Play method, sweet …it’s working.

jellyfin-sats

You can also view some cool stats using package  intel-gpu-tools installed on your host. Play something on Jellyfin client and run command intel_gpu_top

jellyfin-sats

Tips


Share this post:

Previous Post
How to Update Windows Secure Boot Certificates
Next Post
Inject Secrets in Ansible Playbook Using Bitwarden Secrets Manager