Jellyfin Docker Container on intel GPU - openCL devices not found

Hi everyone,

I’m having a very strange issue with nixos that I can’t seem to generate on another linux OS such as ubuntu or arch.

I have an intel N100 pc with a alder lake GPU with quicksync. I run jellyfin in a docker container on nixos. When I enable OpenCL tone mapping in the docker container, none of my media can play. I see in the jellyfin logs that it doesn’t seem to find an OpenCL device:

root@jelly:/# /usr/lib/jellyfin-ffmpeg/ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device opencl@va
ffmpeg version 5.1.4-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-libs=-lfftw3f --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libsvtav1 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-opencl --enable-vaapi --enable-amf --enable-libmfx --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[AVHWDeviceContext @ 0x564f45c27cc0] libva: VA-API version 1.20.0
[AVHWDeviceContext @ 0x564f45c27cc0] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x564f45c27cc0] libva: Found init function __vaDriverInit_1_20
[AVHWDeviceContext @ 0x564f45c27cc0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x564f45c27cc0] Initialised VAAPI connection: version 1.20
[AVHWDeviceContext @ 0x564f45c27cc0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.4.0 (05e4d0d).
[AVHWDeviceContext @ 0x564f45c27cc0] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x564f45c57940] Failed to get number of OpenCL platforms: -1001.
Device creation failed: -19.
Failed to set value 'opencl@va' for option 'init_hw_device': No such device
Error parsing global options: No such device

Nixos config. I’ve tried both with only adding in the onevpl-intel-gpu package, not adding that in, adding that in and removing intel-media-driver package, all same issues.

  hardware.opengl = {
    enable = true;
    extraPackages = with pkgs; [
      intel-media-driver
      intel-compute-runtime
      vaapiVdpau
      libvdpau-va-gl
      vaapiIntel
      intel-ocl
      # Intel Video Processing Library (VPL) API runtime implementation
      # replace with`onevpl-intel-gpu` after https://github.com/NixOS/nixpkgs/pull/264621
      (pkgs.callPackage ./onevpl-intel-gpu.nix { })
    ];
  };

Docker compose, i pass the intel gpu through by passing through /dev/dri. This docker compose has been used on a ubuntu server system as well for months with no issues.

  jellyfin:
    container_name: jellyfin
    image: jellyfin/jellyfin
    restart: always
    network_mode: service:tailscale-jellyfin
    environment:
      - TZ=Europe/Brussels
    volumes:
      - jellyfin:/config
      - /tmp:/cache
      - movies:/movies
      - tvshows:/tv
      - /dev/shm:/dev/shm
    devices:
      - /dev/dri:/dev/dri

On ubuntu or arch running the same docker compose setup, jellyfin docker does recognize an OpenCL device. Jellyfin docker logs on ubuntu server

[AVHWDeviceContext @ 0x5615fea0e100] libva: VA-API version 1.20.0
[AVHWDeviceContext @ 0x5615fea0e100] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x5615fea0e100] libva: Found init function __vaDriverInit_1_20
[AVHWDeviceContext @ 0x5615fea0e100] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x5615fea0e100] Initialised VAAPI connection: version 1.20
[AVHWDeviceContext @ 0x5615fea0e100] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.4.0 (05e4d0d).
[AVHWDeviceContext @ 0x5615fea0e100] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x5615fea3dc40] 0.0: Intel(R) OpenCL Graphics / Intel(R) UHD Graphics
[AVHWDeviceContext @ 0x5615fea3dc40] Intel QSV to OpenCL mapping function found (clCreateFromVA_APIMediaSurfaceINTEL).
[AVHWDeviceContext @ 0x5615fea3dc40] Intel QSV in OpenCL acquire function found (clEnqueueAcquireVA_APIMediaSurfacesINTEL).
[AVHWDeviceContext @ 0x5615fea3dc40] Intel QSV in OpenCL release function found (clEnqueueReleaseVA_APIMediaSurfacesINTEL).

So weird that the underlying OS can have an influence on a passed through GPU in a docker container … Anybody having the same issue?

Did you check permissions? Does the group video or whichever group devices in /dev/dri belong to on the host, have the same numeric ID on the host and the container? Names don’t matter, only the numbers. If the number is different, the container’s video group has no permissions to access that device in the container.

