HW transcoding not working... Cannot load libcuda.so.1 - GuigZer - 2024-11-25
Jellyfin NVIDIA Hardware Transcoding Issue on Debian with Quadro P620
Environment
- **OS**: Debian GNU/Linux 12 (bookworm)
- **Kernel**: 6.1.0-28-amd64
- **GPU**: NVIDIA Quadro P620
- **Driver Version**: 535.183.01
- **Container**: Jellyfin (lscr.io/linuxserver/jellyfin:latest)
Issue Description
I recently installed a Quadro P620 GPU for hardware transcoding in Jellyfin. While the GPU is properly detected both on the host system and inside the Docker container, FFmpeg fails to initialize CUDA for transcoding with an error related to loading the CUDA library.
Attempted Solutions
I have already tried several solutions suggested in these forum posts:
- Verifying NVIDIA runtime is properly installed and configured in Docker
- Adding all necessary GPU capabilities in docker-compose file
- Setting NVIDIA_DRIVER_CAPABILITIES and NVIDIA_VISIBLE_DEVICES to "all"
- Ensuring proper permissions for the Jellyfin user in the container
- Checking if CUDA libraries are present in the container
- Verifying GPU detection using nvidia-smi both on host and in container
None of these common solutions have resolved the issue.
System Configuration
Host System Information
bash
$ uname -a
Linux openmediavault 6.1.0-28-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22) x86_64 GNU/Linux
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
GPU Detection
bash
$ nvidia-smi
Mon Nov 25 22:00:28 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.183.01 Driver Version: 535.183.01 CUDA Version: N/A |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 Quadro P620 Off | 00000000:02:00.0 Off | N/A |
| 28% 43C P0 N/A / N/A | 0MiB / 2048MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
Docker Compose Configuration
yaml
services:
jellyfin:
image: lscr.io/linuxserver/jellyfin:latest
container_name: jellyfin
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- JELLYFIN_PublishedServerUrl=http://192.168.1.100
- NVIDIA_DRIVER_CAPABILITIES=all
- NVIDIA_VISIBLE_DEVICES=all
volumes:
- ./config:/config
- /srv/dev-disk-by-uuid-504655e3-3559-44c8-b61b-9eaed009f4a3/plex/serie:/data/tvshows
- /srv/dev-disk-by-uuid-504655e3-3559-44c8-b61b-9eaed009f4a3/plex/film:/data/movies
- ./transcode:/config/transcodes
ports:
- 8096:8096
- 8920:8920
- 7359:7359/udp
- 1900:1900/udp
restart: unless-stopped
runtime: nvidia
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: ["gpu","compute","video","utility"]
Error Message
When attempting to play a video file, FFmpeg logs show:
[AVHWDeviceContext @ 0x55ab2d7c1d00] Cannot load libcuda.so.1
[AVHWDeviceContext @ 0x55ab2d7c1d00] Could not dynamically load CUDA
Device creation failed: -1.
Failed to set value 'cuda=cu:0' for option 'init_hw_device': Operation not permitted
Error parsing global options: Operation not permitted
Additional Information
- The GPU is properly detected inside the container (verified using nvidia-smi)
- NVIDIA runtime is properly configured in Docker
- FFmpeg is built with NVIDIA support (as shown in the configuration output)
Any assistance would be greatly appreciated.
RE: HW transcoding not working... Cannot load libcuda.so.1 - TheDreadPirate - 2024-11-25
What is the output of this command?
Code: sudo apt list --installed | grep header
RE: HW transcoding not working... Cannot load libcuda.so.1 - GuigZer - 2024-11-26
Hi,
here it is :
Code: └─$ sudo apt list --installed | grep header
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
linux-headers-6.1.0-28-amd64/stable-security,now 6.1.119-1 amd64 [installé]
linux-headers-6.1.0-28-common/stable-security,now 6.1.119-1 all [installé, automatique]
opencl-c-headers/stable,now 3.0~2023.02.06-1 all [installé, automatique]
opencl-clhpp-headers/stable,now 3.0~2023.02.06-1 all [installé, automatique]
thanks for the help
RE: HW transcoding not working... Cannot load libcuda.so.1 - GuigZer - 2024-11-26
UPDATE : i dont know how but now i get this error
Code: ffmpeg version 7.0.2-Jellyfin Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 13 (Ubuntu 13.2.0-23ubuntu4)
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
Input #0, matroska,webm, from 'file:/data/tvshows/Arcane/Season 1/Arcane.S01E01.Welcome.to.the.Playground.MULTi.2160p.UHD.BluRay.DV.HDR.AV1-BTT.mkv':
Metadata:
encoder : libebml v1.4.5 + libmatroska v1.7.1
creation_time : 2024-10-16T12:19:41.000000Z
IMDB : tt11126994
TMDB : tv/94605
TVDB : 371028
Duration: 00:41:38.91, start: 0.000000, bitrate: 7271 kb/s
Chapters:
Chapter #0:0: start 0.000000, end 264.347000
Metadata:
title : Chapter 1
Chapter #0:1: start 264.347000, end 861.277000
Metadata:
title : Chapter 2
Chapter #0:2: start 861.277000, end 1178.719000
Metadata:
title : Chapter 3
Chapter #0:3: start 1178.719000, end 1409.408000
Metadata:
title : Chapter 4
Chapter #0:4: start 1409.408000, end 1722.804000
Metadata:
title : Chapter 5
Chapter #0:5: start 1722.804000, end 2103.727000
Metadata:
title : Chapter 6
Chapter #0:6: start 2103.727000, end 2377.792000
Metadata:
title : Chapter 7
Chapter #0:7: start 2377.792000, end 2498.913000
Metadata:
title : Chapter 8
Stream #0:0(eng): Video: av1 (libdav1d) (Main), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x1636, SAR 1:1 DAR 960:409, 23.98 fps, 23.98 tbr, 1k tbn (default)
Metadata:
title : Encode AV1 @ 3 371 kb/s (source : FraMeSToR)
BPS : 3370511
DURATION : 00:41:38.913000000
NUMBER_OF_FRAMES: 59914
NUMBER_OF_BYTES : 1052826962
_STATISTICS_WRITING_APP: mkvmerge v87.0 ('Black as the Sky') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2024-10-16 12:19:41
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Side data:
DOVI configuration record: version: 1.0, profile: 10, level: 6, rpu flag: 1, el flag: 0, bl flag: 1, compatibility id: 1
Stream #0:1(eng): Audio: truehd, 48000 Hz, 5.1(side), s32 (24 bit) (original)
Metadata:
title : TrueHD 5.1
BPS : 3150719
DURATION : 00:41:38.872000000
NUMBER_OF_FRAMES: 2998646
NUMBER_OF_BYTES : 984155604
_STATISTICS_WRITING_APP: mkvmerge v87.0 ('Black as the Sky') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2024-10-16 12:19:41
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:2(fre): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
Metadata:
title : AC-3 5.1
BPS : 640000
DURATION : 00:41:38.880000000
NUMBER_OF_FRAMES: 78090
NUMBER_OF_BYTES : 199910400
_STATISTICS_WRITING_APP: mkvmerge v87.0 ('Black as the Sky') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2024-10-16 12:19:41
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:3(fre): Subtitle: hdmv_pgs_subtitle (pgssub), 1920x1080 (dub)
Metadata:
title : French (Parisian)
BPS : 21393
DURATION : 00:41:34.534000000
NUMBER_OF_FRAMES: 724
NUMBER_OF_BYTES : 6670716
_STATISTICS_WRITING_APP: mkvmerge v87.0 ('Black as the Sky') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2024-10-16 12:19:41
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:4(eng): Subtitle: hdmv_pgs_subtitle (pgssub), 1920x1080 (original)
Metadata:
title : English
BPS : 24593
DURATION : 00:41:20.895000000
NUMBER_OF_FRAMES: 920
NUMBER_OF_BYTES : 7626813
_STATISTICS_WRITING_APP: mkvmerge v87.0 ('Black as the Sky') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2024-10-16 12:19:41
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:5(eng): Subtitle: hdmv_pgs_subtitle (pgssub), 1920x1080 (original) (hearing impaired)
Metadata:
title : English (SDH)
BPS : 37932
DURATION : 00:41:25.274000000
NUMBER_OF_FRAMES: 1372
NUMBER_OF_BYTES : 11784025
_STATISTICS_WRITING_APP: mkvmerge v87.0 ('Black as the Sky') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2024-10-16 12:19:41
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
Stream #0:0 -> #0:0 (av1 (libdav1d) -> h264 (h264_nvenc))
Stream #0:2 -> #0:1 (ac3 (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[h264_nvenc @ 0x556f3a98ae00] Cannot load libnvidia-encode.so.1
[h264_nvenc @ 0x556f3a98ae00] The minimum required Nvidia driver for nvenc is 520.56.06 or newer
[vost#0:0/h264_nvenc @ 0x556f3afbeb40] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
[vf#0:0 @ 0x556f3aa27f00] Error sending frames to consumers: Operation not permitted
[vf#0:0 @ 0x556f3aa27f00] Task finished with error code: -1 (Operation not permitted)
[vf#0:0 @ 0x556f3aa27f00] Terminating thread with return code -1 (Operation not permitted)
[vost#0:0/h264_nvenc @ 0x556f3afbeb40] Could not open encoder before EOF
[vost#0:0/h264_nvenc @ 0x556f3afbeb40] Task finished with error code: -22 (Invalid argument)
[vost#0:0/h264_nvenc @ 0x556f3afbeb40] Terminating thread with return code -22 (Invalid argument)
[out#0/hls @ 0x556f3b553e00] Nothing was written into output file, because at least one of its streams received no packets.
frame= 0 fps=0.0 q=0.0 Lsize= 0KiB time=N/A bitrate=N/A speed=N/A
Conversion failed!
RE: HW transcoding not working... Cannot load libcuda.so.1 - GuigZer - 2024-11-26
Second UPDATE :
So i do a
sudo apt install libnvidia-encode1
and
└─$ nvidia-smi
Tue Nov 26 10:48:25 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.183.01 Driver Version: 535.183.01 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 Quadro P620 Off | 00000000:02:00.0 Off | N/A |
| 34% 49C P0 N/A / N/A | 240MiB / 2048MiB | 88% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 467531 C /usr/lib/jellyfin-ffmpeg/ffmpeg 238MiB |
+---------------------------------------------------------------------------------------+
Now it work's !
|