1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# CI for ez-ffmpeg.
#
# Every job runs in a two-lane FFmpeg matrix, because the crate supports
# linking either major and the two lanes are provisioned differently:
#
# * ffmpeg 8.1 lane — `--features ffmpeg-sys-next/build`: the sys crate's
# build script git-clones FFmpeg `release/8.1` (the branch is hardcoded to
# the crate's own major.minor) and compiles/statically links it. This is
# the same mechanism the pre-8 CI used, which then produced FFmpeg 7.1 —
# after the dependency bump the SAME flag silently produces 8.1, which is
# exactly why the 7.x lane below must NOT use it.
#
# * ffmpeg 7.1 lane — explicit from-source build of FFmpeg `release/7.1`
# (shared libs, default components, no external deps) installed under
# $HOME/ffmpeg71 and linked via pkg-config. This proves the bump keeps
# FFmpeg 7.x users working: ffmpeg-sys-next 8.1 probes the installed
# headers and only enables cfg flags up to ffmpeg_7_1.
#
# Ubuntu's apt FFmpeg (6.1 on 24.04) matches neither lane, so it is never
# installed; the apt packages below are just the FFmpeg build toolchain
# (nasm/yasm/clang/pkg-config/zlib). First build per lane compiles FFmpeg
# (~10-20 min); caches make subsequent runs fast.
#
# GPU-dependent code: the `opengl`/`wgpu` frame filters need a real GPU/display
# and their tests fail headless ("Failed to create Surfman connection"). The
# `build` job still compiles them (via `--all-features`) so they stay
# type-checked; the `test` job omits those two features so the suite runs green
# on a GPU-less runner. The macOS-only `videotoolbox` scheduler tests are
# `#[cfg(target_os = "macos")]`, so they do not run on Linux.
#
# `build` + `clippy` + `test` are all enforced gates, per lane.
name: CI
on:
push:
branches:
pull_request:
branches:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build:
name: Build & Clippy (FFmpeg ${{ matrix.ffmpeg }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- ffmpeg: "8.1"
ffmpeg-features: "--features ffmpeg-sys-next/build"
- ffmpeg: "7.1"
ffmpeg-features: ""
steps:
- uses: actions/checkout@v4
- name: Install FFmpeg build toolchain
run: |
sudo apt-get update
sudo apt-get install -y \
nasm yasm clang pkg-config make git zlib1g-dev
echo "nasm: $(nasm --version | head -1)"
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache FFmpeg 7.1 install
if: matrix.ffmpeg == '7.1'
uses: actions/cache@v4
with:
path: ~/ffmpeg71
key: ${{ runner.os }}-ffmpeg71-shared-v1
- name: Build FFmpeg 7.1 from source (if not cached)
if: matrix.ffmpeg == '7.1'
run: |
if [ ! -f "$HOME/ffmpeg71/lib/pkgconfig/libavcodec.pc" ]; then
git clone --depth=1 -b release/7.1 https://github.com/FFmpeg/FFmpeg ffmpeg-71-src
cd ffmpeg-71-src
./configure --prefix="$HOME/ffmpeg71" \
--disable-programs --disable-doc \
--disable-static --enable-shared
make -j"$(nproc)"
make install
fi
- name: Point pkg-config at FFmpeg 7.1
if: matrix.ffmpeg == '7.1'
run: |
echo "PKG_CONFIG_PATH=$HOME/ffmpeg71/lib/pkgconfig" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$HOME/ffmpeg71/lib" >> "$GITHUB_ENV"
- name: Cache cargo registry and target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-ffmpeg${{ matrix.ffmpeg }}-${{ hashFiles('**/Cargo.toml') }}
- name: Build
run: cargo build --all-features ${{ matrix.ffmpeg-features }} --verbose
# Safety-hygiene lints surface here. Not `-D warnings` yet: the crate has a
# pre-existing unused-import / undocumented-unsafe backlog to clear first.
- name: Clippy
run: cargo clippy --all-features ${{ matrix.ffmpeg-features }} --lib
test:
name: Test (FFmpeg ${{ matrix.ffmpeg }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- ffmpeg: "8.1"
ffmpeg-features: "--features ffmpeg-sys-next/build"
- ffmpeg: "7.1"
ffmpeg-features: ""
# Runs the full library suite MINUS the opengl/wgpu features, whose tests
# need a GPU/display. Everything else passes headless. Media assets are
# committed as test.mp4.
steps:
- uses: actions/checkout@v4
- name: Install FFmpeg build toolchain
run: |
sudo apt-get update
sudo apt-get install -y \
nasm yasm clang pkg-config make git zlib1g-dev
- uses: dtolnay/rust-toolchain@stable
- name: Cache FFmpeg 7.1 install
if: matrix.ffmpeg == '7.1'
uses: actions/cache@v4
with:
path: ~/ffmpeg71
key: ${{ runner.os }}-ffmpeg71-shared-v1
- name: Build FFmpeg 7.1 from source (if not cached)
if: matrix.ffmpeg == '7.1'
run: |
if [ ! -f "$HOME/ffmpeg71/lib/pkgconfig/libavcodec.pc" ]; then
git clone --depth=1 -b release/7.1 https://github.com/FFmpeg/FFmpeg ffmpeg-71-src
cd ffmpeg-71-src
./configure --prefix="$HOME/ffmpeg71" \
--disable-programs --disable-doc \
--disable-static --enable-shared
make -j"$(nproc)"
make install
fi
- name: Point pkg-config at FFmpeg 7.1
if: matrix.ffmpeg == '7.1'
run: |
echo "PKG_CONFIG_PATH=$HOME/ffmpeg71/lib/pkgconfig" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$HOME/ffmpeg71/lib" >> "$GITHUB_ENV"
- name: Cache cargo registry and target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-ffmpeg${{ matrix.ffmpeg }}-${{ hashFiles('**/Cargo.toml') }}
- name: Test
run: cargo test --lib --features async,rtmp,flv,subtitle ${{ matrix.ffmpeg-features }}