how to set up jellyfin with podman and selinux and an intel gpu (a380) for transcoding?

I try to follow the docs but somehow it doesn’t work as expected. How does your compose file look and what to choose in the settings?

My current setup: (Not working)


<span style="color:#323232;">services:
</span><span style="color:#323232;">  # original source: https://jellyfin.org/docs/general/installation/container/
</span><span style="color:#323232;">  jellyfin:
</span><span style="color:#323232;">    image: docker.io/jellyfin/jellyfin:latest
</span><span style="color:#323232;">    container_name: jellyfin
</span><span style="color:#323232;">    environment:
</span><span style="color:#323232;">      - PUID=1000
</span><span style="color:#323232;">      - PGID=1000
</span><span style="color:#323232;">      - TZ=Europe/Berlin
</span><span style="color:#323232;">      - JELLYFIN_PublishedServerUrl=https://my.url
</span><span style="color:#323232;">    volumes:
</span><span style="color:#323232;">      - ./config:/config:Z
</span><span style="color:#323232;">      - ./cache:/cache:Z
</span><span style="color:#323232;">      - ./media:/media:rw
</span><span style="color:#323232;">    ports:
</span><span style="color:#323232;">      - 8096:8096
</span><span style="color:#323232;"># no need for https since reverse proxy and no local discovery
</span><span style="color:#323232;">    restart: always
</span><span style="color:#323232;">    device:
</span><span style="color:#323232;">      - /dev/dri/:/dev/dri/:Z
</span><span style="color:#323232;">      - /dev/dri/renderD128:/dev/dri/renderD128:Z
</span><span style="color:#323232;">    group-add:
</span><span style="color:#323232;">      - 105
</span><span style="color:#323232;">    privileged: true
</span>

I do not want a privileged container but I’m experimenting.

  • VAAPI is selected
  • VA-API device: is set to /dev/dri/renderD128
  • enable hardware decoding for : H264, HEVC, HEVC 10bit and VP9 10 bit
  • enable hardware encoding
  • allow encoding in HEVC

to get the group I ran getent group render | cut -d: -f3 on the host which returned 105.


<span style="color:#323232;">$ podman exec -it jellyfin /usr/lib/jellyfin-ffmpeg/vainfo
</span><span style="color:#323232;">Trying display: drm
</span><span style="color:#323232;">libva info: VA-API version 1.21.0
</span><span style="color:#323232;">libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
</span><span style="color:#323232;">libva info: Found init function __vaDriverInit_1_21
</span><span style="color:#323232;">libva info: va_openDriver() returns 0
</span><span style="color:#323232;">vainfo: VA-API version: 1.21 (libva 2.21.0)
</span><span style="color:#323232;">vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 24.2.1 (0593864)
</span><span style="color:#323232;">vainfo: Supported profile and entrypoints
</span>

This command returns VA-API does that mean I can only (or I should) select this method? Or is QSV also possible? What’s better?


<span style="color:#323232;">podman exec -it jellyfin /usr/lib/jellyfin-ffmpeg/ffmpeg -v verbose -init_hw_device vaapi=va -init_hw_device opencl@va
</span><span style="color:#323232;">ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
</span><span style="color:#323232;">  built with gcc 12 (Debian 12.2.0-14)
</span><span style="color:#323232;">  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
</span><span style="color:#323232;">  libavutil      58.  2.100 / 58.  2.100
</span><span style="color:#323232;">  libavcodec     60.  3.100 / 60.  3.100
</span><span style="color:#323232;">  libavformat    60.  3.100 / 60.  3.100
</span><span style="color:#323232;">  libavdevice    60.  1.100 / 60.  1.100
</span><span style="color:#323232;">  libavfilter     9.  3.100 /  9.  3.100
</span><span style="color:#323232;">  libswscale      7.  1.100 /  7.  1.100
</span><span style="color:#323232;">  libswresample   4. 10.100 /  4. 10.100
</span><span style="color:#323232;">  libpostproc    57.  1.100 / 57.  1.100
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55ef07507480] Trying to use DRM render node for device 0.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55ef07507480] libva: VA-API version 1.21.0
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55ef07507480] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55ef07507480] libva: Found init function __vaDriverInit_1_21
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55ef07507480] libva: va_openDriver() returns 0
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55ef07507480] Initialised VAAPI connection: version 1.21
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55ef07507480] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 24.2.1 (0593864).
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55ef07507480] Driver not found in known nonstandard list, using standard behaviour.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55ef07538b40] Failed to get number of OpenCL platforms: -1001.
</span><span style="color:#323232;">Device creation failed: -19.
</span><span style="color:#323232;">Failed to set value 'opencl@va' for option 'init_hw_device': No such device
</span><span style="color:#323232;">Error parsing global options: No such device
</span>

within the container:


