Created
January 19, 2026 08:31
-
-
Save hyspace/626b6d1500ac96bf70362858aa3d0764 to your computer and use it in GitHub Desktop.
Dockerfile for homebridge - ffmpeg with hardware video encoding/decoding for rockchip system
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| services: | |
| homebridge: | |
| build: . | |
| container_name: homebridge | |
| restart: unless-stopped | |
| network_mode: host | |
| volumes: | |
| - /root/volumes/homebridge:/homebridge | |
| devices: | |
| - /dev/mpp_service:/dev/mpp_service | |
| - /dev/rga:/dev/rga | |
| privileged: true # can be replaced by seccomp=unconfined? | |
| #security_opt: | |
| # - seccomp=unconfined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Approach: Copy Binaries from nyanmisaka/jellyfin:latest-rockchip to homebridge/homebridge:latest | |
| FROM nyanmisaka/jellyfin:latest-rockchip AS rk | |
| # Build a self-contained runtime bundle with REAL files (dereferenced symlinks) | |
| RUN set -eux; \ | |
| mkdir -p /out/bin /out/lib; \ | |
| # ffmpeg binary | |
| cp -a /usr/lib/jellyfin-ffmpeg/ffmpeg /out/bin/ffmpeg; \ | |
| # copy all linked shared libs (dereference), but exclude glibc/loader | |
| ldd /usr/lib/jellyfin-ffmpeg/ffmpeg \ | |
| | awk '{print $3}' \ | |
| | grep -E '^/' \ | |
| | grep -vE '/(ld-linux|libc\.so|libm\.so|libpthread\.so|librt\.so|libdl\.so)\.' \ | |
| | sort -u \ | |
| | xargs -r -I{} sh -lc 'cp -Lv "{}" /out/lib/'; \ | |
| # add Rockchip userspace libs (dereference if symlinks) | |
| for f in \ | |
| /usr/lib/aarch64-linux-gnu/librga.so* \ | |
| /usr/lib/aarch64-linux-gnu/librockchip_mpp.so* \ | |
| /usr/lib/aarch64-linux-gnu/libmpp.so* \ | |
| ; do \ | |
| if ls $f >/dev/null 2>&1; then cp -Lv $f /out/lib/; fi; \ | |
| done | |
| FROM homebridge/homebridge:latest | |
| USER root | |
| # Install only OS-provided deps we intentionally do NOT bundle (keep minimal) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ca-certificates \ | |
| libdrm2 \ | |
| ocl-icd-libopencl1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy the prepared bundle | |
| RUN mkdir -p /opt/rkffmpeg/bin /opt/rkffmpeg/lib | |
| COPY --from=rk /out/bin/ffmpeg /opt/rkffmpeg/bin/ffmpeg | |
| COPY --from=rk /out/lib/ /opt/rkffmpeg/lib/ | |
| # Stable wrapper for Camera UI | |
| RUN printf '%s\n' \ | |
| '#!/bin/sh' \ | |
| 'export LD_LIBRARY_PATH=/opt/rkffmpeg/lib:${LD_LIBRARY_PATH}' \ | |
| 'exec /opt/rkffmpeg/bin/ffmpeg "$@"' \ | |
| > /usr/local/bin/ffmpeg-rkmpp \ | |
| && chmod +x /usr/local/bin/ffmpeg-rkmpp /opt/rkffmpeg/bin/ffmpeg | |
| # Hard fail at build time if anything is still missing | |
| RUN set -eux; \ | |
| missing="$(LD_LIBRARY_PATH=/opt/rkffmpeg/lib ldd /opt/rkffmpeg/bin/ffmpeg | awk '/not found/{print $1}' || true)"; \ | |
| if [ -n "$missing" ]; then \ | |
| echo "Still missing these shared libs:"; \ | |
| echo "$missing"; \ | |
| exit 1; \ | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment