Jellyfin Forum
Unable to get hardware acceleration working on Qnap nas with a Nvidia gpu - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: Unable to get hardware acceleration working on Qnap nas with a Nvidia gpu (/t-unable-to-get-hardware-acceleration-working-on-qnap-nas-with-a-nvidia-gpu)

Pages: 1 2


Unable to get hardware acceleration working on Qnap nas with a Nvidia gpu - Envelope6651 - 2025-01-02

Hardware:
Qnap ts-877xu-rp
Nvidia RTX 3070 on a gpu riser

Software:
My nas is running on firmware QTS 5.2.2.2950
Nvidia driver version 550.67
Cuda version 12.4
Jellyfin version 10.10.3

Hi, I have been stuck for the last couple of days trying to get hardware acceleration working on my Qnap nas. I am running Jellyfin as a container via Portainer. Here is my compose file:
Code:
services:
  jellyfin:
    user: 0:0
    privileged: true
    ports:
      - 8096:8096
    image: jellyfin/jellyfin:latest
    devices:
      - /dev/dri
      - /dev/nvidia0
      - /dev/nvidiactl
      - /dev/nvidia-caps
      - /dev/nvidia-uvm
    volumes:
      - /share/ssd-container/jellyfin/config:/config
      - /share/ssd-container/jellyfin/cache:/cache
      - /opt/NVIDIA_GPU_DRV/usr:/usr/local/nvidia:ro
      - /share/JDrive/Movies:/Movies
      - /share/JDrive/Music:/Music
      - /share/JDrive/TVShows:/TVShows
      - /share/JDrive/Anime:/Anime
    environment:
      - LD_LIBRARY_PATH=/usr/local/nvidia/lib
      - PATH=/lsiopy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/nvidia/bin
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILITIES=all
    restart: 'unless-stopped'
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

I have turned on NVENC hardware accelerations in the settings and have checked: x265, HEVC, HEVC 10bit and VP9 10bit. When I try to watch a hevc file on my browser that doesn't support it it just says "Playback failed due to a fatal player error.". When i look in the ffmpeg logs I see:
Code:
ffmpeg version 7.0.2-Jellyfin Copyright (c) 2000-2024 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=auto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-opencl --enable-libdrm --enable-libxml2 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libharfbuzz --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      59.  8.100 / 59.  8.100
  libavcodec    61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample  5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
[AVHWDeviceContext @ 0x559a3850dbc0] cu->cuInit(0) failed -> CUDA_ERROR_UNKNOWN: unknown error
Device creation failed: -542398533.
Failed to set value 'cuda=cu:0' for option 'init_hw_device': Generic error in an external library
Error parsing global options: Generic error in an external library

I am able to run nvidia-smi in the container itself and it looks normal. I also ran /usr/lib/jellyfin-ffmpeg/vainfo idk if this helps but here is the output:
Code:
Trying display: drm
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/nvidia_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: Trying to open /usr/lib/dri/nvidia_drv_video.so
libva info: Trying to open /usr/local/lib/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

I am pretty lost and I hoped you guys could help me figure this out. Thanks for your time!


RE: Unable to get hardware acceleration working on Qnap nas with a Nvidia gpu - TheDreadPirate - 2025-01-02

Did you install the Nvidia encode/decode packages? They are not part of the driver, CUDA, or container toolkit.

Not sure how that works with Nvidia on QNAP.


RE: Unable to get hardware acceleration working on Qnap nas with a Nvidia gpu - Envelope6651 - 2025-01-02

I missed that part I'll look into it thanks!


RE: Unable to get hardware acceleration working on Qnap nas with a Nvidia gpu - Envelope6651 - 2025-01-02

I found libnvidia-encode.so and libnvcuvid in the /usr/local/nvidia/lib directory of my container


RE: Unable to get hardware acceleration working on Qnap nas with a Nvidia gpu - TheDreadPirate - 2025-01-02

Add this to your compose

Code:
runtime: nvidia

https://jellyfin.org/docs/general/administration/hardware-acceleration/nvidia/#configure-with-linux-virtualization


RE: Unable to get hardware acceleration working on Qnap nas with a Nvidia gpu - Envelope6651 - 2025-01-02

doesnt that require the nvidia toolkit. I don't think its possible to install that on a qnap nas


RE: Unable to get hardware acceleration working on Qnap nas with a Nvidia gpu - TheDreadPirate - 2025-01-02

Using Nvidia GPUs with containers, period, requires the nvidia container toolkit. But it may be different with QNAP.

Oh. I found this old github issue. Give it a read.

https://github.com/jellyfin/jellyfin/issues/9806

Scroll down.


RE: Unable to get hardware acceleration working on Qnap nas with a Nvidia gpu - Envelope6651 - 2025-01-02

My compose file is pretty much the exact same as most of the compose files in the comments. I also have the newest nvidia driver that seemed to work for one of them, but it doesn't seem to work for me. I also check persmissions which are correct for all files which should matter i think because i have privileged mode and use user 0:0. My nvidia-smi also works as expected


RE: Unable to get hardware acceleration working on Qnap nas with a Nvidia gpu - TheDreadPirate - 2025-01-02

It might be worth going over to the QNAP forum and asking there. I'm not finding any documentation for QNAP, nor user created walk throughs.


RE: Unable to get hardware acceleration working on Qnap nas with a Nvidia gpu - Envelope6651 - 2025-01-02

thanks I'll see if they know something. If I find the solution should I post it here? In the mean time if anyone else has any ideas feel free to respond.