Jellyfin: Difference between revisions
|  Clarify the driver selection code block |  Add a section on setting up Jellyfin with VAAPI in a NixOS container | ||
| Line 197: | Line 197: | ||
| Related: [[Accelerated Video Playback]] and [[Intel Graphics]] | Related: [[Accelerated Video Playback]] and [[Intel Graphics]] | ||
| ==== VAAPI with Jellyfin in a NixOS Container ==== | |||
| Containers don't inherit graphic drivers from their root system, so if you run Jellyfin in a NixOS container, you have to copy the <code>hardware.graphics</code> block from the main configuration into your container's configuration. | |||
| You have to passthrough the graphics card device as well - usually it's located under <code>/dev/dri/card0</code> and/or <code>/dev/dri/renderD128</code>: | |||
| <syntaxHighlight lang="nix"> | |||
| { | |||
|   allowedDevices = [ | |||
|     { | |||
|       node = "/dev/dri/card0"; | |||
|       modifier = "rw"; | |||
|     } | |||
|     { | |||
|       node = "/dev/dri/renderD128"; | |||
|       modifier = "rw"; | |||
|     } | |||
|   ]; | |||
|   bindMounts = { | |||
|     "/dev/dri/card0" = { | |||
|       hostPath = "/dev/dri/card0"; | |||
|       isReadOnly = false; | |||
|     }; | |||
|     "/dev/dri/renderD128" = { | |||
|       hostPath = "/dev/dri/renderD128"; | |||
|       isReadOnly = false; | |||
|     }; | |||
|   }; | |||
|   config = | |||
|   # ... your container's configuration, including the hardware.graphics part! | |||
| } | |||
| </syntaxHighlight> | |||
| You can check if you got the configuration correct by adding <code>libva-utils</code> to the container's <code>environment.systemPackages</code>, logging into the container (<code>machinectl shell container-name</code>), and running <code>vainfo</code> - if you got everything right, you should see something akin to: | |||
| <syntaxHighlight> | |||
| Trying display: drm                                                                                                                                                                                | |||
| libva info: VA-API version 1.22.0                                                                                                                                                                  | |||
| libva info: Trying to open /run/opengl-driver/lib/dri/iHD_drv_video.so                                                                                                                             | |||
| libva info: Found init function __vaDriverInit_1_22                                                                                                                                                | |||
| libva info: va_openDriver() returns 0                                                                                                                                                              | |||
| vainfo: VA-API version: 1.22 (libva 2.22.0)                                                                                                                                                        | |||
| vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 25.2.6 ()                                                                                                                     | |||
| vainfo: Supported profile and entrypoints                                                                                                                                                          | |||
|       VAProfileNone                   : VAEntrypointVideoProc                                                                                                                                      | |||
|       VAProfileNone                   : VAEntrypointStats        | |||
|       /* and many more, the list depends on your specific hardware */                                                                                                                                   | |||
| </syntaxHighlight> | |||
| With that, ffmpeg (and thus Jellyfin) should be able to use hardware transcoding. | |||
| [[Category:Server]] | [[Category:Server]] | ||
| [[Category:Applications]] | [[Category:Applications]] | ||
| [[Category:Web Applications]] | [[Category:Web Applications]] | ||