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
Merge pull request #48 from ActArtech/pr/freeze-frame
Jareer717470474da5
diff --cc engine/crates/concat/src/studio.rsindex bb3fc671,43cca0f5..898f0ed8--- a/engine/crates/concat/src/studio.rs+++ b/engine/crates/concat/src/studio.rs@@@ -4289,41 -3860,92 +4289,125 @@@ impl Studio};}+ /// CapCut-style freeze at the playhead on a picture clip.+ ///+ /// Video extracts a JPEG still into the project cache; images reuse their+ /// media. The engine command splits the clip, inserts the hold, and+ /// ripples the rest of the lane.+ pub fn freeze_at_playhead(&mut self) {+ let at = f64::from(self.playhead);+ let edge = f64::from(MIN_DURATION);+ let target = self+ .menu_target+ .clone()+ .or_else(|| self.sole_selection())+ .and_then(|id| self.clip(&id).cloned())+ .filter(|clip| {+ (clip.kind == model::ClipKind::Video || clip.kind == model::ClipKind::Image)+ && !self.locked(&clip.track_id)+ && at > clip.start + edge+ && at < clip.start + clip.duration - edge+ });+ let Some(clip) = target else {+ self.notify("Park the playhead inside a picture clip to freeze", true);+ return;+ };++ let still = if clip.kind == model::ClipKind::Video {+ let Some(media) = self+ .project()+ .media+ .iter()+ .find(|item| item.id == clip.media_id)+ else {+ return;+ };+ let Some(session) = self.session.as_ref() else {+ return;+ };+ let project_path = session.path().to_owned();+ let source_time = clip.source_start + (at - clip.start) * clip.speed;+ let frame = match media::still_at(&media.path, source_time, 1280) {+ Ok(frame) => frame,+ Err(error) => {+ self.notify(&error, true);+ return;+ }+ };+ let bytes = match jpeg(&frame, 4) {+ Ok(bytes) => bytes,+ Err(error) => {+ self.notify(&format!("{error}"), true);+ return;+ }+ };+ let key = format!(+ "freeze-{}-{}.jpg",+ clip.id,+ (source_time * 1000.0).round() as i64+ );+ if let Err(error) = media::write_artwork(&project_path, &key, &bytes) {+ self.notify(&error, true);+ return;+ }+ let path = format!("{project_path}/cache/{key}");+ match media::probe(&path) {+ Ok(summary) => Some(summary.to_new_media()),+ Err(error) => {+ self.notify(&error, true);+ return;+ }+ }+ } else {+ None+ };++ let created = self.apply(Command::FreezeFrame {+ clip_id: clip.id,+ time: at,+ duration: Some(1.0),+ still,+ });+ if let Some(id) = created {+ self.selection = vec![id];+ }+ }+/// A copy of `source` laid after it. Three commands, because a clip's/// in-point and length are set by trims, not by placement.+ /// Duplicate every unlocked selected clip (right-to-left by start so+ /// neighbours do not stack). Falls back to the menu target when the+ /// selection is empty.+ pub fn duplicate_selected(&mut self) {+ let mut sources: Vec<Clip> = self+ .selection+ .iter()+ .filter_map(|id| self.clip(id).cloned())+ .filter(|clip| !self.locked(&clip.track_id))+ .collect();+ if sources.is_empty() {+ if let Some(id) = self.menu_target.clone() {+ if let Some(clip) = self.clip(&id).cloned() {+ if !self.locked(&clip.track_id) {+ sources.push(clip);+ }+ }+ }+ }+ if sources.is_empty() {+ return;+ }+ sources.sort_by(|left, right| right.start.total_cmp(&left.start));+ let mut last = None;+ for source in &sources {+ self.duplicate(source);+ last = self.selection.first().cloned();+ }+ if let Some(id) = last {+ self.selection = vec![id];+ }+ }+pub fn duplicate(&mut self, source: &Clip) {let end = source.start + source.duration;if source.kind == model::ClipKind::Text {