<span style="color:#323232;"># ls -l /dev/dri
</span><span style="color:#323232;">total 0
</span><span style="color:#323232;">crw-rw----+ 1 nobody nogroup 226,   1 May 17 13:22 card1
</span><span style="color:#323232;">crw-rw-rw-. 1 nobody nogroup 226, 128 May 17 13:22 renderD128
</span><span style="color:#323232;"># whoami
</span><span style="color:#323232;">root
</span><span style="color:#323232;"># 
</span>

<span style="color:#323232;">$ getsebool container_use_dri_devices
</span><span style="color:#323232;">container_use_dri_devices --> on
</span>

<span style="color:#323232;">$ sudo lshw -c video | grep driver
</span><span style="color:#323232;">       configuration: driver=i915 latency=0
</span>

if privileged is set to false:


<span style="color:#323232;">$ podman exec -u root -it jellyfin /usr/lib/jellyfin-ffmpeg/ffmpeg -v debug -init_hw_device Device creation failed: -2.
</span><span style="color:#323232;">Failed to set value 'drm=dr:/dev/dri/renderD128' for option 'init_hw_device': No such file or directory
</span><span style="color:#323232;">Error parsing global options: No such file or directory
</span>

if privileged is true.


<span style="color:#323232;">$ podman exec -u root -it jellyfin /usr/lib/jellyfin-ffmpeg/ffmpeg -v debug -init_hw_device drm=dr:/dev/dri/renderD128 -init_hw_device vaapi=va@dr
</span><span style="color:#323232;">ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
</span><span style="color:#323232;">  built with gcc 12 (Debian 12.2.0-14)
</span><span style="color:#323232;">  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
</span><span style="color:#323232;">  libavutil      58.  2.100 / 58.  2.100
</span><span style="color:#323232;">  libavcodec     60.  3.100 / 60.  3.100
</span><span style="color:#323232;">  libavformat    60.  3.100 / 60.  3.100
</span><span style="color:#323232;">  libavdevice    60.  1.100 / 60.  1.100
</span><span style="color:#323232;">  libavfilter     9.  3.100 /  9.  3.100
</span><span style="color:#323232;">  libswscale      7.  1.100 /  7.  1.100
</span><span style="color:#323232;">  libswresample   4. 10.100 /  4. 10.100
</span><span style="color:#323232;">  libpostproc    57.  1.100 / 57.  1.100
</span><span style="color:#323232;">Splitting the commandline.
</span><span style="color:#323232;">Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
</span><span style="color:#323232;">Reading option '-init_hw_device' ... matched as option 'init_hw_device' (initialise hardware device) with argument 'drm=dr:/dev/dri/renderD128'.
</span><span style="color:#323232;">Reading option '-init_hw_device' ... matched as option 'init_hw_device' (initialise hardware device) with argument 'vaapi=va@dr'.
</span><span style="color:#323232;">Finished splitting the commandline.
</span><span style="color:#323232;">Parsing a group of options: global .
</span><span style="color:#323232;">Applying option v (set logging level) with argument debug.
</span><span style="color:#323232;">Applying option init_hw_device (initialise hardware device) with argument drm=dr:/dev/dri/renderD128.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b480] Opened DRM device /dev/dri/renderD128: driver i915 version 1.6.0.
</span><span style="color:#323232;">Applying option init_hw_device (initialise hardware device) with argument vaapi=va@dr.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] libva: VA-API version 1.21.0
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] libva: Found init function __vaDriverInit_1_21
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] libva: va_openDriver() returns 0
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Initialised VAAPI connection: version 1.21
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x41524742 -> bgra.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x42475241 -> argb.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x41424752 -> rgba.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x52474241 -> abgr.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x58524742 -> bgr0.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x42475258 -> 0rgb.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x58424752 -> rgb0.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x52474258 -> 0bgr.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x30335241 -> unknown.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x30334241 -> unknown.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x30335258 -> x2rgb10le.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x30334258 -> x2bgr10le.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x36314752 -> unknown.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x56555941 -> unknown.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x56555958 -> vuyx.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x30303859 -> gray.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x3231564e -> nv12.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x3132564e -> unknown.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x32595559 -> yuyv422.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x59565955 -> uyvy422.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x32315659 -> yuv420p.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x30323449 -> yuv420p.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x50313134 -> yuv411p.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x48323234 -> yuv422p.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x56323234 -> yuv440p.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x50343434 -> yuv444p.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x33434d49 -> unknown.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x30313050 -> p010le.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x32313050 -> p012le.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x36313050 -> unknown.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x30313259 -> y210le.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x32313259 -> y212le.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x36313259 -> unknown.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x30313459 -> xv30le.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x32313459 -> xv36le.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x36313459 -> unknown.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x50424752 -> unknown.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Format 0x50524742 -> unknown.
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 24.2.1 (0593864).
</span><span style="color:#323232;">[AVHWDeviceContext @ 0x55e56e90b8c0] Driver not found in known nonstandard list, using standard behaviour.
</span><span style="color:#323232;">Successfully parsed a group of options.
</span><span style="color:#323232;">Hyper fast Audio and Video encoder
</span><span style="color:#323232;">usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
</span>
possiblylinux127,

