From 0f8bb3e915ed2e05548961245dd470dc62a29736 Mon Sep 17 00:00:00 2001 From: Etienne Lescot Date: Thu, 3 Sep 2026 12:32:53 +0200 Subject: [PATCH] chore(ffmpeg): say that the encoder list is reported, not verified MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `WANTED_ENCODERS` drove a line reading `hardware encoders: h264_vaapi` on Linux. That is true in the only sense the code checks — the name appears in `-encoders` — and misleading in the sense a reader takes it: that the encoder works here. It does not follow. The vendored builds list `h264_vaapi`, and on any host with libva < 2.21 (Ubuntu 24.04 LTS included) reaching it through the CPU upload path used to abort the process with SIGABRT rather than return an error, because the implib trampoline `abort()`s on a symbol it cannot resolve. A build that "has" the encoder and a machine that can use it are separate questions. Renamed to `REPORTED_ENCODERS`, the log line now says "present (not verified)", and the comment records why the distinction matters, with the libva case and pointers to #552 and #576. No behaviour change: this was already non-fatal and already only a log. What changes is that it no longer implies a guarantee it never made. The only evidence an encoder works is a frame going through it — `vaapi_encodes_from_an_exported_dmabuf` is that evidence for the Linux hardware path, and the export falls back to software whenever it is absent. --- scripts/fetch-ffmpeg.mjs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/scripts/fetch-ffmpeg.mjs b/scripts/fetch-ffmpeg.mjs index 07c78e5f1..222485d97 100644 --- a/scripts/fetch-ffmpeg.mjs +++ b/scripts/fetch-ffmpeg.mjs @@ -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"], }; @@ -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(", ")}`); } }