Animated documentary in code
You (Claude) build the whole film as code: every character, set, light, sign and camera move is drawn on a canvas each frame by Remotion. No video generation model is used, so characters never get cut off, never change faces between shots, and every frame can be re-rendered after a fix. The only paid step is the voiceover.
The starter project lives next to this file in starter/. It already contains a working engine and a 12-second demo.
First run (set up once)
- Copy
starter/into the user's project folder (for example./my-doc/). Work only in that copy. cd my-doc && npm install(needs Node 18+).npx remotion still src/index.ts Demo out/check.png --frame=180and look at the image. If it shows an office with a seated character and a caption, the engine works. Show it to the user.
The engine (what is in starter/src/engine/)
rig.ts- the character rigdrawHisto(pen, outfit, opts). Outfits: jacket/pants/shoes/shirt/tie colours,hat(fedora/cap/none),hairStyle(slick, bald, tufts, short, swept, long, swoop, mop, curly, spiky, bun, buzz, ponytail, afro, combover, quiff),stache,glasses+glassesStyle,leather,medals,build(lanky/stout/normal/slim),headShape,earrings,lashes... Opts:expr(neutral, smug, grin, happy, shock, angry, yell, worried, panic, content, stern, pout, laugh, sad, sneaky),talk0..1,blink,look-1..1,mode(stand/stroll/sit),phase(walk cycle),lean, hand positionsl/r,prop(newspaper/papers). Design box 600 x 1000, feet at y 975.kit.ts- drawing helpers for sets:shape(filled + ink outline),box,rect,rrect,lin/radgradients,soft(contact shadow),beam/glow/patch(painted light),dust, and lettering that lives ON things:board(wooden signboard),card(taped paper note),hand(painted/chalk/stamp text, auto-shrinks to fit its board),label,print. Fonts:F.sign(Londrina Solid),F.chalk(Caveat Brush),F.stamp(Special Elite),F.paper(Inter).CTX= per-shot switches the set reads (sign text, event frames).types.ts- a SET isLayer[], back to front. Each layer haspar(parallax depth: 0.8 far sky, 1.0 the character plane, 1.1-1.25 foreground) and eitherdraw(pen, frame)orcast: "slotName"(where characters stand).film.tsx- the compositor: spline camera, parallax, character lighting from the shot'slook, light pool, vignette, bloom, grade, burned-in captions, and an audit mode that logs text touching edges/captions/characters.shots.ts-buildPlan(sets, shots, total, audio, subs), camera helperP(x, y, zoom, roll),act(...)to place a character,blinkAt, andtimingHelpers(timing)givingC("l03")(cut before line 3) andW("l03", "word")(the frame a word is spoken).
Study src/demo/office.ts and src/demo/street.ts before writing any set: that is the target finish.
The look (do not drift)
- Characters: white capsule heads, no nose, small oval or line eyes, angular open mouths, thick dark-brown ink that swells on the shadow side, a hard cel shadow plus a soft gradient, a warm rim light. Same outfit in every scene.
- Real people: recognisable by silhouette props only (hair shape, glasses, a signature jacket). Never a traced likeness. Private individuals: deliberately not a likeness.
- Sets: painted in code, layered back to front, drawn past the frame edges (overscan) so the camera can move, painted light (window beams, lamp glows, floor patches), contact shadows where things meet the floor, rich grounded colour.
- Text goes ON things: place names on signboards, dates on chalkboards or calendars, money and headlines on newspapers, documents on paper cards. No floating stickers, no lower-thirds.
- Edit: hard cuts on narration words, shots 2-6 s, every shot a slow eased camera move (never a locked frame), the first 7 seconds cut fast (3-4 shots). No whooshes, no card flips, no glitch effects.
Hard rules (check every one before you deliver)
- Text never leaves its board and never touches a frame edge, even during camera moves. Prefer wide framings over crops of text-heavy sets. Run the audit render (below) and fix every EDGE / SUB / ACTOR line.
- No flicker: nothing switches on/off in a single frame. Never use
Math.random()(use the seededhh(i, s)), never step things withMath.floor(f / n). Lights ease on, counters roll, signs fade in withsm(). - No body problems: nobody is cut by the frame bottom mid-chest unless it is a deliberate close-up; people behind a desk sit in a cast slot BETWEEN the chair layer and the desk layer; nobody walks through furniture; nobody vanishes mid-shot; characters are never blurred.
- Facts: every claim in the script has a source. Real people never get invented dialogue: only verbatim, on-record quotes, and the narrator says who said it. Allegations are attributed ("according to reports in ...").
- Never clone a real person's voice. The narrator is a stock ElevenLabs voice the user picks.
- No set more than about 5 shots in a row unless it is a deliberate recurring device.
- Ask the user before anything that costs money, and say what it costs.
Pipeline
- Research. Pick a true story. Build
docs/FACTS.md: every fact on its own line with its source URL and a tag: CONFIRMED / REPORTED / DENIED / UNKNOWN. Use web search; prefer primary sources. - Script. Write
docs/script.txt: one narration line per paragraph, blank line between them (this is whatvoice.pyreads). About 150 words per minute. A narrator with attitude, short punchy lines, a new turn every 20-45 seconds, chapters for anything over 4 minutes, and an ending that separates what is confirmed from what is not. Show the user the script and get a yes before voicing. - Cast. Define each character as an outfit in
src/episode/cast.ts. Render a model sheet (a still of each character in a simple set) and get the user's approval before building scenes. - Voice. The user needs an ElevenLabs account. Ask them to set the key in their own terminal
(
export ELEVENLABS_API_KEY=..., never paste it into chat or a file) and pick a narrator voice id. Then:python3 scripts/voice.py docs/script.txt . --voice <id>This writespublic/vo/lNN.mp3andsrc/episode/timing.json. Re-voice one line with--only l07. Fix pronunciation by rewriting the text (spell years and odd names out). - Sets. One file per set in
src/episode/sets/, exported asLayer[], registered inEpisode.tsxwith alook(LK(ambient, shade, keyColour, keyX, keyY, shadowPool, vignette)). Build 4-8 sets for a 4-minute film. Check each set with a still before using it. - Shot plan. In
src/episode/Episode.tsx, list the shots in time order:{ set, a: C("l04"), from, to, ctx, cast }. Cut on words withW(line, word). Split any shot longer than ~8 s.npx tsc --noEmit -p tsconfig.jsonmust pass. - Check before rendering. One still per shot at its middle frame:
npx remotion still src/index.ts Episode out/shot07.png --frame=<frame> --scale=0.5Look at every still yourself. Fix cut-off text, heads hidden by desks, characters through furniture. - Audit + render. Audit pass (fast, half size):
npx remotion render src/index.ts Episode out/audit.mp4 --scale=0.5 --props='{"audit":true}' 2>&1 | grep "AUD|"Fix every reported line. Then the final:npx remotion render src/index.ts Episode out/episode.mp4 - Sound. Optional but recommended: a quiet music bed (about 20 dB under the voice) and a few real sound effects on key moments (a door, a stamp, a crowd). Mix with ffmpeg, keep the voice at about -14 LUFS.
- QA. Pull a contact sheet (
ffmpeg -i out/episode.mp4 -vf fps=1/3,scale=480:-1,tile=6x6 out/sheet.jpg) and look for black frames, frozen shots, text off its board. Fix, re-render, deliver with a title that says the payoff.
Gotchas
F.*fonts load from Google Fonts at render time; the compositor waits for them. Renders need internet once.- Remotion copies
public/into a temp folder for every render: keeppublic/small (voice files only). - Long films render faster in chunks:
--frames=0-2999,--frames=3000-5999, then join with ffmpeg concat. - A set's draw function gets the shot-local frame
f(0 at the cut). Use it for anything that moves. - If
W(line, word)throws, the word is not in that line: checktiming.jsonfor how the voice spelled it.