Skip to content

About

CutDirector - an offline film crew. Turns one line of plain English into a playable film: beat sheet, typed shot list, SVG storyboards, EDL, karaoke subtitles, TTS voiceover, ambient WebAudio, and a console for retiming cuts by hand.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

CutDirector — Four films. One line each.

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.

Watch Now

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).

MP4 Export

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 with xfade crossfades 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.Speech via PowerShell, offline and free) speaks each shot's script; clips are rate-fitted to their slots and assembled onto the timeline with stdlib wave. If SAPI or PowerShell is unavailable the film ships silent.
  • Subtitles — the karaoke cue math exports a phrase-grouped .srt, muxed as a soft mov_text track (the backup track when narration is absent).
  • Requirements & fallback — needs ffmpeg and pip 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.mp4 fits under 8 MB (all four demos landed under 2 MB).

Regenerate Any Film

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".

The Director's Console

Every render ships with editor.html — a live cutting room beside the film:

  1. 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.
  2. Undo/redo stack (50 deep) backs every keystroke.
  3. DIFF tab lists every changed field as SH04.duration: 5.4 -> 3.2 against the original machine cut.
  4. EXPORT tab downloads your revised cut as cutdirector-edit.json (and re-imports it later).
  5. Copy Re-render Command puts the exact python cutdirector.py ... --outdir <slug>-v2 command 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.

What The Machine Does

            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.

Screenshots Checklist

Capture these exact states for the Devpost gallery:

  • chai-noir/film.mp4 opened in a video player at ~00:10 — narrated MP4 with burned-in player-style frame, proving the film ships as a real file
  • chai-noir @ 00:07 — kettle motif badge visible top-left over rain-graded frame
  • player scrub mid-DISSOLVE SH04 -> SH05 in 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.html DIFF tab showing 3 edited rows (old -> new) after trimming two durations and swapping one camera move
  • horror grade vignette frame from The Doorstep @ SH07 burst (DUTCH angle visible)
  • contact sheet grid of all four genres side by side (four contact_sheet.html pages tiled)
  • staged CLI output of python cutdirector.py --demo showing the six pipeline stages ticking

Testing

python -m pytest -q        # 351 tests

Coverage 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.

Guarantees

  • 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, never innerHTML; zero external references.

About

CutDirector - an offline film crew. Turns one line of plain English into a playable film: beat sheet, typed shot list, SVG storyboards, EDL, karaoke subtitles, TTS voiceover, ambient WebAudio, and a console for retiming cuts by hand.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages