Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions scripts/fetch-ffmpeg.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,23 @@ const GPL_LIBS = [
/** Worse than GPL: these make the binary unredistributable at all. */
const NONFREE_LIBS = ["libfdk-aac", "libfdk_aac"];

/** The encoders the export path actually selects, per platform. */
const WANTED_ENCODERS = {
/**
* The hardware encoders we look for in a vendored build, per platform.
*
* REPORTED, NOT VERIFIED — and the distinction has bitten. Presence in
* `-encoders` means the build was compiled with the wrapper; it says nothing
* about whether the encoder RUNS on a given machine. The vendored builds list
* `h264_vaapi` on Linux, yet on any host with libva < 2.21 (Ubuntu 24.04 LTS
* included) it used to take the whole process down with SIGABRT rather than
* return an error, because the implib trampoline `abort()`s on a symbol it
* cannot resolve. See issues #552 and #576.
*
* So this list drives a log line and nothing else. The only evidence that an
* encoder works is a frame going through it — `vaapi_encodes_from_an_exported_dmabuf`
* in `crates/compositor/src/pipeline_linux.rs` is that evidence for the Linux
* hardware path, and the export falls back to software whenever it is absent.
*/
const REPORTED_ENCODERS = {
win32: ["h264_nvenc", "h264_qsv", "h264_amf"],
linux: ["h264_nvenc", "h264_vaapi"],
};
Expand Down Expand Up @@ -230,13 +245,14 @@ function assertLgpl(exePath, extraEnv) {

function reportEncoders(exePath, platform) {
const encoders = run(exePath, ["-hide_banner", "-encoders"]).stdout ?? "";
const wanted = WANTED_ENCODERS[platform] ?? [];
const wanted = REPORTED_ENCODERS[platform] ?? [];
const found = wanted.filter((e) => new RegExp(`\\s${e}\\s`).test(encoders));
const missing = wanted.filter((e) => !found.includes(e));
console.log(` hardware encoders: ${found.join(", ") || "(none)"}`);
console.log(` hardware encoders present (not verified): ${found.join(", ") || "(none)"}`);
if (missing.length > 0) {
// Not fatal: which encoders a build exposes is separate from which GPU the
// machine has. selectVideoEncoder() probes at runtime regardless.
// Not fatal, and deliberately so: which encoders a build EXPOSES is
// separate both from which GPU the machine has and from whether the
// encoder is usable there at all. The runtime probes regardless.
console.log(` not in this build: ${missing.join(", ")}`);
}
}
Expand Down
Loading