├── .github └── workflows │ └── docker-publish.yml ├── Dockerfile ├── README.md └── run /.github/workflows/docker-publish.yml: -------------------------------------------------------------------------------- 1 | name: Docker 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | 8 | jobs: 9 | docker: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - 13 | name: Set up QEMU 14 | uses: docker/setup-qemu-action@v2 15 | - 16 | name: Set up Docker Buildx 17 | uses: docker/setup-buildx-action@v2 18 | # - 19 | # name: Login to Docker Hub 20 | # uses: docker/login-action@v2 21 | # with: 22 | # username: ${{ secrets.DOCKERHUB_USERNAME }} 23 | # password: ${{ secrets.DOCKERHUB_TOKEN }} 24 | - 25 | name: Login to GitHub Container Registry 26 | uses: docker/login-action@v2 27 | with: 28 | registry: ghcr.io 29 | username: ${{ github.repository_owner }} 30 | password: ${{ secrets.GITHUB_TOKEN }} 31 | - 32 | name: Build and push 33 | uses: docker/build-push-action@v4 34 | with: 35 | push: true 36 | tags: | 37 | ghcr.io/${{ github.repository }}:dev 38 | ghcr.io/${{ github.repository }}:${{ github.run_number }} 39 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:edge AS source 2 | 3 | RUN apk add mesa-va-gallium --no-cache --update-cache 4 | 5 | RUN mkdir -p "/source/vaapi-amdgpu/lib/dri" \ 6 | && cp -a /usr/lib/dri/*.so /source/vaapi-amdgpu/lib/dri \ 7 | && cd /lib \ 8 | && cp -a \ 9 | ld-musl-x86_64.so.1* \ 10 | libc.musl-x86_64.so.1* \ 11 | libz.so.1* \ 12 | /source/vaapi-amdgpu/lib \ 13 | && cd /usr/lib \ 14 | && cp -a \ 15 | libLLVM-15*.so* \ 16 | libX11-xcb.so.1* \ 17 | libXau.so.6* \ 18 | libXdmcp.so.6* \ 19 | libdrm.so.2* \ 20 | libdrm_amdgpu.so.1* \ 21 | libdrm_nouveau.so.2* \ 22 | libdrm_radeon.so.1* \ 23 | libelf-*.so* \ 24 | libelf.so.1* \ 25 | libexpat.so.1* \ 26 | libgcc_s.so.1* \ 27 | libstdc++.so.6* \ 28 | libva-drm.so.2* \ 29 | libva.so.2* \ 30 | libxcb-dri2.so.0* \ 31 | libxcb-dri3.so.0* \ 32 | libxcb-present.so.0* \ 33 | libxcb-sync.so.1* \ 34 | libxcb-xfixes.so.0* \ 35 | libxcb.so.1* \ 36 | libxml2.so.2* \ 37 | libxshmfence.so.1* \ 38 | libbsd.so.0* \ 39 | libmd.so.0* \ 40 | libzstd.so.1* \ 41 | libffi.so.8* \ 42 | liblzma.so.5* \ 43 | /source/vaapi-amdgpu/lib \ 44 | && mkdir -p /source/usr/share/libdrm \ 45 | && cp -a /usr/share/libdrm/amdgpu.ids /source/usr/share/libdrm/ \ 46 | && mkdir -p /source/etc/s6-overlay/s6-rc.d/svc-plex/ 47 | 48 | COPY run /source/etc/s6-overlay/s6-rc.d/svc-plex/ 49 | 50 | FROM scratch 51 | 52 | #ENV LIBVA_DRIVERS_PATH="/vaapi-amdgpu/lib/dri" \ 53 | 54 | COPY --from=source "/source/" "/" 55 | 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This is a [linuxserver.io user mod](https://github.com/linuxserver/docker-mods) to enable hardware acceleration using vaapi amdgpu for [linuxserver.io' Plex Media Server image](https://docs.linuxserver.io/images/docker-plex). 2 | 3 | Librairies are taken from package [mesa-va-gallium](https://pkgs.alpinelinux.org/package/edge/main/x86/mesa-va-gallium) of alpine:edge because Plex is compiled with musl and using Ubuntu libs will lead to unresolved symbols. 4 | 5 | Librairies are voluntarily located outside of plexmediaserver path, in `/vaapi-amdgpu/lib`. This allows to use `VERSION=latest` so Plex can automatically updates its version, without replacing the provided librairies. 6 | 7 | Set the `DOCKER_MODS` environment variable to `jefflessard/plex-vaapi-amdgpu-mod` such as in the example below. 8 | 9 | 10 | Usage example : 11 | 12 | ``` 13 | docker run -d \ 14 | --device /dev/dri/ \ 15 | -e DOCKER_MODS=jefflessard/plex-vaapi-amdgpu-mod \ 16 | -e VERSION=latest \ 17 | ... 18 | --name plex \ 19 | linuxserver/plex 20 | ``` 21 | 22 | Defining LD_LIBRARY_PATH and LIBVA_DRIVERS_PATH is not required anymore. They are now exported in s6 svc-plex run command. 23 | 24 | 25 | **You now need to remove `-e LD_LIBRARY_PATH=...` from your docker run command.** 26 | 27 | 28 | 29 | 30 | To quickly check if hardware acceleration is working, run the following and check for vaapi errors. 31 | ``` 32 | docker exec -it -e LIBVA_DRIVERS_PATH=/vaapi-amdgpu/lib/dri -e LD_LIBRARY_PATH=/vaapi-amdgpu/lib plex \ 33 | /lib/plexmediaserver/Plex\ Transcoder -hide_banner -loglevel debug -vaapi_device /dev/dri/renderD128 34 | ``` 35 | 36 | -------------------------------------------------------------------------------- /run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/with-contenv bash 2 | 3 | echo "Starting Plex Media Server. . . (you can ignore the libusb_init error)" 4 | export PLEX_MEDIA_SERVER_INFO_MODEL=$(uname -m) 5 | export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION=$(uname -r) 6 | export LD_LIBRARY_PATH=/vaapi-amdgpu/lib 7 | export LIBVA_DRIVERS_PATH=/vaapi-amdgpu/lib/dri 8 | exec \ 9 | s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 32400" \ 10 | s6-setuidgid abc "/usr/lib/plexmediaserver/Plex Media Server" 11 | --------------------------------------------------------------------------------