Jellyfin Forum
Jellyfin + AMD + Docker? - 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: Jellyfin + AMD + Docker? (/t-jellyfin-amd-docker)



Jellyfin + AMD + Docker? - ignacio - 2023-11-04

I'm trying to get jellyfin to work with hardware acceleration inside a docker container.

This is my docker-compose file:

Code:
version: '3.8'
services:
  jellyfin:
    image: jellyfin/jellyfin
    container_name: jellyfin
    volumes:
      - nfs-jellyfin:/config
      - nfs-movies:/media/movies
      - nfs-tv:/media/tv
    restart: 'unless-stopped'
    environment:
      - PUID=1026
      - PGID=100
      - TZ=America/California
      - JELLYFIN_PublishedServerUrl=http://192.168.86.124/
      - ROC_ENABLE_PRE_VEGA=1
      - DOCKER_MODS=linuxserver/mods:jellyfin-amd
    ports:
      - 8096:8096
      - 8920:8920 #optional
      - 7359:7359/udp #optional
      - 1900:1900/udp #optional
    devices:
      - /dev/dri/renderD128:/dev/dri/renderD128
      - /dev/kfd:/dev/kfd
      - /dev/dri/card0:/dev/dri/card0
volumes:
  nfs-tv:
    external: true
  nfs-movies:
    external: true
  nfs-jellyfin:
    external: true

I cannot play anything. This is what I see on my log file:

Code:
amdgpu: os_same_file_description couldn't determine if two DRM fds reference the same file description.
If they do, bad things may happen!
[AVHWDeviceContext @ 0x56495ba296c0] Failed to get number of OpenCL platforms: -1001.
Device creation failed: -19.
Failed to set value 'opencl=ocl:.0,device_vendor=Advanced Micro Devices' for option 'init_hw_device': No such device
Error parsing global options: No such device

Code:
sudo docker exec -it jellyfin /usr/lib/jellyfin-ffmpeg/vainfo --display drm --device /dev/dri/renderD128
2023/11/04 19:56:00.045867 system_key.go:129: cannot determine nfs usage in generateSystemKey: cannot parse /etc/fstab: expected between 3 and 6 fields, found 8
Trying display: drm
libva info: VA-API version 1.19.0
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_19
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.19 (libva 2.19.0)
vainfo: Driver version: Mesa Gallium driver 23.2.0 for AMD Radeon Graphics (rembrandt, LLVM 13.0.1, DRM 3.42, 5.15.0-88-generic)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      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

Code:
sudo docker exec -it jellyfin /usr/lib/jellyfin-ffmpeg/ffmpeg -v debug -init_hw_device opencl

2023/11/04 19:56:50.295363 system_key.go:129: cannot determine nfs usage in generateSystemKey: cannot parse /etc/fstab: expected between 3 and 6 fields, found 8
ffmpeg version 5.1.3-Jellyfin Copyright (c) 2000-2022 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
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 'opencl'.
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 opencl.
[AVHWDeviceContext @ 0x557d9aa4e180] Failed to get number of OpenCL platforms: -1001.
Device creation failed: -19.
Failed to set value 'opencl' for option 'init_hw_device': No such device
Error parsing global options: No such device

Code:
sudo docker exec -it jellyfin /usr/lib/jellyfin-ffmpeg/ffmpeg -v debug -init_hw_device vulkan
2023/11/04 19:57:41.604262 system_key.go:129: cannot determine nfs usage in generateSystemKey: cannot parse /etc/fstab: expected between 3 and 6 fields, found 8
ffmpeg version 5.1.3-Jellyfin Copyright (c) 2000-2022 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
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 'vulkan'.
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 vulkan.
[AVHWDeviceContext @ 0x55758bd61180] Supported validation layers:
[AVHWDeviceContext @ 0x55758bd61180]    VK_LAYER_MESA_device_select
[AVHWDeviceContext @ 0x55758bd61180]    VK_LAYER_MESA_overlay
[AVHWDeviceContext @ 0x55758bd61180] GPU listing:
[AVHWDeviceContext @ 0x55758bd61180]     0: AMD Radeon Graphics (RADV REMBRANDT) (integrated) (0x1681)
[AVHWDeviceContext @ 0x55758bd61180] Device 0 selected: AMD Radeon Graphics (RADV REMBRANDT) (integrated) (0x1681)
[AVHWDeviceContext @ 0x55758bd61180] Queue families:
[AVHWDeviceContext @ 0x55758bd61180]     0: graphics compute transfer sparse (queues: 1)
[AVHWDeviceContext @ 0x55758bd61180]     1: compute transfer sparse (queues: 4)
[AVHWDeviceContext @ 0x55758bd61180] Using device extension VK_KHR_push_descriptor
[AVHWDeviceContext @ 0x55758bd61180] Using device extension VK_KHR_sampler_ycbcr_conversion
[AVHWDeviceContext @ 0x55758bd61180] Using device extension VK_KHR_synchronization2
[AVHWDeviceContext @ 0x55758bd61180] Using device extension VK_KHR_external_memory_fd
[AVHWDeviceContext @ 0x55758bd61180] Using device extension VK_EXT_external_memory_dma_buf
[AVHWDeviceContext @ 0x55758bd61180] Using device extension VK_EXT_image_drm_format_modifier
[AVHWDeviceContext @ 0x55758bd61180] Using device extension VK_KHR_external_semaphore_fd
[AVHWDeviceContext @ 0x55758bd61180] Using device extension VK_EXT_external_memory_host
[AVHWDeviceContext @ 0x55758bd61180] Using device: AMD Radeon Graphics (RADV REMBRANDT)
[AVHWDeviceContext @ 0x55758bd61180] Alignments:
[AVHWDeviceContext @ 0x55758bd61180]     optimalBufferCopyRowPitchAlignment: 1
[AVHWDeviceContext @ 0x55758bd61180]     minMemoryMapAlignment:              4096
[AVHWDeviceContext @ 0x55758bd61180]     minImportedHostPointerAlignment:    4096
[AVHWDeviceContext @ 0x55758bd61180] Using queue family 0 (queues: 1) for graphics
[AVHWDeviceContext @ 0x55758bd61180] 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'

What am I doing wrong?


RE: Jellyfin + AMD + Docker? - TheDreadPirate - 2023-11-05

I'm assuming you followed our AMD guide?

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

Particularly this part.

Quote:Get into the Docker container and install the ROCm OpenCL runtime
Code:
sudo docker exec -u root -it jellyfin bash
apt update && apt install -y curl gpg
mkdir -p /etc/apt/keyrings
curl -fsSL https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor -o /etc/apt/keyrings/rocm.gpg
cat <<EOF | tee /etc/apt/sources.list.d/rocm.sources
Types: deb
URIs: https://repo.radeon.com/rocm/apt/latest
Suites: ubuntu
Components: main
Architectures: amd64
Signed-By: /etc/apt/keyrings/rocm.gpg
EOF
apt update && apt install -y rocm-opencl-runtime
exit