Also, why even use a container and not just services.jellyfin?

Permissions checked, the video group has a different numeric ID on the container than on the host, but that’s also the case with the container on an ubuntu system. But I also tried adding the following to the compose service, but no success:

user: 1000:1000
group_add:
  - "26" #video
  - "303" #render

In any case, the container does have access to the device because I can transcode with jellyfin on the GPU, it’s only when trying to do tone mapping with OpenCL that there is an issue.

vainfo inside the container confirms that it detects the device and it’s capabilities:

root@7aec45a747e2:/# /usr/lib/jellyfin-ffmpeg/vainfo 
Trying display: drm
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_20
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.20 (libva 2.20.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 24.1.1 (f5f09c4)
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain               : VAEntrypointEncSliceLP
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointEncSliceLP
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointEncSliceLP
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointEncSliceLP
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointEncSliceLP
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointEncSliceLP
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointEncSlice
      VAProfileHEVCMain422_10         : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointEncSlice
      VAProfileHEVCMain422_12         : VAEntrypointVLD
      VAProfileHEVCMain422_12         : VAEntrypointEncSlice
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_12         : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain10          : VAEntrypointVLD
      VAProfileHEVCSccMain10          : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain444         : VAEntrypointVLD
      VAProfileHEVCSccMain444         : VAEntrypointEncSliceLP
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointEncSliceLP

As to why docker container and not services.jellyfin: I’m trying to use nixos purely as a static OS to run all my docker containers on. I have a setup where I connect containers to the tailscale container for networking through my tailnet and I use portainer for management. I manage multiple of these devices at several households and nixos has been a blessing for OS management of these things :).

So everything is working, including tailscale, DNS with docker macvlan, etc… It’s just this opencl thing that’s difficult.

It seems plex also uses opencl for tone mapping because it’s also not working in their container. Jellyfin’s VPP tone mapping that doesn’t use opencl but uses intel’s own tone mapping DOES work, which again confirms to me that jellyfin can access the GPU.

None of your NixOS config changes will do anything here as the docker container is in control of the entire userspace. It must contain appropriate VAAPI and OpenCL drivers.

Yeah, I fully get ya, that’s why I’m so surprised as well that it isn’t working while the exact same container is working in ubuntu and arch… For me the only variable that’s changing here is the OS. I’m using the same container, same version of docker, same docker-compose and this is occurring across multiple containers (plex and jellyfin).

So from my point of view: something is happening here on the nixos side that’s not working…

I also tried with the linuxserver/jellyfin container with DOCKER_MODS enabled to install intel-opencl, but same issues…

Allright the plot thickens. I have 2 N100 (Alder Lake) and 1 N5105 (Jasper Lake) device.

The nixos installation on the N5105 and N100 share the exact same config for intel GPU drivers (maybe there is the issue? does N100 need other packages?).

I ran

/usr/lib/jellyfin-ffmpeg/ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device opencl@va

inside a jellyfin container on each device to check if it detects opencl capabilities.

On a N5105 device with nixos as host OS, it works and opencl is detected.

root@3076deea253c:/# /usr/lib/jellyfin-ffmpeg/ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device opencl@va
ffmpeg version 5.1.4-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-libs=-lfftw3f --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libsvtav1 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-opencl --enable-vaapi --enable-amf --enable-libmfx --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[AVHWDeviceContext @ 0x564f29b88cc0] libva: VA-API version 1.20.0
[AVHWDeviceContext @ 0x564f29b88cc0] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x564f29b88cc0] libva: Found init function __vaDriverInit_1_20
[AVHWDeviceContext @ 0x564f29b88cc0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x564f29b88cc0] Initialised VAAPI connection: version 1.20
[AVHWDeviceContext @ 0x564f29b88cc0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.4.0 (05e4d0d).
[AVHWDeviceContext @ 0x564f29b88cc0] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x564f29bab540] 0.0: Intel(R) OpenCL Graphics / Intel(R) UHD Graphics
[AVHWDeviceContext @ 0x564f29bab540] Intel QSV to OpenCL mapping function found (clCreateFromVA_APIMediaSurfaceINTEL).
[AVHWDeviceContext @ 0x564f29bab540] Intel QSV in OpenCL acquire function found (clEnqueueAcquireVA_APIMediaSurfacesINTEL).
[AVHWDeviceContext @ 0x564f29bab540] Intel QSV in OpenCL release function found (clEnqueueReleaseVA_APIMediaSurfacesINTEL).

