Enabling Hardware Encoding in Jellyfin with NVIDIA GPU
Created on: 09 May 24 19:23 +0700 by Son Nguyen Hoang in English
Boosting Jellyfin's encoding speed. The results were like a godsend.
Problem
- My Docker Jellyfin running on an i3-9100F CPU is too slow in encoding movies.
- The server has an NVIDIA 1600 GPU, so I must utilize the power of this beast.
This quick journal summarizes the key points and steps to be done to use an NVIDIA GPU on a Dockerized Jellyfin server.
Solution
Install NVIDI Toolkit
- Follow this guide: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
- Update NVIDIA driver and follow the above guide
Modify Jellyfin docker-compose.yml
file
jellyfin:
image: linuxserver/jellyfin:10.8.11
container_name: jellyfin
environment:
- PUID=1000
- PGID=1000
- TZ=UTC
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=compute,utility,video
volumes:
- jellyfin-config:/config
- torrent-downloads:/data
devices:
- /dev/dri:/dev/dri
- /dev/nvidiactl:/dev/nvidiactl
- /dev/nvidia0:/dev/nvidia0
- /dev/nvidia-modeset:/dev/nvidia-modeset
deploy:
resources:
reservations:
devices:
- driver: nvidia
capabilities: [gpu]
ports:
- 2284:8096
- 7359:7359/udp
- 8920:8920
restart: always
networks:
- media-stack-network
- Run command:
ck$ sudo usermod -aG video $USER
- Restart the docker service
- Confirm if GPU had been detected in the docker environment by below command:
$ docker exec -it jellyfin nvidia-smi
Enable Hardware Acceleration in Jellyfin Dashboard
That’s the key ingredient! Enjoy the new performance of Jellyfin