Skip to content

feat(studio): export video from the studio#36

Merged
LeadcodeDev merged 1 commit into
mainfrom
feat/studio-export
Jul 18, 2026
Merged

feat(studio): export video from the studio#36
LeadcodeDev merged 1 commit into
mainfrom
feat/studio-export

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

Closes #15.

Goal: render the current scenario to a video file from the studio — previously the Present button only replayed and users had to leave for the CLI.

  • Reuses the exact CLI encode path (same ffmpeg probe → encode_with_ffmpeg, openh264 fallback → encode_video); Skia stays the only engine, no new dependencies
  • Background std::thread fenced by catch_unwind (PR fix(studio): surface write/reload errors, restore debounce, avoid mutex poisoning #30 pattern) — a renderer panic becomes Export failed, never a stuck state
  • Real progress: the EncodeProgress callback drives the button label (Rendering… 42%, Encoding… 63%, Muxing…), polled every 150ms into a signal
  • Output: <source dir>/<stem>.mp4 (export.mp4 when no path), full path shown on success; single export at a time via an app-global slot that survives Library↔Editor navigation
  • Accepted deviation: the export thread reloads from disk instead of cloning (ResolvedScenario is not Clone; the watcher already makes disk authoritative). Known micro-race: an inspector edit still inside the 250ms debounce may miss the export.

Verify: cargo check -p rustmotion-studio ✓ · cargo test --workspace → 181 passed (4 new export unit tests) ✓ · cargo fmt --check ✓ · clippy 0 warnings ✓

Export button renders the current scenario through the exact CLI
pipeline (ffmpeg probe then encode_with_ffmpeg, openh264 fallback)
on a background thread fenced by catch_unwind, with real progress
(Rendering/Encoding percent, Muxing) polled into the topbar label.
Output lands next to the source as <stem>.mp4. The model lock is
held only to snapshot path+raw; the scenario is reloaded on the
export thread (ResolvedScenario is not Clone; disk is authoritative
via the watcher). App-global OnceLock slot guarantees one export at
a time and survives Library/Editor navigation.
@LeadcodeDev
LeadcodeDev merged commit ece0faa into main Jul 18, 2026
@LeadcodeDev
LeadcodeDev deleted the feat/studio-export branch July 18, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(studio): export video from the studio

1 participant