UP  |  HOME

Jellyfin

Table of Contents

I run jellyfin as a docker container. There are some special considerations to enable hardware acceleration.

A docker-compose setup

Grab the image

sudo docker pull jellyfin/jellyfin

Create some volumes for config and cache

These are handy so you can easily rebuild the container without losing your library data or configuration.

sudo docker volume create jellyfin-config
sudo docker volume create jellyfin-cache

Write a docker compose file

Listing 1: docker-jellyfin.yml
version: '3.3'
volumes:
  jellyfin-config: 
    driver: local
    name: jellyfin-config
  jellyfin-cache:
    driver: local
    name: jellyfin-cache
services:
  jellyfin:
    container_name: jellyfin
    image: jellyfin/jellyfin
    network_mode: host
    restart: unless-stopped
    environment:
      - JELLYFIN_PublishedServerUrl=http://hostname.domain
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - 'jellyfin-config:/config'
      - 'jellyfin-cache:/cache'
      - type: bind
        source: /path/to/video_content
        target: /media
        read_only: true
    devices:
      - '/dev/dri/renderD128:/dev/dri/renderD128'
      - '/dev/dri/card0:/dev/dri/card0'

Create the container and start it in the background

sudo docker-compose -f docker-jellyfin.yml up -d

This should get jellyfin running on the host port 8096. You can browse to it and do initial config.

Enabling hardware acceleration

Host OS

To reduce power and enable variable bitrate encoding we need to enable huc​/guc firmware loading. Be sure firmware-misc-nonfree is installed, then add some i915 module options as below. It is described at Intel VAAPI Media Driver. (requires reboot to take effect)

Listing 2: /etc/modprobe.d/i915.conf
options i915 enable_guc=2

Jellyfin

I'm on Intel Core i5-6200u with 9th gen GPU. Based on output of vainfo I could enable hardware decoding for:

  • H264
  • HEVC
  • MPEG2
  • VP8

As well since I took the previous step to load firmware I can enable hardware encoding, and the two low-power encoders (H.264, HEVC).

Finally I checked "Allow encoding in HEVC format".

Verify GPU transcoding is working by switching a stream to some other resolution/bitrate, and run the intel_gpu_top utility.