Upgrade intel-media-driver used by transcoder to support Battlemage GPUs

Server Version#: 1.41.4.9463
Player Version#: N/A

Component Type
Motherboard ASUS ROG Strix x470-F
CPU AMD Ryzen 5 3600
GPU ASRock Intel B570
Manner of Plex Installation Docker
Host Kernel 6.13.2 and 6.12.13 (tested separately)
Host GPU Driver xe (i915 is not supported for Battlemage) as per Supported Hardware — Intel® software for general purpose GPU capabilities documentation

The drm device is present in /dev/dri and accessible to all users:

$ ls -l /dev/dri
total 0
drwxrwxrwx 2 root root         80 Feb 18 16:02 by-path
crwxrwxrwx 1 root video  226,   0 Feb 18 21:42 card0
crwxrwxrwx 1 root render 226, 128 Feb 18 16:02 renderD128

The user used for the docker container is dockeruser and is a member of video and render groups:

$ groups dockeruser                                                                                                                                                                                                                                                      
video render elephant docker
$ getent group render | cut -d: -f 3
993
$ getent group video | cut -d: -f 3
91

The relevant part of the docker compose file:

$ grep -A 18 'plex:' /opt/docker/docker-compose.yml
        plex:
                image: plexinc/pms-docker:latest
                network_mode: host
                container_name: plex
                restart: unless-stopped
                volumes:
                        - /mnt/appdata/plex:/config
                        - /mnt/storage:/data
                        - /mnt/veryfaststorage/plex-transcode:/transcode
                group_add:
                        - "91"
                        - "993"
                devices:
                        - /dev/dri:/dev/dri
                environment:
                        - TZ=UTC
                        - PLEX_CLAIM="${PLEX_CLAIM_TOKEN}"
                        - PLEX_UID=${PUID}
                        - PLEX_GID=${PGID}

Running vainfo on the hosts to demonstrate functionality present via the GPU:

$ vainfo 2>/dev/null
Trying display: wayland
Trying display: x11
Trying display: drm
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 24.4.4 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointEncSlice
      VAProfileHEVCMain422_12         : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointEncSlice
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointEncSlice
      VAProfileHEVCMain444_12         : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointEncSlice
      VAProfileHEVCSccMain10          : VAEntrypointVLD
      VAProfileHEVCSccMain10          : VAEntrypointEncSlice
      VAProfileHEVCSccMain444         : VAEntrypointVLD
      VAProfileHEVCSccMain444         : VAEntrypointEncSlice
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileAV1Profile0            : VAEntrypointEncSlice
      VAProfileHEVCSccMain444_10      : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointEncSlice

Hardware acceleration is enabled in Plex:

$ sudo grep -Eo '[a-zA-Z]*(Accelerated|Hardware|Transcode)[a-zA-Z]*="[0-9a-zA-Z]*"' /mnt/appdata/plex/Library/Application\ Support/Plex\ Media\ Server/Preferences.xml
TranscodeCountLimit="0"
TranscoderQuality="0"
HardwareAcceleratedEncoders="1"
HardwareAcceleratedCodecs="1"
TranscoderThrottleBuffer="6000"
TranscoderHEVCEncoding="1"
TranscoderHEVCOptimize="1"

And yet, when I attempt a transcode using Firefox, Chrome, Android, iOS, Shield, Windows client, LG TV client (G3 and C3 models), or PS5 clients (those were all that I tested), I see the following error in the logs:

