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
fix(export): stop drawing the screen inside the PiP box on camera-less clips
Etienne Lescotc5e0ba6828df
diff --git a/crates/compositor/src/compositor_linux.rs b/crates/compositor/src/compositor_linux.rsindex adefba877..fc32ecaff 100644--- a/crates/compositor/src/compositor_linux.rs+++ b/crates/compositor/src/compositor_linux.rs@@ -726,6 +726,12 @@ impl Compositor {*self.live_params.borrow_mut() = p;}+ /// Cf. `compositor_windows::set_has_webcam` — le seul champ de `LiveParams` qui dépend du+ /// clip courant, rebranché par `walk_composited_timeline` sans écraser le reste.+ pub fn set_has_webcam(&self, v: bool) {+ self.live_params.borrow_mut().has_webcam = v;+ }+pub fn set_scene(&self, s: Option<Scene>) {*self.scene.borrow_mut() = s;}diff --git a/crates/compositor/src/compositor_macos.rs b/crates/compositor/src/compositor_macos.rsindex cd553fb94..4ea09a42c 100644--- a/crates/compositor/src/compositor_macos.rs+++ b/crates/compositor/src/compositor_macos.rs@@ -577,6 +577,12 @@ impl Compositor {*self.live_params.borrow_mut() = p;}+ /// Cf. `compositor_windows::set_has_webcam` — le seul champ de `LiveParams` qui dépend du+ /// clip courant, rebranché par `walk_composited_timeline` sans écraser le reste.+ pub fn set_has_webcam(&self, v: bool) {+ self.live_params.borrow_mut().has_webcam = v;+ }+pub fn set_scene(&self, s: Option<Scene>) {*self.scene.borrow_mut() = s;}diff --git a/crates/compositor/src/compositor_windows.rs b/crates/compositor/src/compositor_windows.rsindex 09381e454..b4f19b9be 100644--- a/crates/compositor/src/compositor_windows.rs+++ b/crates/compositor/src/compositor_windows.rs@@ -596,6 +596,14 @@ impl Compositor {*self.live_params.borrow_mut() = p;}+ /// Rebranche le seul champ qui dépend du CLIP et non des réglages (cf. `LiveParams::has_webcam`).+ /// L'export pose ses `LiveParams` une fois pour toute la timeline, mais chaque clip a sa propre+ /// réponse à « y a-t-il une caméra ? » : d'où un setter ciblé plutôt qu'un `set_live_params`+ /// par clip, qui écraserait les réglages posés par l'appelant.+ pub fn set_has_webcam(&self, v: bool) {+ self.live_params.borrow_mut().has_webcam = v;+ }+/// Installe (ou retire) la scène de l'app. Présente → `compose_frame` prend ses placements/// depuis le layout preset au lieu du planning fixture.pub fn set_scene(&self, s: Option<Scene>) {diff --git a/crates/compositor/src/frame_geometry.rs b/crates/compositor/src/frame_geometry.rsindex 0addb485d..738a14f8e 100644--- a/crates/compositor/src/frame_geometry.rs+++ b/crates/compositor/src/frame_geometry.rs@@ -601,12 +601,37 @@ pub struct LiveParams {/// False when the "webcam" decoder is actually just the screen video again (the TS side/// falls `webcamPath` back to the screen asset's own path when a clip has no real camera,/// purely so the decoder pipeline has something valid to open) — drawing the PiP box in- /// that case duplicates the screen video into its own corner. Live-only: derived in- /// `live.rs` by comparing the active clip's screen/webcam paths; defaults `true` (draw)- /// so fixture/bench renders and any caller that never sets it keep their old behavior.+ /// that case duplicates the screen video into its own corner. Derived per clip from the+ /// screen/webcam paths via `webcam_is_real`: in `live.rs` for the preview, in+ /// `timeline_walk.rs` for every export. Defaults `true` (draw) so fixture/bench renders+ /// and any caller that never sets it keep their old behavior.pub has_webcam: bool,}+fn same_source_path(a: &str, b: &str) -> bool {+ a.eq_ignore_ascii_case(b)+}++/// True when this clip really has a camera to draw.+///+/// TWO ways the app says "no camera", and both must be caught here, because the+/// webcam decoder is opened either way — the live path falls back to the SCREEN+/// file when the webcam path won't open, and `ExportDialog` sends the screen path+/// outright, so the decoder always yields frames. Whether those frames are the+/// camera or a second copy of the screen is decided HERE and nowhere else.+///+/// - the empty string, which is what `sceneDescription.ts` and+/// `NativeCompositorOverlay` send for an asset with no `cameraTrack`;+/// - the screen's own path, which `ExportDialog.tsx` sends and which older+/// scenes still use.+///+/// Missing the empty-string case is what put the screen recording inside the PiP+/// box: `"" != "/…/recording.mp4"`, so the box was drawn, and the decoder behind+/// it was the screen fallback.+pub fn webcam_is_real(webcam_path: &str, screen_path: &str) -> bool {+ !webcam_path.trim().is_empty() && !same_source_path(webcam_path, screen_path)+}+impl Default for LiveParams {fn default() -> Self {Self {diff --git a/crates/compositor/src/live.rs b/crates/compositor/src/live.rsindex 9c1c8f382..015d01d78 100644--- a/crates/compositor/src/live.rs+++ b/crates/compositor/src/live.rs@@ -28,6 +28,7 @@ use crate::scene::Scene;use crate::config::{self, Cfg};use crate::cursor::CursorTrack;use crate::d3d::Gpu;+use crate::frame_geometry::webcam_is_real;use crate::pipeline::Decoder;use crate::timeline_walk::{frame_step, FrameStep, NextFrameTime};use anyhow::Result;@@ -590,26 +591,6 @@ fn same_source_path(a: &str, b: &str) -> bool {a.eq_ignore_ascii_case(b)}-/// True when the active clip really has a camera to draw.-///-/// TWO ways the app says "no camera", and both must be caught here, because the-/// webcam decoder is opened either way — `open_and_seek_clip` falls back to the-/// SCREEN file when the webcam path won't open, so `wdec` always yields frames.-/// Whether those frames are the camera or a second copy of the screen is decided-/// HERE and nowhere else.-///-/// - the empty string, which is what `sceneDescription.ts` and-/// `NativeCompositorOverlay` send for an asset with no `cameraTrack`;-/// - the screen's own path, the older convention kept working for scenes that-/// still use it.-///-/// Missing the empty-string case is what put the screen recording inside the PiP-/// box: `"" != "/…/recording.mp4"`, so the box was drawn, and the decoder behind-/// it was the screen fallback.-fn webcam_is_real(webcam_path: &str, screen_path: &str) -> bool {- !webcam_path.trim().is_empty() && !same_source_path(webcam_path, screen_path)-}-fn scene_clip_matches(clip: &crate::scene::SceneClip,screen_path: &str,diff --git a/crates/compositor/src/timeline_walk.rs b/crates/compositor/src/timeline_walk.rsindex 0e0efdad6..adde1d52b 100644--- a/crates/compositor/src/timeline_walk.rs+++ b/crates/compositor/src/timeline_walk.rs@@ -17,6 +17,7 @@ use crate::compositor::Compositor;use crate::config::Cfg;use crate::cursor::CursorTrack;use crate::d3d::Gpu;+use crate::frame_geometry::webcam_is_real;use crate::pipeline::{ClipSource, Decoder};use crate::regions::{speed_segments_for_window, SpeedSegment};use crate::scene::Scene;@@ -164,6 +165,13 @@ pub(crate) unsafe fn walk_composited_timeline(let mut frames: u64 = 0;for (clip_index, clip) in clips.iter().enumerate() {+ // Le preset de layout est GLOBAL (un seul panneau pour toute la timeline) mais la+ // caméra est PAR CLIP : un projet mélange sans problème un enregistrement avec webcam+ // et un import qui n'en a pas. Le preset ne doit donc s'appliquer qu'aux clips qui ont+ // vraiment une caméra — sinon la boîte PiP est dessinée avec, derrière, le décodeur de+ // repli, c'est-à-dire l'écran lui-même recopié dans son propre coin (issue #248).+ // La preview vive fait exactement ça dans `live.rs` ; c'est ici l'équivalent export.+ comp.set_has_webcam(webcam_is_real(&clip.webcam, &clip.screen));if !screen_decs.contains_key(&clip.screen) {screen_decs.insert(clip.screen.clone(), Decoder::open(&clip.screen, gpu)?);}diff --git a/crates/poc-d3d/src/bench.rs b/crates/poc-d3d/src/bench.rsindex cb45254bd..aa2de7d60 100644--- a/crates/poc-d3d/src/bench.rs+++ b/crates/poc-d3d/src/bench.rs@@ -48,6 +48,7 @@ pub fn run() -> Result<()> {// poc-d3d.exe --cfg C0..C8 --fixture <dir> --repeat 3 --out out/// --cfg GIF → bench natif GIF (slice 1)+// --webcam <path> → force le chemin caméra (défaut `<fixture>/webcam.mp4`)fn run_bench(args: &[String]) -> Result<()> {let get = |k: &str, d: &str| -> String { arg(args, k, d) };let fixture = get("--fixture", "fixture");@@ -56,7 +57,11 @@ fn run_bench(args: &[String]) -> Result<()> {let cfg_arg = get("--cfg", "C0..C8");let screen = format!("{fixture}/screen.mp4");- let webcam = format!("{fixture}/webcam.mp4");+ // Override explicite parce que le cas « pas de caméra » n'est PAS un fichier+ // différent : l'app renvoie le chemin de l'écran lui-même (`ExportDialog`) ou la+ // chaîne vide (`sceneDescription`). Le reproduire demande donc de piloter le chemin,+ // pas le contenu — `--webcam <screen.mp4>` rejoue exactement l'issue #248.+ let webcam = get("--webcam", &format!("{fixture}/webcam.mp4"));std::fs::create_dir_all(&out).ok();// sélection des cfg