Use system version of FFmpeg for Resonate (#2577)
authorMaxim Raznatovski <nda.mr43@gmail.com>
Fri, 31 Oct 2025 10:14:23 +0000 (11:14 +0100)
committerGitHub <noreply@github.com>
Fri, 31 Oct 2025 10:14:23 +0000 (11:14 +0100)
.github/workflows/release.yml
Dockerfile
Dockerfile.base

index 84507c79197b121c6e6d45f790e6c526ef9e7a38..1899c2c59236db6d8d874afa6baee8cedca97d98 100644 (file)
@@ -34,8 +34,8 @@ on:
 env:
   PYTHON_VERSION: "3.12"
   BASE_IMAGE_VERSION_STABLE: "1.3.1"
-  BASE_IMAGE_VERSION_BETA: "1.4.4"
-  BASE_IMAGE_VERSION_NIGHTLY: "1.4.4"
+  BASE_IMAGE_VERSION_BETA: "1.4.5"
+  BASE_IMAGE_VERSION_NIGHTLY: "1.4.5"
 
 jobs:
   preflight-checks:
index a52dd3ed19955d539484c4f7abd63692e7d95936..d5a007c993057143fe6df2830410fe88d4545a5c 100644 (file)
@@ -11,6 +11,13 @@ COPY requirements_all.txt .
 # ensure UV is installed
 COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
 
+# Install build tools for PyAV compilation (for aioresonate)
+RUN apt-get update && apt-get install -y --no-install-recommends \
+    gcc \
+    g++ \
+    python3-dev \
+    && rm -rf /var/lib/apt/lists/*
+
 # create venv which will be copied to the final image
 ENV VIRTUAL_ENV=/app/venv
 RUN uv venv $VIRTUAL_ENV
@@ -21,6 +28,11 @@ RUN uv venv $VIRTUAL_ENV
 RUN uv pip install \
     -r requirements_all.txt
 
+# Reinstall PyAV from source to use system FFmpeg instead of bundled FFmpeg
+# Use the version already resolved by requirements_all.txt to ensure compatibility
+RUN uv pip install --no-binary av --force-reinstall --no-deps \
+    "av==$($VIRTUAL_ENV/bin/python -c 'import importlib.metadata; print(importlib.metadata.version("av"))')"
+
 # Install Music Assistant from prebuilt wheel
 ARG MASS_VERSION
 RUN uv pip install \
index 93456516a0e60192dbd63b868c5f839ff7d2fa70..ead2079e52a67c6d03a9e0c0337c12890148795b 100644 (file)
@@ -155,6 +155,8 @@ RUN set -x \
         libflac12 \
         libavahi-client3 \
         libavahi-common3 \
+        # pkg-config needed for PyAV (for aioresonate) to find system FFmpeg
+        pkg-config \
     && apt-get clean \
     && rm -rf /var/lib/apt/lists/*
 
@@ -179,6 +181,13 @@ COPY --from=ffmpeg-builder /usr/local/lib/libav*.so* /usr/local/lib/
 COPY --from=ffmpeg-builder /usr/local/lib/libsw*.so* /usr/local/lib/
 COPY --from=ffmpeg-builder /usr/local/lib/libpostproc.so* /usr/local/lib/
 
+# Copy FFmpeg headers and pkg-config files needed for PyAV compilation (adds around 2 MB)
+COPY --from=ffmpeg-builder /usr/local/include/ /usr/local/include/
+COPY --from=ffmpeg-builder /usr/local/lib/pkgconfig/ /usr/local/lib/pkgconfig/
+
+# Set PKG_CONFIG_PATH so pkg-config can find FFmpeg
+ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
+
 # Update shared library cache and verify FFmpeg
 RUN ldconfig && ffmpeg -version && ffprobe -version