CutDirector is an offline film crew that turns a single line of plain English into a playable film — beat sheet, typed shot list, SVG storyboards, EDL, karaoke subtitles, TTS voiceover, ambient WebAudio, and a Director's Console for retiming cuts by hand. Four finished films ship in this repo as real watchable MP4 files — press play on demos/chai-noir/film.mp4 — and as self-contained HTML5 players. No API keys, no network, no build step — download and watch.
The actual films, as MP4s: Chai Noir · Orbital Chase · Sunday Kitchen · The Doorstep — H.264 video with SAPI-narrated voiceover and soft subtitle tracks, all under 2 MB. Prefer interactive? Every film also ships as an HTML5 player:
| Film | One-line premise | Cut | Genre | What to notice |
|---|---|---|---|---|
| Chai Noir (MP4) | A chai-stall wallah works a missing-detective case over kettled steam | 62s (+2.5s end card) | noir | Kettle motif badge recurs on every kettle shot and the payoff line ("The kettle stays in frame a second too long"); rain ambience; whispered confession rides its own speaker-tagged dialogue subtitle |
| Orbital Chase (MP4) | An AI pilot runs a stolen drone to ground inside an orbital storm | 50s (+2.5s) | scifi | Cyan-accent grade, WHIP_PAN/CRANE_UP vocabulary, hard CUT grammar on mood swings, storm-static ambience, dense action shortening cut lengths |
| Sunday Kitchen (MP4) | Three generations argue, soften, and sit down to Sunday dinner | 94s (+2.5s) | warm-drama | Window motif badge through to "The window holds its warmth"; DISSOLVE transition grammar; room-tone hum that gives way to rain when the window beat lands; three distinct voice profiles |
| The Doorstep (MP4) | A lantern, a creak, and footsteps that stop just short of the light | 45s (+2.5s) | horror | Desaturated vignette grade, crickets-at-midnight bed, DUTCH angles on the door burst, motif callback payoff ("The door waits.") |
Every player is one self-contained file: scrubbable timeline, J/K/L transport, fullscreen, mood-keyed procedural WebAudio, word-by-word karaoke subtitles, and a TTS toggle (speechSynthesis voiceover whose per-shot rate is precomputed).
python cutdirector.py "your premise" --mp4 renders film.mp4 next to the HTML artifacts:
- Video — each storyboard SVG is rasterized to PNG by a built-in deterministic painter (Pillow), then Ken Burns motion matching the player's exact move table is applied per shot via ffmpeg
zoompan; shots are chained withxfadecrossfades whose offsets land shot starts exactly on the EDL record grid (CUT = one-frame blend, DISSOLVE = 0.6 s, FADE_IN/OUT = black fades), plus a "THE END" card. - Narration — Windows SAPI (
System.Speechvia PowerShell, offline and free) speaks each shot's script; clips are rate-fitted to their slots and assembled onto the timeline with stdlibwave. If SAPI or PowerShell is unavailable the film ships silent. - Subtitles — the karaoke cue math exports a phrase-grouped
.srt, muxed as a softmov_texttrack (the backup track when narration is absent). - Requirements & fallback — needs
ffmpegandpip install pillow; without either, the CLI prints a note and the HTML player remains the full experience (everything above except this section is stdlib-only). - Size guard — encodes at CRF 28 and automatically bumps CRF until
film.mp4fits under 8 MB (all four demos landed under 2 MB).
Each bake is byte-reproducible. Rerun any showcase scene and diff against demos/ — zero changes:
python -c "from cutdirector import run_pipeline; from demo_scene import DEMO_SCENES; run_pipeline(DEMO_SCENES['chai-noir']['text'], outdir='output/chai-noir', mp4=True)"Swap the key: 'chai-noir' · 'scifi-chase-45' · 'family-kitchen-90' · 'horror-doorstep' (plus the phase-2 four: 'chai-dawn', 'noir-interrogation', 'scifi-chase', 'family-kitchen', or python cutdirector.py --demo). Or feed your own sentence: python cutdirector.py "a lighthouse keeper at dusk counts the ships home".
Every render ships with editor.html — a live cutting room beside the film:
- Edit anything live — narration text, duration (0.5 s+), camera move, transition, angle, shot type, description, and dialogue lines update the timeline and diff as you type.
- Undo/redo stack (50 deep) backs every keystroke.
- DIFF tab lists every changed field as
SH04.duration: 5.4 -> 3.2against the original machine cut. - EXPORT tab downloads your revised cut as
cutdirector-edit.json(and re-imports it later). - Copy Re-render Command puts the exact
python cutdirector.py ... --outdir <slug>-v2command on your clipboard.
Workflow: play the bake → open editor.html → trim the shots that drag → read the DIFF → export the JSON → paste the re-render command. The console never touches the original artifacts.
plain English text
|
v
+------------------+
| story_engine | beats -> acts (setup/conflict/payoff,
| (parse + cast | act proportions .30/.40/.30 short,
| shoot + VO) | .33/.34/.33 standard, .35/.35/.30 mini-film)
+------------------+ characters -> {diction, tempo, tick} voices
| | motif lexicon -> recurring-object stamping
v v genre language -> move bias + transition grammar
+----------+ +-----------+
|storyboard| | edit_plan | EDL + Ken Burns CSS + karaoke cue timing
| (SVGs + | | + audio | env table: rain | city | dawn | crickets |
| grades) | | plan | room | wind -> WebAudio recipe per shot
+----------+ +-----------+ TTS rate = round(clamp(words/duration/3, .6, 1.6), 2)
| |
'---->-------+--> render.py --> player.html (+ editor.html)
- Three-act arcs — every beat stamped setup/conflict/payoff; narration pools shift rhythm per act; payoffs echo a callback noun harvested from the opening beat.
- Motifs — concrete-object lexicon (kettle, lantern, door, window…); the top hit is stamped across matching shots, badged in the player, and answered by a genre-flavored callback sentence in the final payoff shot.
- Genre language — keyword vote picks noir/warm-drama/scifi/horror/romance; each genre biases camera moves, establishing angles, transition grammar, color grade, and ambience.
- Procedural audio — six environments synthesized in-browser (rain band-passed noise, city hum stack, dawn FM birdsong blips, crickets puled sine, room tone, wind lowpass), classified per shot from location/mood/description tokens.
- TTS voiceover — speechSynthesis reads each shot at a rate solved from the 2.5 wps pacing plan so the voice lands inside the cut.
- Karaoke subtitles — word-level cues weighted by word length on the absolute timeline, dialogue words flagged with their speaker.
Capture these exact states for the Devpost gallery:
chai-noir/film.mp4opened in a video player at ~00:10 — narrated MP4 with burned-in player-style frame, proving the film ships as a real filechai-noir @ 00:07— kettle motif badge visible top-left over rain-graded frame- player scrub mid-DISSOLVE
SH04 -> SH05in Sunday Kitchen (two frames blended, timeline handle between shots) - TTS toggle ON with karaoke subtitle mid-sentence — current word highlighted, speaker tag showing on a dialogue line
editor.htmlDIFF tab showing 3 edited rows (old -> new) after trimming two durations and swapping one camera move- horror grade vignette frame from The Doorstep @
SH07burst (DUTCH angle visible) - contact sheet grid of all four genres side by side (four
contact_sheet.htmlpages tiled) - staged CLI output of
python cutdirector.py --demoshowing the six pipeline stages ticking
python -m pytest -q # 351 testsCoverage spans every agent, cinematography/player-cinema/editor/audio suites, the CLI layer, the Phase-2 quality bar, and the Phase-3 showcase suite (tests/test_showcase.py): committed-vs-fresh byte-golden proofs per baked film, runtime-target bands (±25% of 60/45/90/40 s), genre detection, act/motif contracts, and README/DEVPOST promise checks.
- Zero API keys — stdlib Python only; nothing phones home; players run from
file://. - Byte determinism — same text in, same bytes out, forever (md5-seeded decisions, asserted by golden tests down to storyboard SVGs).
- XSS-hardened players — all embedded text escaped; JS uses
textContent, neverinnerHTML; zero external references.