Frame-exact export: MP4, PNG frames, green screen #14

Closed
opened 2026-11-01 23:21:18 +00:00 by Weissstreifen · 1 comment

Export a scene, or a time range of it, without a screen recorder.

  • Command line: dub run -- scenes/demo.txt --export out/demo.mp4 --scale 2 --fps 60 [--from 2 --to 8], and a key in the player (E) that exports the whole scene with the settings from the scene file.
  • The scene time steps by exactly 1/fps per frame (playback is a pure function of time, see the playback issue).
  • Formats:
    • MP4 (H.264, yuv420p, high quality CRF) on the solid background.
    • PNG frames (demo_00001.png), with alpha when the background is transparent.
    • Green screen: MP4 with the green background, for keying in the editor.
  • Scale: x2 = 1080p, the default, x4 = 4K, x1 = 540p for quick previews.
  • The UI overlay (progress bar, errors, console) never shows in the export. Show progress in the window and in the terminal.
  • Frames go raw into ffmpeg through a pipe. A clear error when ffmpeg is missing.

The recorder belongs in parin_kit, see parin_kit#139. Until it lands, keep it in source/export.d with // TODO: move to parin_kit, see parin_kit#139.

Done when: a 10 second scene exports to a 1080p MP4 whose frames match the player frame for frame.

Export a scene, or a time range of it, without a screen recorder. - Command line: `dub run -- scenes/demo.txt --export out/demo.mp4 --scale 2 --fps 60 [--from 2 --to 8]`, and a key in the player (E) that exports the whole scene with the settings from the scene file. - The scene time steps by exactly 1/fps per frame (playback is a pure function of time, see the playback issue). - Formats: - **MP4** (H.264, yuv420p, high quality CRF) on the solid background. - **PNG frames** (`demo_00001.png`), with alpha when the background is transparent. - **Green screen**: MP4 with the green background, for keying in the editor. - Scale: x2 = **1080p, the default**, x4 = 4K, x1 = 540p for quick previews. - The UI overlay (progress bar, errors, console) never shows in the export. Show progress in the window and in the terminal. - Frames go raw into `ffmpeg` through a pipe. A clear error when ffmpeg is missing. The recorder belongs in parin_kit, see **parin_kit#139**. Until it lands, keep it in `source/export.d` with `// TODO: move to parin_kit, see parin_kit#139`. **Done when:** a 10 second scene exports to a 1080p MP4 whose frames match the player frame for frame.
Weissstreifen added this to the M3 Output milestone 2026-11-01 23:21:18 +00:00
Author
Owner

Found while doing #2: Parin squares the alpha of translucent pixels in the canvas viewport (a shadow with alpha 220 lands as 190 in a transparent PNG). Opaque pixel art is unaffected. For transparent exports, either keep translucent colors out of the look or work around it in the readback (draw the viewport with a premultiplied/custom blend).

Found while doing #2: Parin squares the alpha of translucent pixels in the canvas viewport (a shadow with alpha 220 lands as 190 in a transparent PNG). Opaque pixel art is unaffected. For transparent exports, either keep translucent colors out of the look or work around it in the readback (draw the viewport with a premultiplied/custom blend).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Weissstreifen/daviz#14
No description provided.