guide(homelab): add Jellyfin GPU hardware acceleration guide
Brain Structural Validation / Validate Markdown Structure & Links (push) Failing after 8s

This commit is contained in:
kiskaadee committed 2026-09-21 19:41:12 -05:00
1 parent dd002e1c80
commit c39b7fc289
2 files changed
+142 -2

No files matched your search

+5 -2
View File
@@ -68,9 +68,11 @@ Implementation roadmaps currently in progress (`status: active`) that are active
- Defense-in-depth security hardening for custom microservice APIs (Learning Hub and Minecraft dashboard) using Authelia ForwardAuth, token validation, and rate limiting. - Defense-in-depth security hardening for custom microservice APIs (Learning Hub and Minecraft dashboard) using Authelia ForwardAuth, token validation, and rate limiting.
4. 🟡 [**Smart Selective Deployment Pipeline for Homelab Core**](plans/appctl/smart-deployment-pipeline.md) `[Active]` 4. 🟡 [**Smart Selective Deployment Pipeline for Homelab Core**](plans/appctl/smart-deployment-pipeline.md) `[Active]`
- Enhancing `appctl` and Gitea Actions with change-aware selective container restarts to prevent unnecessary service interruptions during routine deployments. - Enhancing `appctl` and Gitea Actions with change-aware selective container restarts to prevent unnecessary service interruptions during routine deployments.
5. 🟡 [**GitHub to Gitea Automated Batch Migration Plan**](plans/gitea/github-to-gitea-migration-plan.md) `[Active]` 5. 🟡 [**appctl Engine V2: Architectural Modernization & Type-Safe Refactoring Plan**](plans/appctl/appctl-engine-v2-refactoring.md) `[Active]`
- Modernizing the homelab control utility into a clean, typed Python 3 engine with PyYAML parsing, explicit domain models, and a TDD test suite.
6. 🟡 [**GitHub to Gitea Automated Batch Migration Plan**](plans/gitea/github-to-gitea-migration-plan.md) `[Active]`
- Automated migration tooling using `gh` and `tea` APIs to migrate ~35 repositories from GitHub to self-hosted Gitea with push mirrors for redundancy. - Automated migration tooling using `gh` and `tea` APIs to migrate ~35 repositories from GitHub to self-hosted Gitea with push mirrors for redundancy.
6. 🟡 [**LVM Storage Optimization & Partition Resizing Strategy**](plans/server-24-7/lvm-storage-optimization-and-resizing.md) `[Active]` 7. 🟡 [**LVM Storage Optimization & Partition Resizing Strategy**](plans/server-24-7/lvm-storage-optimization-and-resizing.md) `[Active]`
- Storage space audit, disk cleanup runbooks, and a non-destructive LVM logical volume expansion procedure for the server's root filesystem. - Storage space audit, disk cleanup runbooks, and a non-destructive LVM logical volume expansion procedure for the server's root filesystem.
--- ---
@@ -80,6 +82,7 @@ Implementation roadmaps currently in progress (`status: active`) that are active
Operational runbooks and procedures for daily administration: Operational runbooks and procedures for daily administration:
* [**Onboarding a New Application Stack**](guides/onboarding-a-new-service.md) — Step-by-step procedure for deploying new Docker Compose services in `~/Sites` with `app.yaml` and Traefik routing. * [**Onboarding a New Application Stack**](guides/onboarding-a-new-service.md) — Step-by-step procedure for deploying new Docker Compose services in `~/Sites` with `app.yaml` and Traefik routing.
* [**Jellyfin GPU Hardware Acceleration Guide**](guides/jellyfin-gpu-hardware-acceleration.md) — Configuring `/dev/dri` device passthrough, host group permissions, and GPU telemetry for hardware transcoding.
* [**LLDAP & Authelia SSO Integration Runbook**](guides/lldap-authelia-integration.md) — Dynamic user directory configuration, Authelia LDAP auth, and pre-commit quality gate checks. * [**LLDAP & Authelia SSO Integration Runbook**](guides/lldap-authelia-integration.md) — Dynamic user directory configuration, Authelia LDAP auth, and pre-commit quality gate checks.
* [**Mail Deliverability & Outbound Relay Guide**](guides/mail-deliverability-rdns-relay-guide.md) — Solving residential IP/PTR blocks and Spamhaus PBL using Stalwart and Brevo SMTP relay. * [**Mail Deliverability & Outbound Relay Guide**](guides/mail-deliverability-rdns-relay-guide.md) — Solving residential IP/PTR blocks and Spamhaus PBL using Stalwart and Brevo SMTP relay.
* [**Homepage Dashboard Reintegration into Core**](guides/homepage-core-reintegration.md) — Clean service discovery and configuration of gethomepage in Homelab Core. * [**Homepage Dashboard Reintegration into Core**](guides/homepage-core-reintegration.md) — Clean service discovery and configuration of gethomepage in Homelab Core.
@@ -0,0 +1,137 @@
---
type: guide
project: homelab
tags:
- homelab
- jellyfin
- gpu
- vaapi
- hardware-acceleration
- transcoding
- nixos
- docker
---
# 🎬 Jellyfin GPU Hardware Acceleration (VA-API & QuickSync) Guide
This guide details how to configure, verify, and troubleshoot GPU hardware-accelerated video transcoding for Jellyfin running in Docker on NixOS and Linux hosts.
---
## 1. Overview & Architectural Context
When streaming media to clients that do not natively support a video codec, container, or bitrate, Jellyfin transcodes the stream on the fly. Without hardware acceleration, software transcoding runs on the CPU across all cores, causing high CPU load and potential thermal throttling on compact mini PCs.
GPU hardware acceleration offloads video decoding and encoding to dedicated on-die Application-Specific Integrated Circuits (ASICs) — such as AMD's **Video Core Next (VCN)** or Intel's **QuickSync Video (QSV)**.
### Device Nodes & Permission Architecture
1. **Direct Rendering Infrastructure (`/dev/dri`)**:
- `card0`: DRM master node (modesetting and display output).
- `renderD128`: Unprivileged render node dedicated to offscreen compute, video decoding, and encoding.
2. **Host Group Permissions (`group_add: ["303"]`)**:
- Jellyfin executes as a non-root user (`PUID:PGID = 1000:1000`).
- On NixOS, `/dev/dri/renderD128` is owned by `root:render` with GID `303` (check via `stat -c '%g' /dev/dri/renderD128`).
- Passing `group_add: ["303"]` grants the unprivileged container process read/write access to the GPU render node without requiring `privileged: true`.
---
## 2. Docker Compose Configuration
In the Jellyfin application stack (`~/Sites/homelab-jellyfin/docker-compose.yml`), configure device passthrough and supplementary group membership:
```yaml
services:
jellyfin:
image: jellyfin/jellyfin:latest
container_name: jellyfin
environment:
- PUID=1000
- PGID=1000
- TZ=America/Chicago
devices:
- /dev/dri:/dev/dri
group_add:
- "303" # NixOS host render GID (use `stat -c '%g' /dev/dri/renderD128` on host)
volumes:
- ./config:/config
- ./cache:/cache
- /media:/media:ro
restart: unless-stopped
```
> [!NOTE]
> On non-NixOS hosts (e.g. Debian/Ubuntu), the `render` group is typically GID `107` or `110`. Always verify the host GID before configuring `group_add`.
---
## 3. GPU Hardware Profiles & Codec Capabilities
### AMD Radeon Graphics (e.g. Radeon 780M / Phoenix / RDNA3)
- **Acceleration Framework**: **VA-API (Video Acceleration API)**
- **Render Device**: `/dev/dri/renderD128`
- **Supported Hardware Codecs**:
- **H.264 / AVC**: Decode & Encode
- **HEVC / H.265 (8-bit & 10-bit)**: Decode & Encode
- **VP9**: Decode
- **AV1**: Decode & Encode (RDNA3 / Phoenix)
### Intel Integrated Graphics (e.g. Intel N100 / N150 / Alder Lake-N)
- **Acceleration Framework**: **Intel QuickSync (QSV)** (Recommended) or **VA-API**
- **Render Device**: `/dev/dri/renderD128`
- **Supported Features**:
- Low-Power H.264 / HEVC hardware encoder
- VPP Tone Mapping / OpenCL HDR-to-SDR conversion
- AV1 decode (Alder Lake-N)
---
## 4. Web Interface Configuration (Jellyfin Dashboard)
1. Navigate to **Admin Dashboard** → **Playback** → **Transcoding**.
2. Set **Hardware acceleration**:
- For AMD GPUs: Select **VAAPI**.
- For Intel GPUs: Select **Intel QuickSync (QSV)**.
3. Set **VA-API / QSV Device**: `/dev/dri/renderD128`.
4. Under **Enable hardware decoding for**:
- Check **H.264**
- Check **HEVC (8-bit & 10-bit)**
- Check **VP9**
- Check **AV1** (if supported by hardware)
5. Check **Enable Hardware Encoding**.
6. (Optional) Enable **VPP Tone Mapping** or **Tone Mapping** for HDR conversion.
7. Click **Save** at the bottom of the page.
---
## 5. Verification & Diagnostics
### A. Real-Time Playback Info Overlay
1. Start playing any video in the Jellyfin web or desktop client.
2. Manually force transcoding by selecting a lower quality (e.g., *720p - 4 Mbps*).
3. Click the **Gear icon (Settings)** in the player control bar and select **Playback Info**.
4. Verify that:
- `Play method`: **Transcode**
- `Transcode reason`: *Container bitrate exceeds limit* or *Audio/Video codec not supported*
- `Hardware encoding`: **vaapi** or **qsv**
### B. Transcoding Log Inspection
Inspect the FFmpeg transcode log files generated by the server:
- Open **Admin Dashboard** → **Logs** → select `FFmpeg.Transcode-*.log`.
- Verify the presence of hardware acceleration flags:
```text
-hwaccel vaapi -hwaccel_output_format vaapi
Stream #0:0: Video: h264 (h264_vaapi)
```
- Ensure no fallback errors (`Device creation failed` or `Permission denied`) appear.
### C. Live GPU Telemetry & Monitoring
> [!IMPORTANT]
> **Understanding Telemetry Tools & 0% GPU Misconception**:
> - **Direct Play vs Transcode**: When clients natively support the media format, Jellyfin streams the source file directly (`Play method: Direct Play`). In this mode, GPU load is expected to be **0%**.
> - **3D Engine vs VCN ASIC**: Standard GPU monitoring tools like `radeontop` measure 3D rendering pipeline usage (shaders, rasterizers). Video decode/encode occurs on dedicated **Video Core Next (VCN)** hardware blocks.
To monitor hardware transcoding engines:
- **AMD Radeon**: Run `amdgpu_top` (monitors VCN decode/encode engines) or read `/sys/class/drm/card0/device/gpu_busy_percent`.
- **Intel iGPU**: Run `intel_gpu_top` (from `intel-gpu-tools`) to monitor Video and VideoEnhance engine percentages.