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
Two choices in Settings: what a clip plays of a file with several audio tracks, and a playhead that goes past the end
Jareer8e03c615232f
diff --git a/engine/crates/concat/locales/en.json b/engine/crates/concat/locales/en.jsonindex 56d0484e..bd72e764 100644--- a/engine/crates/concat/locales/en.json+++ b/engine/crates/concat/locales/en.json@@ -46,6 +46,7 @@"Audio Effects": "Audio Effects","Audio effects": "Audio effects","Audio track": "Audio track",+ "Audio tracks": "Audio tracks","Auto": "Auto","auto": "auto","Auto captions": "Auto captions",@@ -120,7 +121,6 @@"Colour bleeding sideways, scan lines, softness, tape noise and too much saturation, with the slight vertical smear of a worn head.": "Colour bleeding sideways, scan lines, softness, tape noise and too much saturation, with the slight vertical smear of a worn head.","Colour filter": "Colour filter","Colour that sings and contrast that bites, with a little edge: the look that reads as a better camera. Skin is held back from the boost.": "Colour that sings and contrast that bites, with a little edge: the look that reads as a better camera. Skin is held back from the boost.",- "Colours pushed the wrong way, as film developed in the wrong chemicals.": "Colours pushed the wrong way, as film developed in the wrong chemicals.","Combo": "Combo","Concat {0}": "Concat {0}","Content": "Content",@@ -141,7 +141,6 @@"Creating…": "Creating…","Crisper edges.": "Crisper edges.","Crop": "Crop",- "Cross Process": "Cross Process","Curve": "Curve","Custom": "Custom","Custom removal": "Custom removal",@@ -202,6 +201,7 @@"Even": "Even","Every colour becomes its opposite.": "Every colour becomes its opposite.","Every colour turned around the wheel by the same angle.": "Every colour turned around the wheel by the same angle.",+ "Every track": "Every track","Everyday": "Everyday","Everything brighter than the threshold turns negative, as an over-exposed print does.": "Everything brighter than the threshold turns negative, as an over-exposed print does.","Everything on this machine. Transcription and speech run against models you download here, and nothing about a project leaves the device.": "Everything on this machine. Transcription and speech run against models you download here, and nothing about a project leaves the device.",@@ -219,7 +219,6 @@"Fade": "Fade","Fade in": "Fade in","Fade out": "Fade out",- "Faded": "Faded","Fades": "Fades","Fair": "Fair","Falling Dust": "Falling Dust",@@ -237,6 +236,7 @@"Filters": "Filters","Finalising file": "Finalising file","Finding the subject… {0}%": "Finding the subject… {0}%",+ "First track": "First track","Fisheye": "Fisheye","Flash": "Flash","Flash In": "Flash In",@@ -267,7 +267,6 @@"Green": "Green","Green Screen": "Green Screen","Greens": "Greens",- "Grey, hard and dark: a crime picture.": "Grey, hard and dark: a crime picture.","Half": "Half","Hall": "Hall","Haze": "Haze",@@ -311,6 +310,7 @@"Lagoon": "Lagoon","Language": "Language","Large": "Large",+ "Last track": "Last track","Late light: a warm balance that keeps its brightness, orange in the highlights, a whisper of magenta in the shadows, blacks lifted a touch.": "Late light: a warm balance that keeps its brightness, orange in the highlights, a whisper of magenta in the shadows, blacks lifted a touch.","Layer": "Layer","Layout": "Layout",@@ -320,7 +320,6 @@"Levels": "Levels","Library": "Library","Lift": "Lift",- "Lifted blacks and quiet colour, a matte finish.": "Lifted blacks and quiet colour, a matte finish.","Lifts speech out of the mix: a little presence, a little control.": "Lifts speech out of the mix: a little presence, a little control.","Light": "Light","Light leak": "Light leak",@@ -388,7 +387,6 @@"No templates yet. Mark media as slots, then save this project as a template.": "No templates yet. Mark media as slots, then save this project as a template.","No voice to read with": "No voice to read with","No {0} matches that.": "No {0} matches that.",- "Noir": "Noir","Noise": "Noise","Noise Reduction": "Noise Reduction","None": "None",@@ -407,6 +405,7 @@"Nothing was said in that clip": "Nothing was said in that clip","Object": "Object","off": "off",+ "Off, a click on the ruler past the last clip lands the playhead there, and a clip placed at the playhead goes with it. On, the playhead never leaves the content.": "Off, a click on the ruler past the last clip lands the playhead there, and a clip placed at the playhead goes with it. On, the playhead never leaves the content.","One repeat, fading.": "One repeat, fading.","One title per phrase spoken, cut to the words' own timing, on the first lane with room.": "One title per phrase spoken, cut to the words' own timing, on the first lane with room.","Only panel": "Only panel",@@ -430,6 +429,7 @@"Plate": "Plate","Plate colour": "Plate colour","Play": "Play",+ "Playhead": "Playhead","Polaroid": "Polaroid","Pop": "Pop","Portrait": "Portrait",@@ -564,6 +564,7 @@"Spooky": "Spooky","stereo": "stereo","Stone and height: reflections that take a while to arrive.": "Stone and height: reflections that take a while to arrive.",+ "Stop at the end of the content": "Stop at the end of the content","Strength": "Strength","Stylised": "Stylised","Stylize": "Stylize",@@ -646,6 +647,7 @@"Warmth": "Warmth","Water": "Water","Water and sky turned aquamarine and brightened, sand and skin left warm and clean. The beach-day look creators reach for first.": "Water and sky turned aquamarine and brightened, sand and skin left warm and clean. The beach-day look creators reach for first.",+ "What a clip plays when its file has more than one audio track, as a screen recording with the desktop and the microphone apart does. Every track puts each one on a sound lane of its own, the way Detach audio does. The Audio panel can change any clip afterwards.": "What a clip plays when its file has more than one audio track, as a screen recording with the desktop and the microphone apart does. Every track puts each one on a sound lane of its own, the way Detach audio does. The Audio panel can change any clip afterwards.","Where should the project folder go?": "Where should the project folder go?","Whites": "Whites","Width": "Width",diff --git a/engine/crates/concat/src/lib.rs b/engine/crates/concat/src/lib.rsindex d93b26c8..64f41ce4 100644--- a/engine/crates/concat/src/lib.rs+++ b/engine/crates/concat/src/lib.rs@@ -959,6 +959,21 @@ pub fn run() -> Result<(), slint::PlatformError> {state.prefs.transcribe_language = Some(state.settings.transcribe_language);state.prefs.save(&state.host.dirs);}));+ app.on_settings_audio_tracks_changed(on_window!(|state, index: i32| {+ let choice = prefs::AudioTracks::from_row(index);+ state.settings.audio_tracks = choice.row();+ state.prefs.audio_tracks = choice;+ state.prefs.save(&state.host.dirs);+ }));+ app.on_settings_playhead_stops_changed(on_window!(|state, on: bool| {+ state.settings.playhead_stops = on;+ state.prefs.playhead_stops_at_end = on;+ state.prefs.save(&state.host.dirs);+ // A playhead already out past the end comes back in when the+ // switch goes on; seek does the clamp.+ let at = state.playhead;+ state.seek(at);+ }));app.on_model_activated(on_window!(|state, id: SharedString| {state.model_activate(id.as_str());}));diff --git a/engine/crates/concat/src/prefs.rs b/engine/crates/concat/src/prefs.rsindex 07aedc13..0f9ea7a0 100644--- a/engine/crates/concat/src/prefs.rs+++ b/engine/crates/concat/src/prefs.rs@@ -32,6 +32,52 @@ pub struct Preferences {/// library it happens to be filed in is not part of it.#[serde(default)]pub favourites: Vec<String>,+ /// What a clip plays when its file has several audio tracks.+ pub audio_tracks: AudioTracks,+ /// The playhead stops at the end of the content instead of going where+ /// it is put. Off by default: a click past the last clip lands there, so+ /// a clip can be dropped at the playhead beyond everything else.+ pub playhead_stops_at_end: bool,+}++/// What a clip of a file with several audio tracks plays when it is placed+/// from the bin - a screen recording that kept the desktop and the+/// microphone apart, say. A file with one track has nothing to choose and+/// is left alone whatever this says. The Audio panel changes a placed clip+/// afterwards, per clip; this only sets what a fresh one starts on.+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "kebab-case")]+pub enum AudioTracks {+ /// The first track in file order: what the engine plays unless told+ /// otherwise, and what every clip did before the choice existed.+ #[default]+ First,+ /// The last track in file order.+ Last,+ /// Every track, each as a sound clip of its own on its own lane, and+ /// the video muted - the same as detaching the audio by hand.+ Every,+}++impl AudioTracks {+ /// The choices, in the order the settings sheet lists them.+ pub const ALL: [AudioTracks; 3] = [AudioTracks::First, AudioTracks::Last, AudioTracks::Every];++ /// The row in the settings sheet.+ pub fn row(self) -> i32 {+ Self::ALL+ .iter()+ .position(|choice| *choice == self)+ .unwrap_or(0) as i32+ }++ /// The choice a row names; a row off the list is the default.+ pub fn from_row(row: i32) -> Self {+ usize::try_from(row)+ .ok()+ .and_then(|row| Self::ALL.get(row).copied())+ .unwrap_or_default()+ }}impl Preferences {diff --git a/engine/crates/concat/src/studio.rs b/engine/crates/concat/src/studio.rsindex db502f59..309c596e 100644--- a/engine/crates/concat/src/studio.rs+++ b/engine/crates/concat/src/studio.rs@@ -47,7 +47,7 @@ use crate::format::{};use crate::host::{Host, MediaArt, image_at, image_of, media_art, on_ui, spawn, spawn_art};use crate::i18n::{self, t, tf};-use crate::prefs::Preferences;+use crate::prefs::{AudioTracks, Preferences};use crate::presets::{self, TextPreset};use crate::ui::*;@@ -266,6 +266,10 @@ pub struct SettingsState {pub tab: i32,pub language: usize,pub transcribe_language: i32,+ /// Row of [`AudioTracks`] in the General page.+ pub audio_tracks: i32,+ /// The switch that keeps the playhead inside the content.+ pub playhead_stops: bool,}/// The bottom-right notice: one at a time. The token is what the panel@@ -1391,6 +1395,8 @@ impl Studio {.position(|language| Some(language.code.as_str()) == studio.prefs.locale.as_deref()).unwrap_or(0);studio.settings.transcribe_language = studio.prefs.transcribe_language.unwrap_or(0);+ studio.settings.audio_tracks = studio.prefs.audio_tracks.row();+ studio.settings.playhead_stops = studio.prefs.playhead_stops_at_end;studio.refresh_models();studio}@@ -1964,8 +1970,14 @@ impl Studio {}/// Moves the playhead, the transport with it, and asks for the frame.+ /// Never before zero; past the end of the content only when Settings+ /// lets it, which is the default, so the ruler can be clicked beyond the+ /// last clip and something placed at the playhead there.pub fn seek(&mut self, seconds: f32) {- self.playhead = seconds.clamp(0.0, self.duration().max(0.0));+ self.playhead = seconds.max(0.0);+ if self.prefs.playhead_stops_at_end {+ self.playhead = self.playhead.min(self.duration().max(0.0));+ }self.host.playback.seek(f64::from(self.playhead));self.request_preview();}@@ -2399,7 +2411,8 @@ impl Studio {})};if let Some(id) = created {- self.selection = vec![id];+ self.selection = vec![id.clone()];+ self.settle_audio_tracks(&id);}}@@ -2427,7 +2440,51 @@ impl Studio {})};if let Some(id) = created {- self.selection = vec![id];+ self.selection = vec![id.clone()];+ self.settle_audio_tracks(&id);+ }+ }++ /// The Settings choice for a file with several audio tracks, applied to+ /// a clip just placed from the bin. Nothing for the first track: that+ /// is what a fresh clip plays. The last track is named on the clip; every+ /// track is the sound pulled out, one clip per track, as Detach audio+ /// does. A file with one track has nothing to choose, whatever the+ /// setting says. A second edit after the placement, so an undo takes the+ /// choice back and leaves the clip, the way a freeze frame's trim does.+ fn settle_audio_tracks(&mut self, clip_id: &str) {+ let choice = self.prefs.audio_tracks;+ if choice == AudioTracks::First {+ return;+ }+ let Some(media_id) = self.clip(clip_id).map(|clip| clip.media_id.clone()) else {+ return;+ };+ let tracks = self+ .project()+ .media+ .iter()+ .find(|item| item.id == media_id)+ .map(|item| item.audio_tracks.clone())+ .unwrap_or_default();+ if tracks.len() < 2 {+ return;+ }+ let clip_id = clip_id.to_owned();+ match choice {+ AudioTracks::First => {}+ AudioTracks::Last => {+ self.apply(Command::UpdateClip {+ clip_id,+ patch: ClipPatch {+ audio_stream: Some(tracks.last().map(|track| track.index)),+ ..ClipPatch::default()+ },+ });+ }+ AudioTracks::Every => {+ self.apply(Command::DetachAudio { clip_id });+ }}}@@ -5557,6 +5614,7 @@ impl Studio {.into(),);editor.set_preview_duration(self.duration());+ editor.set_playhead_free(!self.prefs.playhead_stops_at_end);editor.set_playing(self.playing);editor.set_preview_frame(self.preview.clone());sync(&models.stage, self.stage_items());@@ -6342,6 +6400,8 @@ impl Studio {tab: self.settings.tab,language: self.settings.language as i32,transcribe_language: self.settings.transcribe_language,+ audio_tracks: self.settings.audio_tracks,+ playhead_stops: self.settings.playhead_stops,disk: {let installed: Vec<&ModelState> = self.transcribers@@ -6759,7 +6819,9 @@ impl Studio {.collect();let start = f64::from(self.playhead.max(0.0));for media_id in ids {- self.apply(Command::AddClipAtFirstFree { media_id, start });+ if let Some(id) = self.apply(Command::AddClipAtFirstFree { media_id, start }) {+ self.settle_audio_tracks(&id);+ }}}diff --git a/engine/crates/concat/ui/app.slint b/engine/crates/concat/ui/app.slintindex bf380414..5ff9cd7c 100644--- a/engine/crates/concat/ui/app.slint+++ b/engine/crates/concat/ui/app.slint@@ -185,6 +185,8 @@ export component App inherits Window {callback settings-language-changed(index: int);callback settings-theme-changed(dark: bool);callback settings-transcribe-language-changed(index: int);+ callback settings-audio-tracks-changed(index: int);+ callback settings-playhead-stops-changed(on: bool);callback model-activated(id: string);callback model-download(id: string);callback model-cancel(id: string);@@ -464,6 +466,8 @@ export component App inherits Window {transcribe-language-changed(index) => {root.settings-transcribe-language-changed(index);}+ audio-tracks-changed(index) => { root.settings-audio-tracks-changed(index); }+ playhead-stops-changed(on) => { root.settings-playhead-stops-changed(on); }model-activated(id) => { root.model-activated(id); }model-download(id) => { root.model-download(id); }model-cancel(id) => { root.model-cancel(id); }diff --git a/engine/crates/concat/ui/dialogs/settings.slint b/engine/crates/concat/ui/dialogs/settings.slintindex 9b69b6eb..72c73fa6 100644--- a/engine/crates/concat/ui/dialogs/settings.slint+++ b/engine/crates/concat/ui/dialogs/settings.slint@@ -7,6 +7,7 @@ import { Glyph, Icon } from "../icons.slint";import { Button, DialogSection, Modal, Progress } from "../primitives/modal.slint";import { IconButton } from "../primitives/panel.slint";import { SegmentedControl } from "../primitives/segmented-control.slint";+import { Switch } from "../inspector/controls.slint";import { PaneScroll } from "../workspace/pane.slint";// Settings: a fixed-height sheet with a column of pages down the side. The@@ -48,6 +49,11 @@ export struct SettingsData {language: int,/// the transcriber's working languagetranscribe-language: int,+ /// what a clip of a file with several audio tracks plays when placed:+ /// 0 the first track, 1 the last, 2 every track as its own clip+ audio-tracks: int,+ /// the playhead stops at the end of the content+ playhead-stops: bool,/// "3 installed · 612 MB on disk"disk: string,version: string,@@ -372,6 +378,8 @@ export component SettingsDialog inherits Modal {/// on, which is the whole reason it moved in here.callback theme-changed(dark: bool);callback transcribe-language-changed(index: int);+ callback audio-tracks-changed(index: int);+ callback playhead-stops-changed(on: bool);callback model-activated(id: string);callback model-download(id: string);callback model-cancel(id: string);@@ -466,16 +474,74 @@ export component SettingsDialog inherits Modal {PaneScroll {horizontal-stretch: 1;- if root.data.tab == 0: DialogSection {- first: true;- title: I18n.t("Language");-- // Native names: whoever is stranded in a language they cannot- // read must still recognise their own in this list.- for name[index] in root.languages: Choice {- label: name;- current: index == root.data.language;- clicked => { root.language-changed(index); }+ if root.data.tab == 0: VerticalLayout {+ DialogSection {+ first: true;+ title: I18n.t("Language");++ // Native names: whoever is stranded in a language they+ // cannot read must still recognise their own in this list.+ for name[index] in root.languages: Choice {+ label: name;+ current: index == root.data.language;+ clicked => { root.language-changed(index); }+ }+ }++ // Off, the playhead goes wherever the ruler is clicked, past+ // the last clip included, so a clip can be placed out there.+ // On, it stops where the content does.+ DialogSection {+ title: I18n.t("Playhead");++ HorizontalLayout {+ spacing: 6px;++ Text {+ text: I18n.t("Stop at the end of the content");+ color: Theme.fg;+ font-size: Theme.fs;+ vertical-alignment: center;+ }++ Rectangle { horizontal-stretch: 1; }++ VerticalLayout {+ alignment: center;+ Switch {+ checked: root.data.playhead-stops;+ toggled(on) => { root.playhead-stops-changed(on); }+ }+ }+ }++ Text {+ text: I18n.t("Off, a click on the ruler past the last clip lands the playhead there, and a clip placed at the playhead goes with it. On, the playhead never leaves the content.");+ color: Theme.fg-muted;+ font-size: Theme.fs;+ wrap: word-wrap;+ }+ }++ // A file with one audio track has nothing to choose, so this+ // only ever matters for a recording that kept the desktop and+ // the microphone apart. It sets what a placed clip starts on;+ // the Audio panel changes any one clip afterwards.+ DialogSection {+ title: I18n.t("Audio tracks");++ SegmentedControl {+ options: [I18n.t("First track"), I18n.t("Last track"), I18n.t("Every track")];+ current: root.data.audio-tracks;+ changed(index) => { root.audio-tracks-changed(index); }+ }++ Text {+ text: I18n.t("What a clip plays when its file has more than one audio track, as a screen recording with the desktop and the microphone apart does. Every track puts each one on a sound lane of its own, the way Detach audio does. The Audio panel can change any clip afterwards.");+ color: Theme.fg-muted;+ font-size: Theme.fs;+ wrap: word-wrap;+ }}}diff --git a/engine/crates/concat/ui/editor.slint b/engine/crates/concat/ui/editor.slintindex e3b1cf71..8a3567fd 100644--- a/engine/crates/concat/ui/editor.slint+++ b/engine/crates/concat/ui/editor.slint@@ -168,6 +168,8 @@ export global Editor {in-out property <bool> has-picture;in-out property <string> preview-clip-name;in-out property <float> preview-duration;+ /// The playhead may sit past the end of the content; see Settings.+ in-out property <bool> playhead-free;/// The engine's composited frame at the playhead, or an empty image/// while one is on its way. Set from Rust; see `Studio::request_preview`.in-out property <image> preview-frame;diff --git a/engine/crates/concat/ui/workspace/preview-pane.slint b/engine/crates/concat/ui/workspace/preview-pane.slintindex ec51e321..f840671e 100644--- a/engine/crates/concat/ui/workspace/preview-pane.slint+++ b/engine/crates/concat/ui/workspace/preview-pane.slint@@ -587,6 +587,9 @@ export component PreviewPane inherits Rectangle {// ── where the playhead is ────────────────────────────────────────────in property <float> playhead;in property <float> duration;+ /// The playhead may go past `duration`: the step and end buttons stay+ /// live out there and the timecode field takes any frame.+ in property <bool> playhead-free;in property <bool> playing;/// Whether anything is under the playhead, and what. "Nothing under the/// playhead" is a real state a monitor has to render, not a placeholder@@ -640,7 +643,7 @@ export component PreviewPane inherits Rectangle {property <float> total-frames: Math.round(root.duration * root.frame-rate);property <float> frames: Math.round(root.playhead * root.frame-rate);property <bool> at-start: root.frames <= 0;- property <bool> at-end: root.frames >= root.total-frames;+ property <bool> at-end: !root.playhead-free && root.frames >= root.total-frames;// The NumberField writes to its own `value`, and an assignment in Slint// replaces whatever binding the parent declared — so this is seeded, not@@ -801,7 +804,7 @@ export component PreviewPane inherits Rectangle {width: 116px;value <=> root.shown-frames;minimum: 0;- maximum: root.total-frames;+ maximum: root.playhead-free ? 1000000000 : root.total-frames;step: 1;// Scrubbing a timecode should walk frames at the// speed a hand expects, not fly a hundred at once.diff --git a/engine/crates/concat/ui/workspace/seat.slint b/engine/crates/concat/ui/workspace/seat.slintindex 9e4e2389..3688a225 100644--- a/engine/crates/concat/ui/workspace/seat.slint+++ b/engine/crates/concat/ui/workspace/seat.slint@@ -151,6 +151,7 @@ export component Seat inherits Rectangle {quality-index: Editor.quality-index;playhead: Editor.playhead;duration: Editor.preview-duration;+ playhead-free: Editor.playhead-free;playing: Editor.playing;has-picture: Editor.has-picture;clip-name: Editor.preview-clip-name;