Skip to content

Export: Create a Video page with progress and Cancel - #628

Open
NikitkaRa wants to merge 4 commits into
storytold:mainfrom
NikitkaRa:feat/video-export-dialog
Open

NikitkaRa wants to merge 4 commits into
storytold:mainfrom
NikitkaRa:feat/video-export-dialog

Conversation

@NikitkaRa

Copy link
Copy Markdown
Contributor

Stacked on #622 (→ #616 → #608); review only the last commit. No issue: closes the "Export dialog page" item of the docs/gaps.md video export entry and the ui-parity Export row's "Create a Video".

Summary

  • File › Export › Create a Video page:
    • Resolution: Ultra HD 4K, Full HD 1080p, HD 720p or Standard 480p.
    • Frames per second: 24, 25, 30 or 60.
    • Seconds on each slide without a timing, and seconds before each animation click.
    • Sound: AAC in MP4, uncompressed PCM in MOV, or none.
    • Include hidden slides.
    • Create Video button.
  • While it runs: the options are locked, a flat accent-coloured progress bar shows "Frame n of N", and Cancel stops the export after the current frame without writing a file. When it ends, the status bar shows "Exported … (x s)" (with the first warning, if any), "Video export cancelled", or the error.
  • Commands (the UI stays thin):
    • app.exportVideo {path?, height?, fps?, secondsPerSlide?, secondsPerClick?, audio?, includeHidden?} asks where to save unless a path is given (suggesting .mov for PCM) and runs the export on a thread of its own. Only one export runs at a time.
    • app.cancelVideoExport.
    • On the web, where there are no threads, the video is encoded right away and downloaded.
  • Engine: video::encode_with(…, progress) adds a callback that can stop the export (with video::CANCELLED). cmd::file::video_opts is shared by file.export and the page, so both read the options the same way.
  • Docs: gaps.md, ui-parity.md (File tab and Export rows) and the parity-checklist row (M → P; GIF is still Export: animated GIF of the deck (Export… dialog, CLI, MCP) (#171) #177).

Test plan

  • cargo xtask ci (fmt, clippy, test, assets, layers, wasm)
  • UI test export_creates_a_video_with_the_chosen_options (egui_kittest, real clicks): opens Export › Create a Video, checks every control is there, picks 480p from the Resolution list, then exports with PCM sound. It asserts the save dialog suggested <title>.mov, the file is ISO-BMFF, the status says Exported, and the presentation keeps its own path.
  • UI test a_video_export_shows_progress_and_can_be_cancelled: the progress bar shows "Frame …", a second export is refused while one runs, Cancel gives "Video export cancelled" and no file is written, and app.cancelVideoExport then reports nothing to cancel.
  • Engine test progress_counts_frames_and_can_cancel.
  • Checked by eye: both tests' windows rendered to PNG (DECKCRAFT_UI_SHOTS), showing the options page and the page mid-export with the bar, frame count and Cancel.

Parity checklist: Files › Export video row updated (P); ui-parity Export row updated.

anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
)

A page's /Contents array is one content stream in pieces that writers may
split between any two tokens (ISO 32000-2 §7.8.2). Edit text parsed each
piece on its own, so an operator whose operands ended one piece and whose
keyword started the next arrived with no operands: a `[(After) -20 (wards)]`
/ `TJ` split made the line vanish from text_lines, text_paragraphs and
text_edit, and from the Edit text tool.

The joined-parse logic the redaction interpreter used (storytold#153) moves into
pdfcraft-content as `Pieces`: join the pieces, parse them as one stream,
map positions back to pieces, and splice joined byte ranges back into
per-piece bytes (an edit replacing or removing an operator that spans
pieces rewrites every piece it touches; untouched pieces keep their
objects). text_lines now interprets the joined operators, and replace_line
and rewrite_block splice through `Pieces`. Redaction uses the same helper.

Lines and paragraphs are grouped by the piece their first operator starts
in, as before, so pages whose pieces are separate drawings don't merge.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
NikitkaRa and others added 4 commits October 16, 2026 19:48
file.export writes .mp4/.mov: each slide's transition, then the slide
held for its "advance after" time (else secondsPerSlide), at a chosen
height (480p to 4K) and frame rate, hidden slides left out unless asked.

Frames come from the slide and transition renderers and are encoded by
a new Constrained Baseline H.264 encoder in deckcraft-h264 (CAVLC,
Intra 16x16 with V/H/DC prediction, unchanged macroblocks skipped,
deblocking off), checked bit-exact against our decoder, and muxed with
deckcraft-isobmff (faststart). A key frame starts every slide and
transition and at least every 2 s. No external tool is needed.

Co-authored-by: Cursor <cursoragent@cursor.com>
Exported video now plays each slide's in-slide animations on the slide-show
timeline (a secondsPerClick pause before each click step; with/after-previous
and timed effects play as in the show) and carries a sound track: embedded
audio (autoplay and Media effects, trim, fades, volume, loop, play across
slides), narration clips and transition sounds, mixed to 48 kHz stereo.

Sound is AAC-LC by default via deckcraft-aac, a pure-Rust encoder ported from
FilmCraft (layer 1, no new third-party deps), or 16-bit PCM in .mov
(audio: pcm); audio: none drops it. Video clips still show their poster frame.

Co-authored-by: Cursor <cursoragent@cursor.com>
A video clip that plays (autoplay or a Media effect) now shows its pictures
in the exported video instead of its poster frame. Pictures come from
deckcraft-media's VideoDecoder (the slide show's own decoder), decoded in
order as the export's clock reaches them, with trim, loop and rewind honoured;
after the end the last picture stays unless the clip rewinds. A still or held
slide is rendered per frame only while a clip on it plays.

RenderOpts gains video_frames (straight RGBA per media shape), which the
renderer draws over the clip's frame in place of the poster. Clips that can't
be decoded keep the poster and are listed in the export's warnings.

Co-authored-by: Cursor <cursoragent@cursor.com>
File › Export › Create a Video sets the resolution (4K, 1080p, 720p, 480p),
frames per second, seconds on each slide and before each click, the sound
(AAC in MP4, uncompressed in MOV, none) and hidden slides, then exports in
the background: the page shows a progress bar counting frames and a Cancel
button, and the status bar reports the result.

Commands: app.exportVideo (asks where unless given a path; .mov for PCM)
and app.cancelVideoExport. The engine gains video::encode_with (progress
callback that can stop the export) and cmd::file::video_opts, so the page
and file.export read the same options. On the web the video is encoded at
once and downloaded.

Co-authored-by: Cursor <cursoragent@cursor.com>

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: Export › Create a Video page with progress and Cancel. The lock hunk is the same deckcraft-aac addition as in the rest of the series by this author (deckcraft#608, #616, #622), so the stack must merge in order. PowerPoint's Create a Video page (quality, timings, narration, Create Video, progress) is the oracle. A long export must run off the UI thread, report progress and honour Cancel by stopping the encoder and deleting the partial file; a test of Cancel is the proof. I read the lock hunk. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

@aiongg aiongg added the missing feature The reference application has it and we do not, or only part of it label Nov 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing feature The reference application has it and we do not, or only part of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants