Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(nix): give the compositor an ffmpeg that can encode H.264, under LGPL

EtienneLescot1def6246b7c3
diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml
index 3bc4c1457..4251e4462 100644
--- a/.github/workflows/nix-build.yml
+++ b/.github/workflows/nix-build.yml
@@ -136,13 +136,11 @@ jobs:
# Every invocation is bounded. A CLI that never returns is a failure
# mode this workflow has already produced once, and an unbounded
# command turns it into a full runner slot spent learning nothing.
- # An explicit screen rather than whatever this xvfb-run defaults to,
- # and --disable-dev-shm-usage, which is the standard answer to Chromium
- # in a container: /dev/shm is typically 64M there and Chromium expects
- # far more. Two changes at once, deliberately -- each run costs ten
- # minutes and the capture path has never once worked here, so getting
- # it to work matters more right now than attributing which knob did it.
- # Worth bisecting afterwards if it goes green.
+ # Both of these were guesses at the X11 capture failure and the
+ # measurements above disproved both: this xvfb-run already defaults to
+ # 24-bit, and /dev/shm is 7.9G and empty. They stay because they are
+ # harmless and explicit beats inherited, but neither is the fix, and
+ # the capture failure remains unexplained.
XVFB_SCREEN="-screen 0 1920x1080x24"
CHROME_FLAGS="--disable-dev-shm-usage"
run_cli() { timeout --signal=TERM --kill-after=10s "${CLI_TIMEOUT:-120}" xvfb-run -a -s "$XVFB_SCREEN" ./result/bin/openscreen "$@"; }
diff --git a/nix/compositor-view.nix b/nix/compositor-view.nix
index e59af7c5d..21e9386a6 100644
--- a/nix/compositor-view.nix
+++ b/nix/compositor-view.nix
@@ -14,14 +14,30 @@
}:
let
+ # nixpkgs' default ffmpeg has no H.264 encoder this project can use, which the
+ # app reports precisely:
+ #
+ # aucun encodeur video utilisable : libopenh264: absent de ce build ffmpeg
+ #
+ # withOpenh264 defaults to withFullDeps, so only ffmpeg-full carries it, while
+ # withX264 is on by default and is GPL. Both halves of this override matter.
+ # scripts/fetch-ffmpeg.mjs vendors BtbN's *lgpl* build and asserts the licence
+ # before using it, so linking GPL x264 into an MIT application is the exact
+ # thing upstream takes care to avoid -- a nix package that quietly did it would
+ # be a licensing fault, not a packaging shortcut.
+ ffmpegLgpl = ffmpeg.override {
+ withOpenh264 = true;
+ withGPL = false;
+ };
+
# crates/compositor/build.rs wants a single tree holding both include/ and
# lib/, the shape of the vendored ffmpeg the Windows and Linux scripts
# download. nixpkgs splits ffmpeg across outputs, so join them back.
ffmpegTree = symlinkJoin {
name = "ffmpeg-tree-for-build-rs";
paths = [
- ffmpeg.dev
- ffmpeg.lib
+ ffmpegLgpl.dev
+ ffmpegLgpl.lib
];
};
in
@@ -44,7 +60,7 @@ rustPlatform.buildRustPackage {
pkg-config
];
- buildInputs = [ ffmpeg ];
+ buildInputs = [ ffmpegLgpl ];
# Same reasoning: config.toml's [env] sets FFMPEG_DIR to the vendored win64
# tree, without force, so this overrides it rather than fighting it.