The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
fix(project): a freeze leaves reversed and curved pieces the way a split does
leoca1ac276075afd
diff --git a/src/crates/concat-project/src/commands.rs b/src/crates/concat-project/src/commands.rsindex 4d022f3e..b4d67c10 100644--- a/src/crates/concat-project/src/commands.rs+++ b/src/crates/concat-project/src/commands.rs@@ -1363,6 +1363,15 @@ pub fn apply(let Some(index) = timeline.clips.iter().position(|clip| clip.id == clip_id) else {return Ok(Outcome::default());};+ // The cut is a split's, so it leaves the pieces as a split does:+ // under a curve or a reverse the map is not affine, and the+ // in-point below assumes it is, so both pieces go to the constant+ // mean they averaged.+ {+ let clip = &mut timeline.clips[index];+ clip.speed_curve = None;+ clip.reverse = false;+ }let offset = time - start;let mut tail = timeline.clips[index].clone();tail.id = mint.next("c");diff --git a/src/crates/concat-project/src/lib.rs b/src/crates/concat-project/src/lib.rsindex ae970613..efc17e28 100644--- a/src/crates/concat-project/src/lib.rs+++ b/src/crates/concat-project/src/lib.rs@@ -187,6 +187,88 @@ mod tests {);}+ /// A freeze cuts the clip the way a split does, so a reversed or curved+ /// clip has to come out of it the way a split leaves one: both pieces at+ /// the constant mean, forwards, meeting at the frozen source time.+ #[test]+ fn freeze_frame_on_a_reversed_or_curved_clip_keeps_the_pieces_continuous() {+ for (reverse, curve) in [+ (true, None),+ (+ false,+ Some(vec![+ crate::model::SpeedPoint {+ at: 0.0,+ speed: 0.5,+ },+ crate::model::SpeedPoint {+ at: 1.0,+ speed: 2.0,+ },+ ]),+ ),+ ] {+ let (mut editor, _, clip_id) = fixture();+ editor+ .apply(Command::UpdateClip {+ clip_id: clip_id.clone(),+ patch: ClipPatch {+ reverse: Some(reverse),+ ..Default::default()+ },+ })+ .expect("reverses");+ editor+ .apply(Command::SetClipSpeedCurve {+ clip_id: clip_id.clone(),+ curve: curve.clone(),+ })+ .expect("curves");+ let freeze_id = editor+ .apply(Command::FreezeFrame {+ clip_id: clip_id.clone(),+ time: 4.0,+ duration: Some(1.0),+ still: Some(NewMedia {+ path: "/freeze.jpg".into(),+ name: "freeze.jpg".into(),+ duration: None,+ kind: MediaKind::Image,+ width: Some(1920),+ height: Some(1080),+ frame_rate: None,+ frame_rate_fraction: None,+ video_codec: None,+ audio_codec: None,+ has_audio: false,+ audio_tracks: Vec::new(),+ }),+ })+ .expect("freezes")+ .created_id+ .expect("freeze id");++ let timeline = editor.project().active();+ let head = timeline.clip(&clip_id).expect("head");+ let tail = timeline+ .clips+ .iter()+ .find(|clip| clip.id != clip_id && clip.id != freeze_id)+ .expect("tail");+ for piece in [head, tail] {+ assert!(+ !piece.reverse && piece.speed_curve.is_none(),+ "reverse {reverse}, curve {curve:?}: a piece kept a map its in-point was not computed for"+ );+ }+ assert_eq!(+ head.source_start + head.duration * head.speed,+ tail.source_start,+ "reverse {reverse}, curve {curve:?}: the tail picks up where the head ends"+ );+ }+ }+#[test]fn split_produces_source_continuous_halves_and_merge_rejoins_them() {let (mut editor, _, clip_id) = fixture();