Feb 20, 2025 22:00:10.297 [140359974996792] Debug — [Req#d12450/Transcode] TranscodeUniversalRequest: using augmented profile Firefox
Feb 20, 2025 22:00:10.297 [140359974996792] Debug — [Req#d12450/Transcode] Downloading document http://127.0.0.1:32400/library/metadata/294701?includeBandwidths=1&offset=-1&X-Plex-Incomplete-Segments=1&X-Plex-Session-Identifier=6oc0cmnqu8hwuoy6zrcthaz9
Feb 20, 2025 22:00:10.300 [140359974996792] Debug — [Req#d12450/Transcode/Req#d12481] It took 0.000000 ms to retrieve 115 items.
Feb 20, 2025 22:00:10.301 [140359974996792] Debug — [Req#d12450/Transcode] We're going to try to auto-select an audio stream for account 1.
Feb 20, 2025 22:00:10.301 [140359974996792] Debug — [Req#d12450/Transcode] Selecting best audio stream for part ID 457754 (language: en)
Feb 20, 2025 22:00:10.301 [140359974996792] Debug — [Req#d12450/Transcode] We're going to try to auto-select a subtitle for account 1.
Feb 20, 2025 22:00:10.301 [140359974996792] Debug — [Req#d12450/Transcode] Subtitles: Found a candidate subtitle language [en] for a foreign film
Feb 20, 2025 22:00:10.301 [140359974996792] Debug — [Req#d12450/Transcode] Audio Stream: 1749177, Subtitle Stream: 1749178
Feb 20, 2025 22:00:10.303 [140359974996792] Debug — [Req#d12450/Transcode] Codecs: testing hevc (decoder) with hwdevice vaapi
Feb 20, 2025 22:00:10.306 [140359974996792] Debug — [Req#d12450/Transcode] Codecs: hardware transcoding: testing API vaapi for device '/dev/dri/renderD128' (Intel Battlemage G21 [Intel Graphics])
Feb 20, 2025 22:00:10.315 [140359974996792] Error — [Req#d12450/Transcode] [FFMPEG] - libva: /config/Library/Application Support/Plex Media Server/Cache/va-dri-linux-x86_64/iHD_drv_video.so init failed

Feb 20, 2025 22:00:10.315 [140359974996792] Error — [Req#d12450/Transcode] [FFMPEG] - Failed to initialise VAAPI connection: 18 (invalid parameter).

Feb 20, 2025 22:00:10.315 [140359974996792] Debug — [Req#d12450/Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: I/O error
Feb 20, 2025 22:00:10.315 [140359974996792] Debug — [Req#d12450/Transcode] Could not create hardware context for hevc
Feb 20, 2025 22:00:10.315 [140359974996792] Debug — [Req#d12450/Transcode] MDE: Selected protocol dash; container: mp4
Feb 20, 2025 22:00:10.315 [140359974996792] Debug — [Req#d12450/Transcode] MDE: analyzing media item 425762
Feb 20, 2025 22:00:10.315 [140359974996792] Debug — [Req#d12450/Transcode] MDE: Companion (2025): Direct Play is disabled
Feb 20, 2025 22:00:10.315 [140359974996792] Debug — [Req#d12450/Transcode] MDE: Companion (2025): media must be transcoded in order to use the dash protocol
Feb 20, 2025 22:00:10.315 [140359974996792] Debug — [Req#d12450/Transcode] MDE: Companion (2025): no direct play video profile exists for http/mkv/hevc
Feb 20, 2025 22:00:10.315 [140359974996792] Debug — [Req#d12450/Transcode] MDE: Companion (2025): no direct play video profile exists for http/mkv/hevc/eac3
Feb 20, 2025 22:00:10.315 [140359974996792] Debug — [Req#d12450/Transcode] Companion - video.bitDepth limitation applies: 10 > 8
Feb 20, 2025 22:00:10.315 [140359974996792] Debug — [Req#d12450/Transcode] Companion - audio.channels limitation applies: 6 > 2
Feb 20, 2025 22:00:10.315 [140359974996792] Debug — [Req#d12450/Transcode] MDE: Companion (2025): Direct Streaming is disabled, so video stream will be transcoded
Feb 20, 2025 22:00:10.315 [140359974996792] Debug — [Req#d12450/Transcode] MDE: Companion (2025): no remuxable profile found, so video stream will be transcoded
Feb 20, 2025 22:00:10.315 [140359974996792] Debug — [Req#d12450/Transcode] MDE: Cannot direct stream video stream due to profile or setting limitations
Feb 20, 2025 22:00:10.316 [140359974996792] Debug — [Req#d12450/Transcode] Codecs: testing hevc (decoder) with hwdevice vaapi
Feb 20, 2025 22:00:10.316 [140359974996792] Debug — [Req#d12450/Transcode] Codecs: hardware transcoding: testing API vaapi for device '/dev/dri/renderD128' (Intel Battlemage G21 [Intel Graphics])
Feb 20, 2025 22:00:10.316 [140359974996792] Error — [Req#d12450/Transcode] [FFMPEG] - libva: /config/Library/Application Support/Plex Media Server/Cache/va-dri-linux-x86_64/iHD_drv_video.so init failed

Feb 20, 2025 22:00:10.316 [140359974996792] Error — [Req#d12450/Transcode] [FFMPEG] - Failed to initialise VAAPI connection: 18 (invalid parameter).

Feb 20, 2025 22:00:10.316 [140359974996792] Debug — [Req#d12450/Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: I/O error
Feb 20, 2025 22:00:10.316 [140359974996792] Debug — [Req#d12450/Transcode] Could not create hardware context for hevc

Some further investigation; I installed strings within the plex container to do this:

$ docker exec -t plex strings /usr/lib/plexmediaserver/Plex\ Transcoder | grep -Eo 'intel-media-driver/[-\.0-9]+/'
intel-media-driver/24.1.5-3/
intel-media-driver/24.1.5-3/
intel-media-driver/24.1.5-3/
intel-media-driver/24.1.5-3/

It appears that Plex is being built against 24.1.5-3, i.e. Release Intel Media Driver 2024Q1 Release - 24.1.5 · intel/media-driver · GitHub, but Battlemage support was not added until 24.3.4: Release Intel Media Driver 2024Q3 Release - 24.3.4 · intel/media-driver · GitHub.

I suspect that this is the crux (or maybe the beginning) of the issue I am experiencing, and somewhat confirmed by checking against Jellyfin, which is configured similarly in docker and has hardware transcoding working fine. Please upgrade the intel-media-driver version used when building Plex Transcoder in order to add this support (and, perhaps, intel-compute-runtime, if any OpenCL functions are used for e.g. tonemapping, though this should be available tonemapping should be available for Intel via the VPP features in the driver).

Thanks

See this thread:

Ack, good to know the transcoder rebuild is in progress and nearly complete.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.