On a N100 device with ubuntu as host OS, it works and opencl is detected

root@679c855e6589:/# /usr/lib/jellyfin-ffmpeg/ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device opencl@vaffmpeg version 5.1.4-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers  built with gcc 10 (Debian 10.2.1-6)  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-libs=-lfftw3f --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libsvtav1 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-opencl --enable-vaapi --enable-amf --enable-libmfx --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[AVHWDeviceContext @ 0x555b8b00c100] libva: VA-API version 1.20.0
[AVHWDeviceContext @ 0x555b8b00c100] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x555b8b00c100] libva: Found init function __vaDriverInit_1_20
[AVHWDeviceContext @ 0x555b8b00c100] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x555b8b00c100] Initialised VAAPI connection: version 1.20
[AVHWDeviceContext @ 0x555b8b00c100] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.4.0 (05e4d0d).
[AVHWDeviceContext @ 0x555b8b00c100] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x555b8b03bc40] 0.0: Intel(R) OpenCL Graphics / Intel(R) UHD Graphics
[AVHWDeviceContext @ 0x555b8b03bc40] Intel QSV to OpenCL mapping function found (clCreateFromVA_APIMediaSurfaceINTEL).
[AVHWDeviceContext @ 0x555b8b03bc40] Intel QSV in OpenCL acquire function found (clEnqueueAcquireVA_APIMediaSurfacesINTEL).
[AVHWDeviceContext @ 0x555b8b03bc40] Intel QSV in OpenCL release function found (clEnqueueReleaseVA_APIMediaSurfacesINTEL).

On the N100 device with nixos as host OS, it doesn’t work and opencl isn’t detected.

root@c9803a7b2fda:/# /usr/lib/jellyfin-ffmpeg/ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device opencl@va
ffmpeg version 5.1.4-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-libs=-lfftw3f --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libsvtav1 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-opencl --enable-vaapi --enable-amf --enable-libmfx --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[AVHWDeviceContext @ 0x55d31f318cc0] libva: VA-API version 1.20.0
[AVHWDeviceContext @ 0x55d31f318cc0] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x55d31f318cc0] libva: Found init function __vaDriverInit_1_20
[AVHWDeviceContext @ 0x55d31f318cc0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55d31f318cc0] Initialised VAAPI connection: version 1.20
[AVHWDeviceContext @ 0x55d31f318cc0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.4.0 (05e4d0d).
[AVHWDeviceContext @ 0x55d31f318cc0] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x55d31f350900] Failed to get number of OpenCL platforms: -1001.
Device creation failed: -19.
Failed to set value 'opencl@va' for option 'init_hw_device': No such device
Error parsing global options: No such device

So there seems to be an issue with N100 devices in Nixos with opencl…

I know also see that the output of clinfo on my N5105 machine is different than the output of clinfo on my N100 machine. So it seems that drivers are different between N5105 (Jasper Lake) and N100 (alder lake) and I don’t seem to have the right packages installed for N100…

clinfo on N5105 machine:

Number of platforms 2 Platform Name - Pastebin.com

Output of clinfo on N100 machine

[nix-shell:/home/odd]# clinfo
Number of platforms                               1
  Platform Name                                   Intel(R) OpenCL
  Platform Vendor                                 Intel(R) Corporation
  Platform Version                                OpenCL 1.2 LINUX
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64
  Platform Extensions function suffix             INTEL

  Platform Name                                   Intel(R) OpenCL
