Skip to content

Commit 0182cd0

Browse files
Use system version of FFmpeg for Resonate (#2577)
1 parent b131dad commit 0182cd0

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ on:
3434
env:
3535
PYTHON_VERSION: "3.12"
3636
BASE_IMAGE_VERSION_STABLE: "1.3.1"
37-
BASE_IMAGE_VERSION_BETA: "1.4.4"
38-
BASE_IMAGE_VERSION_NIGHTLY: "1.4.4"
37+
BASE_IMAGE_VERSION_BETA: "1.4.5"
38+
BASE_IMAGE_VERSION_NIGHTLY: "1.4.5"
3939

4040
jobs:
4141
preflight-checks:

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ COPY requirements_all.txt .
1111
# ensure UV is installed
1212
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
1313

14+
# Install build tools for PyAV compilation (for aioresonate)
15+
RUN apt-get update && apt-get install -y --no-install-recommends \
16+
gcc \
17+
g++ \
18+
python3-dev \
19+
&& rm -rf /var/lib/apt/lists/*
20+
1421
# create venv which will be copied to the final image
1522
ENV VIRTUAL_ENV=/app/venv
1623
RUN uv venv $VIRTUAL_ENV
@@ -21,6 +28,11 @@ RUN uv venv $VIRTUAL_ENV
2128
RUN uv pip install \
2229
-r requirements_all.txt
2330

31+
# Reinstall PyAV from source to use system FFmpeg instead of bundled FFmpeg
32+
# Use the version already resolved by requirements_all.txt to ensure compatibility
33+
RUN uv pip install --no-binary av --force-reinstall --no-deps \
34+
"av==$($VIRTUAL_ENV/bin/python -c 'import importlib.metadata; print(importlib.metadata.version("av"))')"
35+
2436
# Install Music Assistant from prebuilt wheel
2537
ARG MASS_VERSION
2638
RUN uv pip install \

Dockerfile.base

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ RUN set -x \
155155
libflac12 \
156156
libavahi-client3 \
157157
libavahi-common3 \
158+
# pkg-config needed for PyAV (for aioresonate) to find system FFmpeg
159+
pkg-config \
158160
&& apt-get clean \
159161
&& rm -rf /var/lib/apt/lists/*
160162

@@ -179,6 +181,13 @@ COPY --from=ffmpeg-builder /usr/local/lib/libav*.so* /usr/local/lib/
179181
COPY --from=ffmpeg-builder /usr/local/lib/libsw*.so* /usr/local/lib/
180182
COPY --from=ffmpeg-builder /usr/local/lib/libpostproc.so* /usr/local/lib/
181183

184+
# Copy FFmpeg headers and pkg-config files needed for PyAV compilation (adds around 2 MB)
185+
COPY --from=ffmpeg-builder /usr/local/include/ /usr/local/include/
186+
COPY --from=ffmpeg-builder /usr/local/lib/pkgconfig/ /usr/local/lib/pkgconfig/
187+
188+
# Set PKG_CONFIG_PATH so pkg-config can find FFmpeg
189+
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
190+
182191
# Update shared library cache and verify FFmpeg
183192
RUN ldconfig && ffmpeg -version && ffprobe -version
184193

0 commit comments

Comments
 (0)