Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

Merge remote-tracking branch 'origin/main' into fix-338

Brandon Thomase196de8f6409
diff --cc ROADMAP.md
index a64821adb,2640adb6a..343522b31
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@@ -159,8 -159,9 +159,11 @@@ Status: ✅ done · 🟡 in progress �
## Log
+- **2026-10-08 (Source range dragging):** implicit full-clip In/Out, video-only/audio-only/linked both controls, picture/waveform drag gestures and one-command undoable timeline placement. Shared Source/Program draggable frame-bounded handles and range translation, cancellation, Source marker/navigation routing and marked-range playback/looping.
+- **2026-10-08 (Source playback):** normal forward playback for video/audio media and subclips in the Source monitor, an independent Source clock, Play/Pause and focused Space, frame stepping, device-clock audio with wall-clock fallback, seeking, and end-of-clip stopping. Windows desktop review verified a real video file and standalone WAV, including In/Out marking. Reverse/shuttle Source playback and source sequences remain unsupported; no parity percentage changed.
+ - **2026-10-08 (night):** HDR H.265 (HEVC Main 10, PQ and HLG, BT.2020, limited range) export on Windows through NVENC (#30): an HDR sequence now exports as real 10-bit HDR (`rgbf_to_yuv420_10` into P010 input buffers; VUI BT.2020 + PQ / HLG; the HDR10 mastering-display and content-light messages as SEI on every IDR for PQ, through the generic SEI payload array because NVENC 12.1 has no mastering-display field; `colr` / `mdcv` / `clli` in the sample entry), where the GPU reports 10-bit HEVC (new `register_hdr_probe` / `hdr_available` in the export crate; elsewhere, and on macOS, HDR sequences still tone-map to 8-bit SDR HEVC, and `settings.sdr` forces that). ffprobe reads `hevc` / `Main 10` / `hvc1` / `yuv420p10le` / `bt2020` / `smpte2084` or `arib-std-b67` / `bt2020nc` / `tv` with the mastering-display and content-light side data for PQ; ffmpeg's decode equals ours code for code; the in-process round trip is at 71.1 dB luma PSNR on the 10-bit scale with 803 distinct levels on a ramp and the peak code 940 intact (RTX 5060). 8-bit SDR H.265 is unchanged.
+ - **2026-10-08:** H.265 (HEVC Main, 8-bit 4:2:0, SDR) export on Windows through NVENC (#30): the NVENC session, ring and NV12 path of the H.264 encoder now serve both codecs (the H.264 export is byte-for-byte unchanged); the format is available where the GPU has an HEVC encoder, choosing it is the opt-in, and `hvcC` is built from the SPS the encoder wrote. ffprobe reads `hevc` / `Main` / `hvc1` / `yuv420p` / BT.709; our own HEVC decoder decodes it at 48.9 dB luma PSNR (RTX 5060). Main 10 and HDR remain.
+ - **2026-10-08 (#285):** `filmcraft-cli` no longer panics with "Broken pipe" when its stdout is closed early (`filmcraft-cli commands | head`): later output is dropped, the rest of the work (script lines, `--save`, `--save-as`) still runs, and the exit status still reports failures. Other stdout write errors are reported and make the exit status 1. No change to the checklist or estimates.
- **2026-10-06:** 21 community PRs landed (#19, #28, #38, #39, #41–#60). Highlights: hardware decoding is now actually on in the desktop app (#41: `register()` sat inside a `log::info!` that never ran, so #33's VideoToolbox path only worked in the CLI and benchmarks); decode memory on long timelines cut sharply (frame pool, shared GOP-cache budget, positional file reads); exports are byte-identical across machines (#19); crash fix for odd track names over MCP (#44); ripple trim, ripple delete and speed changes move split-edit clips once (#56–#58); Japanese interface using an installed system font (#38; no fonts bundled); MCP annotations, resources, export progress and cancellation (#28).
diff --cc crates/engine/src/commands.rs
index 11062a042,28abaf252..cd02fab2d
--- a/crates/engine/src/commands.rs
+++ b/crates/engine/src/commands.rs
@@@ -1609,22 -1645,15 +1645,23 @@@ fn build() -> Vec<CommandSpec>
})?;
Ok(Value::Null)
}),
+ // With no In / Out mark, like Premiere: the start / end of the sequence (#208).
- cmd!("markers.goToIn", "Go to In", ["Markers"], Some("Shift+I"), "{}", has_seq, |s, _| {
+ cmd!("markers.goToIn", "Go to In", ["Markers"], Some("Shift+I"), r#"{"target":"program|source"}"#, always, |s, p| {
+ if let Some(v) = crate::source_monitor::route(s, "markers.goToIn", p)? {
+ return Ok(v);
+ }
+ s.active_sequence().ok_or(EngineError::NoSequence)?;
- if let Some(i) = s.active_sequence().and_then(|q| q.mark_in) {
+ if let Some(i) = s.active_sequence().map(|q| q.mark_in.unwrap_or(Tick::ZERO)) {
s.set_playhead(i);
}
Ok(Value::Null)
}),
- cmd!("markers.goToOut", "Go to Out", ["Markers"], Some("Shift+O"), "{}", has_seq, |s, _| {
+ cmd!("markers.goToOut", "Go to Out", ["Markers"], Some("Shift+O"), r#"{"target":"program|source"}"#, always, |s, p| {
+ if let Some(v) = crate::source_monitor::route(s, "markers.goToOut", p)? {
+ return Ok(v);
+ }
+ s.active_sequence().ok_or(EngineError::NoSequence)?;
- if let Some(o) = s.active_sequence().and_then(|q| q.mark_out) {
+ if let Some(o) = s.active_sequence().map(|q| q.mark_out.unwrap_or_else(|| q.duration())) {
s.set_playhead(o);
}
Ok(Value::Null)
diff --cc crates/engine/src/lib.rs
index 109abc3ff,443fa567d..066240896
--- a/crates/engine/src/lib.rs
+++ b/crates/engine/src/lib.rs
@@@ -1106,6 -1105,5 +1106,8 @@@ mod trim_tests
mod vfx_tests;
#[cfg(test)]
mod voiceover_tests;
+
+#[cfg(test)]
+mod source_placement_tests;
+ #[cfg(test)]
+ mod wasm_clock_tests;
diff --cc crates/ui-egui/README.md
index 6e52ea1bf,dcc629e90..21ff94e6d
--- a/crates/ui-egui/README.md
+++ b/crates/ui-egui/README.md
@@@ -1,22 -1,29 +1,47 @@@
- # filmcraft-ui-egui
+ # FilmCraft interface
- FilmCraft's L5 egui frontend: panels, docking, commands, rendering and playback. Project edits
- always dispatch engine commands; playback and monitor state belong to the frontend.
+ The egui frontend draws panels and dialogs, and dispatches project changes through the engine.
+ Interactive controls keep stable automation ids regardless of the interface language.
+
+ ## Localisation
+
+ Edit > Language offers English, Japanese and Spanish. The language is stored in the engine's
+ `general.interfaceLanguage` preference, restored on startup, and also available in Settings > General.
+ Its default, System Language (`system`), follows the operating system: the first of the user's
+ preferred languages that the interface has (the host supplies them through
+ `HostHooks::system_languages`: `sys-locale` on the desktop, `navigator.languages` on the web),
+ otherwise English.
+ The `app.language.*` UI commands and `prefs.set` reach it through the control channel.
+ Japanese requires a craft-fonts build or a suitable installed font.
+
+ English source strings are lookup keys in `src/i18n/<code>.tsv`. `tl!` translates literals, `tlf!`
+ fills translated templates, and `i18n::t` translates names from registries. Placeholder values
+ (including user filenames containing braces) are inserted literally. Catalog translations are
+ original work using ordinary language, without proprietary localisation resources.
+
+ Spanish covers menus, panels, dialogs, settings and registry labels. Searches accept both the
+ translated label and its English source, including Unicode capitals. Project content, command ids
+ and preference values retain their original values. Engine errors, CLI and MCP messages remain
+ English; Japanese currently covers core menus and falls back to English elsewhere.
+
+ Verification: `cargo test -p filmcraft-ui-egui` checks catalog syntax, duplicate keys, placeholders,
+ literal/menu/registry coverage and UI behaviour; `cargo xtask ci` runs the workspace gates. Visual
+ checks use the control channel to switch language and capture the resulting panels.
+
+## Source playback
+
+`source_playback.rs` auditions media independently of Program playback. It reuses MediaSource
+decoding, output mapping, the device clock and the desktop play-ahead buffer. Only one monitor
+owns the device at a time. Source frame jobs use the existing frame server and Source resolution.
+The live project, undo stack and timeline playhead are unchanged. See [monitor documentation](../../docs/monitors.md)
+for behavior, commands, limitations and regression tests. Source playback tests use synthetic
+demo media and fake audio outputs; no third-party assets are introduced.
+
+Source drag controls snapshot the selected span and dispatch `timeline.place` for video, audio,
+or linked video/audio. Full-clip marks are implicit until set by the user. The engine owns edits,
+range validation and undo; the UI owns the drag gesture. See `source_drag_ui` and the engine's
+`source_placement_tests` for regression coverage.
+
+Source range handles use transient gesture previews and the engine's integer-frame
+`source_monitor::adjust_range`; release dispatches one mark edit. Monitor command routing
+keeps Source navigation, markers and marked-range playback separate from Program.
diff --cc crates/ui-egui/src/panels/monitor.rs
index 9c6bb1261,146e0aae0..0c4590ee7
--- a/crates/ui-egui/src/panels/monitor.rs
+++ b/crates/ui-egui/src/panels/monitor.rs
@@@ -301,10 -298,7 +320,10 @@@ pub fn show(app: &mut FilmcraftApp, ui
monitor_view::zoom_menu(app, &zresp, which);
let res = mv.res;
let rr = Rect::from_min_size(pos2(row1.max.x - 196.0, row1.min.y), vec2(62.0, 24.0));
+ if which == Which::Source && rr.min.x > zr.max.x + 12.0 {
+ crate::panels::source_drag::controls(app, ui, Rect::from_min_max(pos2(zr.max.x + 6.0, row1.min.y), pos2(rr.min.x - 6.0, row1.min.y + 24.0)));
+ }
- let rresp = crate::widgets::dropdown_text(ui, rr, res.label(), &t, egui::Id::new((prefix, "res")));
+ let rresp = crate::widgets::dropdown_text(ui, rr, crate::i18n::t(res.label()), &t, egui::Id::new((prefix, "res")));
app.auto.add(&format!("{prefix}.resolution"), rr, "Select Playback Resolution");
egui::Popup::menu(&rresp).show(|ui| {
for r in PlaybackRes::ALL {
@@@ -321,34 -315,24 +340,34 @@@
ui.set_min_width(240.0);
monitor_view::wrench_items(app, ui, which);
let mv = monitor_view::view_mut(app, which);
- ui.checkbox(&mut mv.safe_margins, "Safe Margins");
- ui.checkbox(&mut mv.show_transport, "Show Transport Controls");
+ ui.checkbox(&mut mv.safe_margins, tl!("Safe Margins"));
+ ui.checkbox(&mut mv.show_transport, tl!("Show Transport Controls"));
+ if which == Which::Source {
+ let mut looping = app.source_playback.clock.looping;
- let response = ui.checkbox(&mut looping, "Loop marked range");
++ let response = ui.checkbox(&mut looping, tl!("Loop marked range"));
+ app.auto.add("source.settings.loop", response.rect, "Loop marked range");
+ if response.changed()
+ && let Err(e) = crate::menus::invoke(app, &ctx, "playback.loop", json!({"monitor":"source"}))
+ {
+ app.ui.status = e;
+ }
+ }
if which == Which::Program {
ui.separator();
- ui.checkbox(&mut app.ui.show_scopes, "Lumetri Scopes");
- ui.checkbox(&mut app.playback.looping, "Loop");
+ ui.checkbox(&mut app.ui.show_scopes, tl!("Lumetri Scopes"));
+ ui.checkbox(&mut app.playback.looping, tl!("Loop"));
ui.separator();
let mut follows = app.session.state.multicam_audio_follows_video;
- if ui.checkbox(&mut follows, "Multi-Camera Audio Follows Video").changed() {
+ if ui.checkbox(&mut follows, tl!("Multi-Camera Audio Follows Video")).changed() {
let _ = app.session.execute("multicam.audioFollowsVideo", json!({"enabled": follows}));
}
- ui.checkbox(&mut app.ui.multicam_record, "Multi-Camera Record");
+ ui.checkbox(&mut app.ui.multicam_record, tl!("Multi-Camera Record"));
let v = app.session.state.multicam_view.clone();
for (cmd, label, on) in [
- ("multicam.selectionTopDown", "Multi-Camera Selection Top Down", v.top_down),
- ("multicam.showPreviewMonitor", "Show Multi-Camera Preview Monitor", v.show_preview),
- ("multicam.autoAdjustQuality", "Auto-Adjust Multi-Camera Playback Quality", v.auto_quality),
- ("multicam.transmitView", "Transmit Multi-Camera View", v.transmit),
+ ("multicam.selectionTopDown", tl!("Multi-Camera Selection Top Down"), v.top_down),
+ ("multicam.showPreviewMonitor", tl!("Show Multi-Camera Preview Monitor"), v.show_preview),
+ ("multicam.autoAdjustQuality", tl!("Auto-Adjust Multi-Camera Playback Quality"), v.auto_quality),
+ ("multicam.transmitView", tl!("Transmit Multi-Camera View"), v.transmit),
] {
let mut b = on;
if ui.checkbox(&mut b, label).changed() {
@@@ -528,18 -512,18 +590,18 @@@ fn transport(app: &mut FilmcraftApp, ui
let src = which == Which::Source;
let buttons: Vec<(Icon, &str, &str)> = if src {
vec![
- (Icon::Marker, "markers.add", "Add Marker (M)"),
- (Icon::MarkIn, "src.markIn", "Mark In (I)"),
- (Icon::MarkOut, "src.markOut", "Mark Out (O)"),
- (Icon::GoToIn, "src.goIn", "Go to In (Shift+I)"),
- (Icon::StepBack, "src.stepBack", "Step Back 1 Frame (Left)"),
- (if app.source_playback.clock.playing { Icon::Pause } else { Icon::Play }, "source.playback.toggle", "Play-Stop Toggle (Space)"),
- (Icon::StepFwd, "src.stepFwd", "Step Forward 1 Frame (Right)"),
- (Icon::GoToOut, "src.goOut", "Go to Out (Shift+O)"),
- (Icon::Insert, "source.insert", "Insert (,)"),
- (Icon::Overwrite, "source.overwrite", "Overwrite (.)"),
- (Icon::Camera, "exportFrame", "Export Frame (Shift+E)"),
- (Icon::Proxy, "media.toggleProxies", "Toggle Proxies"),
+ (Icon::Marker, "markers.add", tl!("Add Marker (M)")),
+ (Icon::MarkIn, "src.markIn", tl!("Mark In (I)")),
+ (Icon::MarkOut, "src.markOut", tl!("Mark Out (O)")),
+ (Icon::GoToIn, "src.goIn", tl!("Go to In (Shift+I)")),
+ (Icon::StepBack, "src.stepBack", tl!("Step Back 1 Frame (Left)")),
- (Icon::Play, "src.play", tl!("Play-Stop Toggle (Space)")),
++ (if app.source_playback.clock.playing { Icon::Pause } else { Icon::Play }, "source.playback.toggle", tl!("Play-Stop Toggle (Space)")),
+ (Icon::StepFwd, "src.stepFwd", tl!("Step Forward 1 Frame (Right)")),
+ (Icon::GoToOut, "src.goOut", tl!("Go to Out (Shift+O)")),
+ (Icon::Insert, "source.insert", tl!("Insert (,)")),
+ (Icon::Overwrite, "source.overwrite", tl!("Overwrite (.)")),
+ (Icon::Camera, "exportFrame", tl!("Export Frame (Shift+E)")),
+ (Icon::Proxy, "media.toggleProxies", tl!("Toggle Proxies")),
]
} else {
vec![
@@@ -588,12 -572,12 +650,12 @@@
source_nav(app, cmd);
Ok(serde_json::Value::Null)
}
- "src.play" => Ok(serde_json::Value::Null),
+
"exportFrame" => {
- app.ui.status = "Export Frame: use Export mode (M6)".into();
+ app.ui.status = tl!("Export Frame: use Export mode (M6)").into();
Ok(serde_json::Value::Null)
}
- c => crate::menus::invoke(app, &ctx, c, json!({})),
+ c => crate::menus::invoke(app, &ctx, c, json!({"monitor": if src { "source" } else { "program" }})),
};
if let Err(e) = r {
app.ui.status = e;