Number of devices                                 1
  Device Name                                     Intel(R) N100
  Device Vendor                                   Intel(R) Corporation
  Device Vendor ID                                0x8086
  Device Version                                  OpenCL 1.2 (Build 475)
  Driver Version                                  1.2.0.475
  Device OpenCL C Version                         OpenCL C 1.2
  Device Type                                     CPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               4
  Max clock frequency                             0MHz
  Device Partition                                (core)
    Max number of sub-devices                     4
    Supported partition types                     by counts, equally, by names (Intel)
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             8192x8192x8192
  Max work group size                             8192
  Preferred work group size multiple (kernel)     128
  Preferred / native vector sizes
    char                                                 1 / 32
    short                                                1 / 16
    int                                                  1 / 8
    long                                                 1 / 4
    half                                                 0 / 0        (n/a)
    float                                                1 / 8
    double                                               1 / 4        (cl_khr_fp64)
  Half-precision Floating-point support           (n/a)
  Single-precision Floating-point support         (core)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 No
    Round to infinity                             No
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  No
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              12512915456 (11.65GiB)
  Error Correction support                        No
  Max memory allocation                           3128228864 (2.913GiB)
  Unified memory for Host and Device              Yes
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        524288 (512KiB)
  Global Memory cache line size                   64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             480
    Max size for 1D images from buffer            195514304 pixels
    Max 1D or 2D image array size                 2048 images
    Max 2D image size                             16384x16384 pixels
    Max 3D image size                             2048x2048x2048 pixels
    Max number of read image args                 480
    Max number of write image args                480
  Local memory type                               Global
  Local memory size                               32768 (32KiB)
  Max number of constant args                     480
  Max constant buffer size                        131072 (128KiB)
  Max size of kernel argument                     3840 (3.75KiB)
  Queue properties
    Out-of-order execution                        Yes
    Profiling                                     Yes
    Local thread execution (Intel)                Yes
  Prefer user sync for interop                    No
  Profiling timer resolution                      1ns
  Execution capabilities
    Run OpenCL kernels                            Yes
    Run native kernels                            Yes
    SPIR versions                                 1.2
  printf() buffer size                            1048576 (1024KiB)
  Built-in kernels                                (n/a)
  Device Extensions                               cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Intel(R) OpenCL
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [INTEL]
  clCreateContext(NULL, ...) [default]            Success [INTEL]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 Intel(R) OpenCL
    Device Name                                   Intel(R) N100
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  Success (1)
    Platform Name                                 Intel(R) OpenCL
    Device Name                                   Intel(R) N100
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 Intel(R) OpenCL
    Device Name                                   Intel(R) N100

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.3.2
  ICD loader Profile                              OpenCL 3.0

Finally, resolved (or at least, I know where the issue lies).

Apparently there is an issue with intel-compute-runtime (which provides opencl libraries for intel GPU) on the latest 6.8 linux kernel: NEO driver not detect GPU when using kernel 6.8.x. · Issue #710 · intel/compute-runtime (github.com)

I was running that kernel and that’s why the GPU did not show up under clinfo and opencl didn’t work in the jellyfin container.

Temporarily downgrading to the 6.7 kernel fixed the issue.

That would have been my next guess aswell; if the userspace is the same, the difference must be in the kernel.

I just bought an N100 machine (Asrock N100DC-ITX) where I am trying to get running Jellyfin with QuickSync. However, I think I haven’t managed to enable it because I get a similar message like yours (see below). I have a very similar setup like yours:

Running Jellyfin via docker compose with the linuxserver image:

services:
    jellyfin:
        container_name: jellyfin
        environment:
            - PUID=${PUID}
            - PGID=${PGID}
            - TZ=${TIMEZONE}
        volumes:
            - ${CONFIG_FOLDER}/jellyfin:/config
            - ${LIBRARY_FOLDER}/series:/data/tvshows
            - ${LIBRARY_FOLDER}/movies:/data/movies
        ports:
            - 8096:8096
            - 7359:7359/udp
        devices:
            - /dev/dri:/dev/dri
        restart: unless-stopped
        image: lscr.io/linuxserver/jellyfin

And this is an extract from the hardware-configuration.nix:

  hardware.opengl = {
    enable = true;
    driSupport = true;
    extraPackages = with pkgs; [
      intel-media-driver
      intel-compute-runtime
      vaapiVdpau
      libvdpau-va-gl
      intel-vaapi-driver
      # intel-ocl # not installed at the moment because it is unfree
      onevpl-intel-gpu
    ];
  };

I honestly did not know how to enable hardware accelleration because to me the Nixos wiki is not very clear. Thus, I mostly copied your configuration (despite using onevpl-intel-gpu and intel-vaapi-driver since I am on Nixos 24.05).

My kernel is below 6.7:

