Fork of jefflessard/plex-vaapi-amdgpu-mod — full credit to jefflessard for the original mod and approach.
linuxserver.io mod that adds AMD amdgpu hardware VAAPI transcoding to the linuxserver.io Plex Media Server image.
About this fork: the updated-engine changes here are maintained by jollyroger1480; the original mod is jefflessard's. Free to use. If this fork saved you time, tips are welcome: Cash App or Bitcoin bc1qydycnf5pjhez5d0mrgmmumyv2g5nc63mwet89j. More links at the bottom.
Upstream's published Docker Hub image (jefflessard/plex-vaapi-amdgpu-mod) is frozen at ~2023-03 — Mesa 22.3 / libva 2.17 / LLVM 15 — even though the Dockerfile builds from alpine:edge (the published image just wasn't rebuilt). This fork rebuilds against current alpine:edge (2026-11-18 build = Mesa 26.3.0 / libva 2.24.1 / LLVM 23.1 / libdrm 2.4.134 / ACO) and fixes the library copy list for modern Mesa.
The libraries come from the mesa-va-gallium package on alpine:edge (musl). They are kept isolated in /vaapi-amdgpu/lib so they never overwrite the Ubuntu/glibc libraries that ship with plexmediaserver — the same approach as upstream, with VERSION=latest Plex images.
Each of these was a silent failure on modern Mesa (Plex logs
[FFMPEG] Failed to initialise VAAPI connection: -1 (unknown libva error)
and quietly falls back to software, 1000%+ CPU):
| Change | Why |
|---|---|
libLLVM-15* → libLLVM* |
LLVM soname changed (now libLLVM.so.23.1) |
add libgallium* |
Mesa 23.3+: radeonsi is a stub that dlopens libgallium-*.so |
add libSPIRV-Tools.so* |
Mesa 24+: shader compiler, runtime dlopen |
add libxcb-randr.so.0* |
newer stack dlopens it at runtime |
libz.so.1* from /usr/lib |
moved out of /lib in current Alpine edge |
libelf* (broadened glob) |
covers libelf-<ver>.so + libelf.so.1 |
add libdrm_intel.so.1* + libpciaccess.so.0* |
Mesa 26.3: libgallium now links libdrm_intel. Without them in the bundle the driver only loads by borrowing Plex's own older copies |
Deliberately NOT changed: the runtime libva API stays whatever mesa-va-gallium pulls on Alpine edge, and the copy list stays curated — do not ldd-copy the full closure, it drags in musl libpcre2/libselinux which shadow glibc libs in the Plex container (via LD_LIBRARY_PATH) and crash Plex at startup.
Verified live 2026-09-11: Plex 1.43.4 (lscr.io/linuxserver/plex:latest), AMD RX 6950 XT (navi21): hardware transcoding: final decoder: vaapi, final encoder: vaapi.
Re-checked 2026-11-18 against Mesa 26.3.0 and Plex 1.43.5.11079 (lscr.io/linuxserver/plex:latest, ls333) on the same RX 6950 XT: every library the VAAPI driver needs resolves inside the bundle, vainfo lists the radeonsi decode and encode profiles (H.264, HEVC, HEVC Main10, VP9, AV1 decode), and Plex's own Plex Transcoder opens the driver and encodes with h264_vaapi.
Verified live 2026-11-18 with a full transcode in a running server: Plex 1.43.5.11079 on its Ubuntu 26.04 base with this engine baked into the image (Mesa 26.2.5, see the last section), same RX 6950 XT. An HEVC film was decoded, scaled and re-encoded to H.264 on the GPU (scale_vaapi, h264_vaapi), and Plex logged hardware transcoding: using zero-copy transcoding and final decoder: vaapi, final encoder: vaapi. The Mesa 26.3.0 bundle had its own full transcode later the same day, in the same baked-in image rebuilt on Mesa 26.3.0: a 4K HDR HEVC film was decoded and re-encoded to H.264 on the GPU, and Plex logged using hardware decode accelerator vaapi and final decoder: vaapi, final encoder: vaapi. HDR tone mapping ran on the CPU in that session (Plex logs not using zero-copy because tone mapping is required), so a 4K HDR-to-SDR conversion is CPU-bound; SDR sources and lower output resolutions are not.
docker run -d \
--device /dev/dri/ \
-e DOCKER_MODS=<this-fork-image> \
-e VERSION=latest \
-e LD_LIBRARY_PATH=/vaapi-amdgpu/lib \
-e LIBVA_DRIVERS_PATH=/vaapi-amdgpu/lib/dri \
--name plex \
linuxserver/plexNote: on recent Plex versions the server resets LIBVA_DRIVERS_PATH for its own spawned transcoders, so setting both env vars explicitly in the container (as above) is more reliable than relying on the mod's s6 svc-plex launcher alone.
Check which GPU the render node maps to first (renderD128 may not be your big card):
for c in card0 card1 card2; do [ -d /sys/class/drm/$c/device ] && \
echo "$c: $(grep PCI_ID /sys/class/drm/$c/device/uevent)"; doneTest the transcoder directly (use the render node of your transcode GPU):
docker exec -it -e LIBVA_DRIVERS_PATH=/vaapi-amdgpu/lib/dri -e LD_LIBRARY_PATH=/vaapi-amdgpu/lib plex \
/usr/lib/plexmediaserver/Plex\ Transcoder -hide_banner -loglevel debug -vaapi_device /dev/dri/renderD128Success in the Plex server log looks like:
hardware transcoding: final decoder: vaapi, final encoder: vaapi
If you see final decoder: , final encoder: (empty) or repeated
Failed to initialise VAAPI connection: -1, Plex fell back to software — a runtime-dlopen'd library is missing from the bundle (historically: libgallium, libSPIRV-Tools.so, libxcb-randr.so.0).
docker build -t <registry>/plex-vaapi-amdgpu-mod:latest .
docker push <registry>/plex-vaapi-amdgpu-modThe engine tracks alpine:edge, so a plain rebuild whenever Mesa releases picks up the new driver.
If you'd rather not use the DOCKER_MODS mechanism at all (one fewer moving part at container start — the mod download can't fail), build your own Plex image with the Mesa stack inside it. This is how this fork's author runs it in production, verified the same day as the mod path.
1. Dockerfile (multi-stage — same curated lib set as the mod, copied straight into the image):
FROM alpine:edge AS mesa
RUN apk add mesa-va-gallium --no-cache --update-cache
RUN mkdir -p /out/lib/dri /out/share/libdrm \
&& cp -a /usr/lib/dri/*.so /out/lib/dri \
&& cp -a /lib/ld-musl-x86_64.so.1* /lib/libc.musl-x86_64.so.1* /out/lib/ \
&& cd /usr/lib \
&& cp -a \
libLLVM* libgallium* libSPIRV-Tools.so* libSPIRV-Tools-shared.so* \
libX11-xcb.so.1* libXau.so.6* libXdmcp.so.6* \
libdrm.so.2* libdrm_amdgpu.so.1* libdrm_intel.so.1* libdrm_nouveau.so.2* libdrm_radeon.so.1* \
libelf* libexpat.so.1* libgcc_s.so.1* libstdc++.so.6* \
libva-drm.so.2* libva.so.2* \
libxcb-dri2.so.0* libxcb-dri3.so.0* libxcb-present.so.0* libxcb-randr.so.0* \
libxcb-sync.so.1* libxcb-xfixes.so.0* libxcb.so.1* \
libxml2.so.2* libxshmfence.so.1* libpciaccess.so.0* libbsd.so.0* libmd.so.0* \
libzstd.so.1* libffi.so.8* liblzma.so.5* libz.so.1* \
/out/lib/ \
&& cp -a /usr/share/libdrm/amdgpu.ids /out/share/libdrm/
FROM lscr.io/linuxserver/plex:latest
COPY --from=mesa /out /vaapi-amdgpu
COPY --from=mesa /out/share/libdrm/amdgpu.ids /usr/share/libdrm/amdgpu.ids2. Build and drop the mod from your run/compose — env vars do the work the mod's launcher used to do:
# docker compose (relevant bits)
services:
plex:
build:
context: .
dockerfile: Dockerfile
image: plex-amdgpu:latest
environment:
- LD_LIBRARY_PATH=/vaapi-amdgpu/lib
- LIBVA_DRIVERS_PATH=/vaapi-amdgpu/lib/dri
# NO DOCKER_MODS line
devices:
- /dev/dri:/dev/dri3. Apply it with a recreate, not a plain restart — docker compose up -d --force-recreate. A plain docker restart keeps the old image and can also lose the compose network.
4. Tag the previous image before rebuilding so rollback is instant:
docker tag plex-amdgpu plex-amdgpu:previous
docker build -t plex-amdgpu . && docker compose up -d --force-recreate
# rollback = re-tag + force-recreate againVerification is identical to the mod path (see Troubleshooting above). Because the engine ships inside the image, an update is: docker build + --force-recreate — no mod download happens at startup.
Even with VAAPI working, Plex tone maps HDR on the CPU. It decodes on the GPU, copies every frame back, runs tonemap=hable in software and uploads the result again. On 4K HDR that is the bottleneck, and it can fall below real time. gpu-tonemap/ is an extra layer on top of the baked image above. It adds Mesa rusticl (OpenCL) and a wrapper around Plex Transcoder that does the tone mapping on the GPU (scale_vaapi + tonemap_opencl).
The wrapper is strict. A job goes to the GPU only when all of these hold:
- the filter graph is exactly Plex's CPU HDR chain
- every input option is one the wrapper knows
- the VAAPI and OpenCL devices work
- no stream is mapped straight from the source file
Every other job, SDR titles included, goes to the real transcoder untouched. In practice, HDR jobs with an embedded MP4 subtitle (mov_text) selected stay on the CPU path.
docker tag plex-amdgpu plex-amdgpu:previous
docker build -t plex-amdgpu-tonemap --build-arg BASE=plex-amdgpu:previous gpu-tonemapPoint compose at plex-amdgpu-tonemap and recreate. Then:
- Off switch (no restart; applies from the next job):
docker exec plex touch /config/gpu-tonemap.disable. Delete the file to turn it back on.PLEX_GPU_TONEMAP=0in the container environment also turns it off. - Log:
/tmp/plex-gpu-tonemap/wrapper.loginside the container shows which path each HDR job took and why. - Rollback: point compose back at
plex-amdgpu:previousand rundocker compose up -d --force-recreate.
Memory cap. The wrapper keeps a bounded queue of raw frames. One 4K HDR session on the GPU path peaked at about 1.3 GiB. A hard cap on the container stops a runaway transcoder from taking the whole host down with it:
services:
plex:
mem_limit: 8g
memswap_limit: 8g # same value as mem_limit = no swap on top of the capTested 2026-11-19 on a Radeon RX 6950 XT (Navi 21), LinuxServer Plex 1.43.5, Mesa 26.3.0 from alpine:edge, with the 8g cap above. The test requested 4K output at 40 Mbps.
- A 4K HDR MKV and a 4K HDR MP4 ran at the same time on the GPU path. The MKV ran at 4–6.5x. The MP4 (3840x2076, 20 Mbps HEVC) kept up at about 1.1x. The container peaked at under 2.6 GiB.
- Both kept working after a seek. Memory stayed flat across a 5.5-minute session.
- An SDR title went through untouched.
- With the off switch on, HDR jobs went back to the CPU path.
- Not tested: other GPUs, real remote clients, and sessions longer than a few minutes.
This fork's updates are free, and a tip is welcome but never expected. Tips go to the fork maintainer, not the upstream author.
- Tip (Cash App): $jollyroger1480
- Bitcoin:
bc1qydycnf5pjhez5d0mrgmmumyv2g5nc63mwet89j - eBay store: Buccaneer Salvage
- YouTube: @BuccaneerSalvage
- X: @jollyroger1480