Hi All,
So having this built in docker functionality has made me jump ship on my home nas from unraid to Truenas.
I have migrated all my apps just fine apart from Jellyfin.
With Jellyfin I have started from scratch using docker compose and it runs well but I have no idea how to get iGPU acceleration working for the transcodes.
Could somebody tell me what I need to add to my config to get it to work ?
services:
jellyfin:
image: lscr.io/linuxserver/jellyfin:latest
container_name: jellyfin
environment:
- PUID=568
- PGID=568
- TZ=Europe/Paris
volumes:
- /mnt/FAST/Docker/jellyfin/config:/config
- /mnt/FAST/Docker/jellyfin/transcodes:/transcodes
- /mnt/SLOW/:/nas
ports:
- 8096:8096
restart: unless-stopped
Just to note, update my config to include renderD128:
services:
jellyfin:
image: lscr.io/linuxserver/jellyfin:latest
container_name: jellyfin
environment:
- PUID=568
- PGID=568
- TZ=Europe/Paris
volumes:
- /mnt/FAST/Docker/jellyfin/config:/config
- /mnt/FAST/Docker/jellyfin/transcodes:/transcodes
- /mnt/SLOW/:/nas
ports:
- 8096:8096
devices:
- /dev/dri/renderD128:/dev/dri/renderD128
restart: unless-stopped
And also did a chmod -R 777 /dev/dri to make sure I had no permission problems but still no luck.
Jellyfin logs attached in case somebody knows what the issue could be.
Also, the iGPU is the AMD Raphael which is built into all Zen4/Zen5 cpu’s and open source driver seems to be installed:
lspci -nnk | grep -iA2 vga
68:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Raphael [1002:164e] (rev c1)
Subsystem: ASUSTeK Computer Inc. Raphael [1043:8877]
Kernel driver in use: amdgpu
Transcode log looks like this:
/usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -probesize 1G -init_hw_device opencl=ocl:0.0 -filter_hw_device ocl -hwaccel vaapi -hwaccel_output_format vaapi -noautorotate -i file:"/nas/Tv/The_Penguin/The Penguin S01E01 After Hours 2160p MAX WEB-DL DDP5 1 DoVi x265-NTb/The Penguin S01E01 After Hours 2160p MAX WEB-DL DDP5 1 DoVi x265-NTb.mkv" -noautoscale -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_vaapi -rc_mode VBR -b:v 36085310 -maxrate 36085310 -bufsize 72170620 -profile:v:0 high -sei -a53_cc -force_key_frames:0 "expr:gte(t,n_forced*3)" -vf "setparams=color_primaries=bt2020:color_trc=smpte2084:colorspace=bt2020nc,hwdownload,format=p010le,hwupload=derive_device=opencl,tonemap_opencl=format=nv12:p=bt709:t=bt709:m=bt709:tonemap=bt2390:peak=100:desat=0,hwdownload,format=nv12,hwupload_vaapi" -codec:a:0 libfdk_aac -ac 2 -ab 256000 -af "volume=2" -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type fmp4 -hls_fmp4_init_filename "3c5f5bb8d4282c53499817b9796ffcb1-1.mp4" -start_number 0 -hls_segment_filename "/config/cache/transcodes/3c5f5bb8d4282c53499817b9796ffcb1%d.mp4" -hls_playlist_type vod -hls_list_size 0 -y "/config/cache/transcodes/3c5f5bb8d4282c53499817b9796ffcb1.m3u8"
ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 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 --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-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 @ 0x563ab774d300] Failed to get number of OpenCL platforms: -1001.
Device creation failed: -19.
Failed to set value 'opencl=ocl:0.0' for option 'init_hw_device': No such device
Error parsing global options: No such device
Ok, another update, HW Accel is working, it only fails when enabling tone mapping.
Will research on how to get tonemapping working in the container but first indication show tonemapping requires openCL:
[AVHWDeviceContext @ 0x563ab774d300] Failed to get number of OpenCL platforms: -1001.
Device creation failed: -19.
Failed to set value 'opencl=ocl:0.0' for option 'init_hw_device': No such device
Error parsing global options: No such device
Jellyfin documentation shows it should be supported:
Some more troubleshooting show that from within the container jellyfin seems to have full access to renderD128
# ./vainfo --display drm --device /dev/dri/renderD128
Trying display: drm
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_22
amdgpu: os_same_file_description couldn't determine if two DRM fds reference the same file description.
If they do, bad things may happen!
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Mesa Gallium driver 24.0.9 for AMD Radeon Graphics (radeonsi, raphael_mendocino, LLVM 17.0.6, DRM 3.54, 6.6.44-production+truenas)
vainfo: Supported profile and entrypoints
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSlice
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile2 : VAEntrypointVLD
VAProfileAV1Profile0 : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc
# ./ffmpeg -v debug -init_hw_device drm=dr:/dev/dri/renderD128 -init_hw_device vulkan@dr
ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 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 --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-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
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-init_hw_device' ... matched as option 'init_hw_device' (initialise hardware device) with argument 'drm=dr:/dev/dri/renderD128'.
Reading option '-init_hw_device' ... matched as option 'init_hw_device' (initialise hardware device) with argument 'vulkan@dr'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Applying option init_hw_device (initialise hardware device) with argument drm=dr:/dev/dri/renderD128.
[AVHWDeviceContext @ 0x55e922d4b300] Opened DRM device /dev/dri/renderD128: driver amdgpu version 3.54.0.
Applying option init_hw_device (initialise hardware device) with argument vulkan@dr.
[AVHWDeviceContext @ 0x55e922d4b4c0] Supported validation layers:
[AVHWDeviceContext @ 0x55e922d4b4c0] VK_LAYER_MESA_device_select
[AVHWDeviceContext @ 0x55e922d4b4c0] VK_LAYER_MESA_overlay
[AVHWDeviceContext @ 0x55e922d4b4c0] GPU listing:
[AVHWDeviceContext @ 0x55e922d4b4c0] 0: AMD Radeon Graphics (RADV RAPHAEL_MENDOCINO) (integrated) (0x164e)
[AVHWDeviceContext @ 0x55e922d4b4c0] Requested device: 0x164e
[AVHWDeviceContext @ 0x55e922d4b4c0] Device 0 selected: AMD Radeon Graphics (RADV RAPHAEL_MENDOCINO) (integrated) (0x164e)
[AVHWDeviceContext @ 0x55e922d4b4c0] Queue families:
[AVHWDeviceContext @ 0x55e922d4b4c0] 0: graphics compute transfer (queues: 1)
[AVHWDeviceContext @ 0x55e922d4b4c0] 1: compute transfer (queues: 4)
[AVHWDeviceContext @ 0x55e922d4b4c0] 2: sparse (queues: 1)
[AVHWDeviceContext @ 0x55e922d4b4c0] Using device extension VK_KHR_push_descriptor
[AVHWDeviceContext @ 0x55e922d4b4c0] Using device extension VK_KHR_sampler_ycbcr_conversion
[AVHWDeviceContext @ 0x55e922d4b4c0] Using device extension VK_KHR_synchronization2
[AVHWDeviceContext @ 0x55e922d4b4c0] Using device extension VK_KHR_external_memory_fd
[AVHWDeviceContext @ 0x55e922d4b4c0] Using device extension VK_EXT_external_memory_dma_buf
[AVHWDeviceContext @ 0x55e922d4b4c0] Using device extension VK_EXT_image_drm_format_modifier
[AVHWDeviceContext @ 0x55e922d4b4c0] Using device extension VK_KHR_external_semaphore_fd
[AVHWDeviceContext @ 0x55e922d4b4c0] Using device extension VK_EXT_external_memory_host
[AVHWDeviceContext @ 0x55e922d4b4c0] Using device: AMD Radeon Graphics (RADV RAPHAEL_MENDOCINO)
[AVHWDeviceContext @ 0x55e922d4b4c0] Alignments:
[AVHWDeviceContext @ 0x55e922d4b4c0] optimalBufferCopyRowPitchAlignment: 1
[AVHWDeviceContext @ 0x55e922d4b4c0] minMemoryMapAlignment: 4096
[AVHWDeviceContext @ 0x55e922d4b4c0] minImportedHostPointerAlignment: 4096
[AVHWDeviceContext @ 0x55e922d4b4c0] Using queue family 0 (queues: 1) for graphics
[AVHWDeviceContext @ 0x55e922d4b4c0] Using queue family 1 (queues: 4) for compute transfers
Successfully parsed a group of options.
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'
#