user@server: uname -a
Linux server 6.6.35 #1-NixOS SMP PREEMPT_DYNAMIC Fri Jun 21 12:38:50 UTC 2024 x86_64 GNU/Linux

When I give the same command you do inside the Jellyfin container I get a similar error as in your first message:

root@e48545503341:/# /usr/lib/jellyfin-ffmpeg/ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device opencl@va
ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-opencl --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libsvtav1 --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-vaapi --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
[AVHWDeviceContext @ 0x55b32aba7280] libva: VA-API version 1.21.0
[AVHWDeviceContext @ 0x55b32aba7280] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x55b32aba7280] libva: Found init function __vaDriverInit_1_21
[AVHWDeviceContext @ 0x55b32aba7280] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55b32aba7280] Initialised VAAPI connection: version 1.21
[AVHWDeviceContext @ 0x55b32aba7280] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 24.2.3 (7c1c775).
[AVHWDeviceContext @ 0x55b32aba7280] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x55b32abd75c0] Failed to get number of OpenCL platforms: -1001.
Device creation failed: -19.
Failed to set value 'opencl@va' for option 'init_hw_device': No such device
Error parsing global options: No such device
root@e48545503341:/# 

I don’t know if it can be relevant but I will attach also this:

user@server ~> nix-shell -p libva-utils --run vainfo
Trying display: wayland
Trying display: x11
error: can't connect to X server!
Trying display: drm
libva info: VA-API version 1.21.0
libva info: Trying to open /run/opengl-driver/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_21
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.21 (libva 2.21.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 24.2.1 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain               : VAEntrypointEncSliceLP
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointEncSliceLP
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointEncSliceLP
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointEncSliceLP
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointEncSliceLP
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointEncSliceLP
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointEncSlice
      VAProfileHEVCMain422_10         : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointEncSlice
      VAProfileHEVCMain422_12         : VAEntrypointVLD
      VAProfileHEVCMain422_12         : VAEntrypointEncSlice
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_12         : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain10          : VAEntrypointVLD
      VAProfileHEVCSccMain10          : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain444         : VAEntrypointVLD
      VAProfileHEVCSccMain444         : VAEntrypointEncSliceLP
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointEncSliceLP
user@server ~>

And this is how I setup my Jellyfin through its interface:

Do you know what I am doing wrong and how to eventually check that everything is working?

Just for fun I ran the docker container of Jellyfin from the official image and it seems that the command to check “quicksync/hardware accelleration” is not giving any error now:

root@b724d20c7d69:/# /usr/lib/jellyfin-ffmpeg/ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device opencl@va
ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-opencl --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libsvtav1 --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-vaapi --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
[AVHWDeviceContext @ 0x55bee616cf00] libva: VA-API version 1.21.0
[AVHWDeviceContext @ 0x55bee616cf00] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x55bee616cf00] libva: Found init function __vaDriverInit_1_21
[AVHWDeviceContext @ 0x55bee616cf00] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55bee616cf00] Initialised VAAPI connection: version 1.21
[AVHWDeviceContext @ 0x55bee616cf00] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 24.2.3 (7c1c775).
[AVHWDeviceContext @ 0x55bee616cf00] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x55bee619f440] 0.0: Intel(R) OpenCL Graphics / Intel(R) UHD Graphics
[AVHWDeviceContext @ 0x55bee619f440] Intel QSV to OpenCL mapping function found (clCreateFromVA_APIMediaSurfaceINTEL).
[AVHWDeviceContext @ 0x55bee619f440] Intel QSV in OpenCL acquire function found (clEnqueueAcquireVA_APIMediaSurfacesINTEL).
[AVHWDeviceContext @ 0x55bee619f440] Intel QSV in OpenCL release function found (clEnqueueReleaseVA_APIMediaSurfacesINTEL).
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
root@b724d20c7d69:/#

Is this the solution? And Is this the command to check that my jellyfin is using the hardware accelleration to its maximum capacities?

Please note that as soon as you are within an OCI container, none of the NixOS userspace configuration matters anymore, only the kernel configuration.
What you configured here only has an effect outside of OCI containers.

It’s up to the container image to provide working userspace drivers for OpenCL, VAAPI and the like and, apparently, the linuxserver one doesn’t do it correctly.
Please again note that this has nothing to do with NixOS.

1 Like