88permissions :
99 contents : read
1010
11+ env :
12+ FFMPEG_VERSION : " 7.1.1"
13+
1114jobs :
1215 generate-stubs :
1316 runs-on : ubuntu-22.04
1619 with :
1720 submodules : true
1821 - uses : ./.github/actions/setup
22+ - name : Build FFmpeg
23+ run : |
24+ sudo apt-get install -y nasm pkg-config
25+ curl -L https://ffmpeg.org/releases/ffmpeg-${{ env.FFMPEG_VERSION }}.tar.xz | tar xJ
26+ cd ffmpeg-${{ env.FFMPEG_VERSION }}
27+ ./configure --prefix=/usr/local --libdir=/usr/local/lib --enable-shared --disable-static --disable-programs --disable-doc
28+ make -j$(nproc)
29+ sudo make install
30+ sudo ldconfig
1931 - name : Generate type stubs
2032 run : |
21- cargo build --release -p processing_pyo3
33+ cargo build --release -p processing_pyo3 --features video
2234 cargo run --release -p generate_stubs
2335 - uses : actions/upload-artifact@v4
2436 with :
3143 strategy :
3244 matrix :
3345 # TODO: add aarch64 when we are ready to address long build times
34- target : [x86_64]
46+ target : [x86_64]
3547 steps :
3648 - uses : actions/checkout@v4
3749 with :
@@ -52,19 +64,26 @@ jobs:
5264 container : " quay.io/pypa/manylinux_2_34_${{matrix.target}}:latest"
5365 docker-options : " -e PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/lib/${{matrix.target}}-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig"
5466 target : ${{ matrix.target }}
55- args : --release --out dist --find-interpreter
67+ args : --release --out dist --find-interpreter --features video
5668 manylinux : 2_34
5769 before-script-linux : |
5870 EXTRA_PACKAGES=""
5971 if [ "$(uname -m)" = "aarch64" ]; then
6072 EXTRA_PACKAGES="gcc-aarch64-linux-gnu"
6173 fi
6274
63- dnf -y install cmake gcc-c++ \
75+ dnf -y install cmake gcc-c++ nasm \
6476 pkgconfig alsa-lib-devel systemd-devel \
6577 libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel \
6678 libxkbcommon-devel wayland-devel wayland-protocols-devel \
6779 glfw-devel $EXTRA_PACKAGES
80+
81+ curl -L https://ffmpeg.org/releases/ffmpeg-${{ env.FFMPEG_VERSION }}.tar.xz | tar xJ
82+ cd ffmpeg-${{ env.FFMPEG_VERSION }}
83+ ./configure --prefix=/usr/local --libdir=/usr/local/lib --enable-shared --disable-static --disable-programs --disable-doc
84+ make -j$(nproc)
85+ make install
86+ ldconfig
6887 working-directory : crates/processing_pyo3
6988 - uses : actions/upload-artifact@v4
7089 with :
@@ -92,12 +111,26 @@ jobs:
92111 with :
93112 name : type-stubs
94113 path : crates/processing_pyo3/mewnala
114+ - name : Build FFmpeg (LGPL, shared)
115+ run : |
116+ brew install nasm pkg-config
117+ curl -L https://ffmpeg.org/releases/ffmpeg-${{ env.FFMPEG_VERSION }}.tar.xz | tar xJ
118+ cd ffmpeg-${{ env.FFMPEG_VERSION }}
119+ ./configure --prefix=/usr/local --libdir=/usr/local/lib --enable-shared --disable-static --disable-programs --disable-doc
120+ make -j$(sysctl -n hw.ncpu)
121+ sudo make install
95122 - name : Build wheels
96123 uses : PyO3/maturin-action@v1
97124 with :
98125 target : ${{ matrix.target }}
99- args : --release --out dist --find-interpreter
126+ args : --release --out dist --find-interpreter --features video
100127 working-directory : crates/processing_pyo3
128+ - name : Bundle dylibs into wheels
129+ run : |
130+ pip install delocate
131+ delocate-wheel -w dist-fixed crates/processing_pyo3/dist/*.whl
132+ rm -rf crates/processing_pyo3/dist
133+ mv dist-fixed crates/processing_pyo3/dist
101134 - uses : actions/upload-artifact@v4
102135 with :
103136 name : wheels-macos-${{ matrix.target }}
@@ -117,12 +150,29 @@ jobs:
117150 with :
118151 name : type-stubs
119152 path : crates/processing_pyo3/mewnala
153+ - name : Install FFmpeg
154+ shell : bash
155+ run : |
156+ curl -L -o ffmpeg.zip "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n7.1-latest-win64-lgpl-shared-7.1.zip"
157+ 7z x ffmpeg.zip -offmpeg-extract
158+ mv ffmpeg-extract/ffmpeg-* ffmpeg
159+ echo "FFMPEG_DIR=$(cygpath -w $(pwd)/ffmpeg)" >> $GITHUB_ENV
120160 - name : Build wheels
121161 uses : PyO3/maturin-action@v1
122162 with :
123163 target : x64
124- args : --release --out dist --find-interpreter
164+ args : --release --out dist --find-interpreter --features video
125165 working-directory : crates/processing_pyo3
166+ - name : Bundle DLLs into wheels
167+ shell : bash
168+ run : |
169+ pip install delvewheel
170+ mkdir dist-fixed
171+ for whl in crates/processing_pyo3/dist/*.whl; do
172+ delvewheel repair --add-path "$FFMPEG_DIR/bin" -w dist-fixed "$whl"
173+ done
174+ rm -rf crates/processing_pyo3/dist
175+ mv dist-fixed crates/processing_pyo3/dist
126176 - uses : actions/upload-artifact@v4
127177 with :
128178 name : wheels-windows-x64
0 commit comments