Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
build(webcam): ship ONNX Runtime on Linux, now that its back-end can use it
Etienne Lescot2efe4303e383
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 3f5505697..5ee421be9 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -276,11 +276,21 @@ jobs:# et rendre une erreur qui ne designe pas la cause non plus.test -n "$libclang" || { echo "libclang introuvable apres l'installation"; exit 1; }echo "LIBCLANG_PATH=$(dirname "$libclang")" >> "$GITHUB_ENV"+ # Meme raison que sur le job macOS : sans bibliotheque sur ORT_DYLIB_PATH,+ # `runtime_available()` est faux et chaque test de segmentation rend la main+ # tout de suite — la suite passe au vert sans avoir exerce la moindre+ # inference, ce qui est exactement par ou le bug « ort panique quand elle+ # manque » est entre. C'est ce qui fait de+ # `the_whole_loop_produces_a_mask_from_compose_frame_alone` un vrai test ici+ # plutot qu'un test saute. Builtins node uniquement, comme fetch:ffmpeg:sdk.+ - name: Stage ONNX Runtime+ run: node scripts/fetch-onnxruntime.mjs- name: cargo test (compositor)env:# Les .so ffmpeg vendorises ne sont dans aucun chemin systeme : sans ca# le binaire de test se lance puis meurt sur `libavformat.so.62`.LD_LIBRARY_PATH: ${{ github.workspace }}/crates/thirdparty/ffmpeg-linux64-lgpl-shared/lib+ ORT_DYLIB_PATH: ${{ github.workspace }}/electron/native/bin/linux-x64/libonnxruntime.so# Fait ECHOUER `cpu_backend_linux.rs` s'il n'obtient pas le backend CPU,# au lieu de le sauter en silence comme sur un poste sans lavapipe.OPENSCREEN_REQUIRE_CPU_BACKEND: "1"diff --git a/package.json b/package.jsonindex f48fefe5a..24891039d 100644--- a/package.json+++ b/package.json@@ -51,7 +51,7 @@"build:native:linux": "node scripts/build-linux-pipewire-helper.mjs","build:win": "npm run build:native:win && npm run fetch:ffmpeg && npm run fetch:onnxruntime && npm run stage:vcomp && npm run build:native:compositor && tsc && vite build && electron-builder --win --config.npmRebuild=false","build:win:store": "npm run build:native:win && npm run fetch:ffmpeg && npm run fetch:onnxruntime && npm run stage:vcomp && npm run build:native:compositor && tsc && vite build && electron-builder --win appx --config.npmRebuild=false",- "build:linux": "npm run fetch:ffmpeg:sdk && npm run build:native:linux && npm run build:native:compositor:linux && tsc && vite build && electron-builder --linux AppImage deb pacman rpm --config.npmRebuild=false",+ "build:linux": "npm run fetch:ffmpeg:sdk && npm run build:native:linux && npm run fetch:onnxruntime && npm run build:native:compositor:linux && tsc && vite build && electron-builder --linux AppImage deb pacman rpm --config.npmRebuild=false","build:whisper-binaries": "bash scripts/build-whisper-stt.sh","test:whisper-stt": "node scripts/test-whisper-stt.mjs","test": "vitest --run",diff --git a/scripts/fetch-onnxruntime.mjs b/scripts/fetch-onnxruntime.mjsindex c295f750e..791e38656 100644--- a/scripts/fetch-onnxruntime.mjs+++ b/scripts/fetch-onnxruntime.mjs@@ -91,11 +91,11 @@ const PINNED = {member: `libonnxruntime.${VERSION}.dylib`,out: "libonnxruntime.dylib",},- // Linux is pinned but not yet wired into `build:linux`: the Linux compositor- // back-end carries the segmentation SHADER only — nothing captures the webcam- // frame or uploads a mask there, so `fx.z` never leaves 0 and the library would- // be 23 MB of installer for a code path that cannot run. The entry is here so- // that landing the Linux capture half is a one-line change to package.json.+ // Linux is wired into `build:linux` since its back-end gained the capture half+ // (`capture_webcam_rgb` + `set_webcam_mask` in `compositor_linux.rs`). Until+ // then this entry existed but was deliberately unused: the back-end carried the+ // segmentation SHADER only, so `fx.z` never left 0 and the library would have+ // been 23 MB of installer for a code path that could not run.// See technical-documentation/engineering/webcam-segmentation-backend-port.md."linux-x64": {slug: "linux-x64",diff --git a/technical-documentation/engineering/webcam-segmentation.md b/technical-documentation/engineering/webcam-segmentation.mdindex cbfb946a5..18e0cf35c 100644--- a/technical-documentation/engineering/webcam-segmentation.md+++ b/technical-documentation/engineering/webcam-segmentation.md@@ -65,12 +65,13 @@ not an alpha channel, so nothing has to survive a codec that cannot carry one.### Not done-- **Intel macOS and Linux have no runtime staged**, so the effect stays off there — for- different reasons, both recorded under *Staging* below.+- **Intel macOS has no runtime staged**, so the effect stays off there. Upstream publishes no+ build for it; see *Staging* below.## Staging the runtime-`scripts/fetch-onnxruntime.mjs`, wired into `build:mac`, `build:win` and `build:win:store`. The+`scripts/fetch-onnxruntime.mjs`, wired into `build:mac`, `build:win`, `build:win:store` and+`build:linux`. Thecrate links `ort` with `load-dynamic`, so nothing is needed to *build*; at runtime`ensureOnnxRuntimeOnPath` looks for the library next to the addon in `electron/native/bin/<tag>/`,the convention `whisper-stt` already uses. The script downloads the pinned upstream release,@@ -90,7 +91,7 @@ What it actually costs, measured on the 1.27.1 artifacts rather than estimated:|---|---|---:|---|| win32-x64 | `onnxruntime.dll` | 15.4 MB | yes || darwin-arm64 | `libonnxruntime.dylib` | 38.5 MB | yes |-| linux-x64 | `libonnxruntime.so` | 23.7 MB | pinned, not shipped |+| linux-x64 | `libonnxruntime.so` | 23.7 MB | yes || darwin-x64 | — | — | **no upstream build** |Two things fall out of that table, and neither was the expectation:@@ -105,9 +106,15 @@ Two things fall out of that table, and neither was the expectation:from source is the only way round it, and that is an ffmpeg-macos-sized script for a shrinkingplatform.-Linux is pinned in the same table but deliberately not wired into `build:linux`: the back-end-carries the shader half only, so the library would be 23 MB of installer for a code path that-cannot run. Landing the Linux capture half makes it a one-line change.+Linux was pinned but deliberately not wired in until its back-end gained the capture half — the+library would have been 23 MB of installer for a code path that could not run. That landed, so it+is wired now, and the same reasoning applies to `RightPanes.tsx`: the control is only worth showing+where a mask can actually reach the shader.++The **Linux compositor CI job stages it too**, as the macOS one does. Without a library on+`ORT_DYLIB_PATH`, `runtime_available()` is false and every segmentation test returns early — the+suite goes green having exercised no inference at all, which is exactly how the+`ort`-panics-when-absent bug got in.`onnxruntime-node` was considered and rejected: 296 MB unpacked, which would roughly triple theinstaller for three platforms' worth of providers we do not use.