First add your user to the video and render groups. Additionally, set the pass through to /dev/dri/renderD128:/dev/DRI/renderD128

Another thing, I do not believe that podman compose is well maintained or stable. I would use podman from the command line.

In order for me to get transcoding working I had to have a window manager running. I also had to set Jellyfin to only try to transcode in supported formats.

JustEnoughDucks, (edited )
@JustEnoughDucks@feddit.nl avatar

Are you absolutely sure that you have the i915 firmware installed and enabled?

If you have gone through these steps of adding the modules: jellyfin.org/docs/general/…/intel/-power-enco…

and it doesn’t work, you may have to manually download the git linux firmware library, extract the i915 folder and place it in your firmware folder.

That is how I got jellyfin working on my A380 after pulling my hair out about it.

Please check and post your dmesg starting up.

You should see GUC and HUC enabling.

h3ndrik, (edited )

Have you tried verifying it’s not the group permissions? You could preliminarily temporarily set permissions with chmod 666 /dev/dri/render128

My older Skylake processor has a bit worse video quality (occasional artifacts) with QuicSync.

swooosh,

chmod 666 /dev/dri/render128

thx, it does not change anything.

h3ndrik, (edited )

Hmm. I mean now reading your first output in privileged mode properly, I don’t see any errors, or am I missing something… Seems it loaded vaapi sucessfully?!

swooosh,

I should not need to run a container in privileged mode. What’s the container good for then?

Yes, there is no error, yet I was not able to transcode. I had rranscode to x265 and av1 enabled. Ever since disabling av1 it works, yet I have to check again. Meaning, probably the problem was that it tried to encode to av1 and that failed. Yet I still need to run it in privileged mode.

h3ndrik, (edited )

Hmm. I wasn’t trying to recommend privileged or non-privileged mode, just trying to use that to single in on the actual issue.

Alright, if it’s just av1, maybe try to use a tool like vainfo to find the supported codecs. I think ffmpeg fails if an unsupported codec is explicitly specified. But take care if Encoding is mentioned. Some hardware has decoding capabilities only.

It’s a complicated topic. And it also took me 2 whole evenings to get the permissions and everything right. I’m using systemd-nspawn, so my experience doesn’t directly translate. And it’s not any easier than docker.

For video acceleration I found the Arch wiki somewhat helpful. But it’s lots of info and not specific to Docker. Maybe it helps anyways: wiki.archlinux.org/…/Hardware_video_acceleration

possiblylinux127,

Do not use 666 as that is completely open permissions. The proper way is to add your user to the render group.

oakcroissant,

I believe you want to use QSV (VAAPI is there for older processors IIRC).

For running as rootless, you could try adding group-add keep-groups (an explanation from Redhat about keep-groups).

swooosh,

group-add keep-groups

thx, it does not change anything.,

exu,

VAAPI is the “standard” interface for hardware en-/decoding on Linux. It should work with any GPU using the open source drivers and mesa.

I don’t know how QSV can be installed; AMF, the AMD equivalent, is limited to their proprietary driver.

oakcroissant,

I think VAAPI is still how the gpu is accessed but you can use the intel libva driver (vaapi) or the intel media driver (QSV) (arch wiki page). If I’m interpreting this all correctly.

possiblylinux127,

I have found that VAAPI works better and doesn’t have issues.

Kekin,
@Kekin@lemy.lol avatar

I can speak at least for rootless podman, I spent some hours on it and different ways I tried all ended in permission issues.

I gave up on trying to do it properly and just set the permissions of the /dev/dri device to 666, so that my podman container can use the gpu for transcoding.

Part of the issue with the container images that I tried is that they create a new user with whatever uid:gid I pass to the container, and so even if my nonroot user is part of the render group, the new user inside the container is not and so it can’t write to the /dev/dri/renderD128 (gpu), and so transcode wouldn’t work.

That’s where I left the troubleshooting at cause it was being a headache

herrfrutti, (edited )

I recommend this: https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html#method-1-give-your-user-permissions-on-every-reboot

with that and also read the tipp after that I was troubleshooting my permission issues.

This should apply to gpu too.

swooosh,

thx for sharing your experience with it

possiblylinux127,

Just add your local user to the render group.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • selfhosted@lemmy.world
  • DreamBathrooms
  • mdbf
  • ngwrru68w68
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • osvaldo12
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • InstantRegret
  • tacticalgear
  • anitta
  • ethstaker
  • modclub
  • cisconetworking
  • tester
  • GTA5RPClips
  • cubers
  • everett
  • megavids
  • provamag3
  • normalnudes
  • Leos
  • JUstTest
  • lostlight
  • All magazines