Explainer videos
Narration first. Picture timed to the spoken words. A verified MP4 at the end.
Contents
- Pick the pipeline
- Rules for every pipeline
- Setup
- Pipeline A. Manim
- Pipelines B and C. Remotion
- Scripts
- Data shapes
- Audio levels
- Deliver
- References
Pick the pipeline
Route by the request. Read the pipeline's reference before writing any code.
| The request | Pipeline | Reference |
|---|---|---|
| Explain a concept, protocol, codebase or comparison with diagrams | A. Manim, 3Blue1Brown style | manim.md, manim-style.md |
| A polished illustrated film with sound design and a score, often from a supplied script | B. Remotion film | remotion-film.md |
| A product launch or demo of a real app | C. Remotion over Playwright captures | remotion-demo.md |
| A crafted motion-graphics piece with 60 fps motion blur | D. Psychopomp (Rust) | psychopomp.md |
| Cut, tighten or package an existing recording | E. video-edit-cli | recordings.md |
When the request could be either an explainer or a product demo, ask which before building. An agent once built a mechanism explainer when a promo was wanted.
Pipeline A is the default. It runs end to end from a one-line prompt and is the cheapest. Pipelines B, C and D stop at approval gates. stages.md lists the gates and Sam's prompts for each stage.
Rules for every pipeline
- Brief before build. Write
brief.mdfirst: audience and prerequisites, the one question the video answers, the misconception to dislodge, the central visual metaphor, the "aha" moment, and target length at about 150 spoken words a minute. In B, C and D, show the brief and wait for approval before building. In A, keep going unless the user asked to see it. - Every claim traces to a source you read. For code topics, read the source, not only the README. Sparse-clone repos into
src/. Fact-check the script before any paid voice. - Invent nothing. No made-up product names, URLs, people, numbers or UI. No "demo data" or "prototype" labels on screen. If something does not exist yet, say so in the brief and ask.
- The key lives in the environment. Run
preflight.shbefore any paid step. Never print, guess or echo the key, and never paste it into a prompt or file. The scripts readELEVENLABS_API_KEY, notELEVEN_API_KEY. If the key is missing, tell the user before any paid step. The free scratch voice still works. Never mix voiced and silent segments in a delivered film. - Spend once. Freeze the script wording before paid voice. Run every paid script with
--dry-runfirst and report the characters or seconds. Draft with the free scratch voice (--provider say) where the pipeline allows. Every script caches by a hash of its inputs. Regenerate a take with--redo(narrate.pyandsfx.pytake keys,music.pytakes none), never by deleting caches or lock files. - Plan the mix before generating audio. Decide which sounds, where, and at what level relative to the voice before calling
sfx.pyormusic.py. A reference video for the sound design helps. First-pass effects were "far too loud" when this was skipped. - Look at what you render. A render that finishes proves the code runs, not that it looks right. Review every draft with
contact_sheet.shand full-size frames, using a new filename each round. review.md has the per-frame checklist. - Small requests stay small. When the user asks for one change, change only that. Sam's phrase for this is "not the content, just that".
- Long runs keep a decision log. Append
ts, phase, decision, why, evidence, resultrows todecisions.tsvso another agent can pick up a crashed run.
Setup
$SKILL below means the folder holding this file, for example ~/.claude/skills/explainer-videos. Scripts run in place from $SKILL/scripts. They need only Python 3's standard library, ffmpeg and ffprobe.
SKILL=~/.claude/skills/explainer-videos
bash "$SKILL/scripts/preflight.sh" manim # or remotion, psychopomp, all
preflight.sh checks ffmpeg filters (loudnorm, ebur128, sidechaincompress, alimiter, drawtext), libx264, the ElevenLabs key without printing it, macOS say, fonts, and the pipeline's toolchain. Fix every FAIL before starting. A missing key is a WARN, because the scratch voice needs none.
- ffmpeg. Homebrew's
ffmpeg-fullhasdrawtext(contact-sheet timestamps) and libass. It is keg-only, so put$(brew --prefix ffmpeg-full)/binfirst onPATH. Plainffmpegworks without timestamps. - Manim. On macOS,
brew install cairo pango pkg-config, thenuv tool install manimanduv tool update-shell. On NixOS,pip install manimfails building pycairo, so usenix build nixpkgs#manim. - Remotion. Node.js with npm. The starter pins
remotionand@remotion/cli4.0.538. - Voice.
python3 "$SKILL/scripts/narrate.py" --list-voiceslists the voices on the account. Put the chosen ID inscript.jsonorELEVENLABS_VOICE_ID. There is no default voice.
Pipeline A. Manim
One NarratedScene per video. say(key) starts a clip. at(word) waits until 0.2 s before a spoken word. remaining() is the time left in the clip plus 0.35 s of padding, and done() holds until then. Read manim.md for the full workflow and manim-style.md before the first scene.
Set up the project and write brief.md, storyboard.md and the real segments in script.json:
mkdir -p dns-explainer/review && cd dns-explainer
cp "$SKILL/assets/script.json" "$SKILL/assets/manim/scene.py" "$SKILL/scripts/narrated.py" .
python3 "$SKILL/scripts/narrate.py" script.json --out audio --dry-run # billable characters, no key or voice needed
Pick a voice with narrate.py --list-voices and put its ID in script.json. Then narrate, draft and review:
python3 "$SKILL/scripts/narrate.py" script.json --out audio
manim -ql --disable_caching scene.py Explainer > review/render.log 2>&1 || tail -30 review/render.log
grep '^SYNC' review/render.log # must print nothing
bash "$SKILL/scripts/contact_sheet.sh" media/videos/scene/480p15/Explainer.mp4 review/sheet-1.png 5 4
When the draft passes review, render and finish:
manim -qh --disable_caching scene.py Explainer > review/render-hq.log 2>&1 || tail -30 review/render-hq.log
python3 "$SKILL/scripts/finish.py" media/videos/scene/1080p60/Explainer.mp4 dns-explainer.mp4
bash "$SKILL/scripts/master.sh" dns-explainer.mp4
bash "$SKILL/scripts/verify.sh" dns-explainer.mp4 review/render-hq.log
With a music bed from music.py, add --music audio/music.mp3 to the finish.py line. Run Manim from the project folder, because narrated.py loads audio/ relative to it. finish.py ducks the bed under the voice with a sidechain, adds the soft mov_text caption track from Manim's .srt, and writes AAC with +faststart.
Pipelines B and C. Remotion
The starter in assets/remotion/ renders a captioned film from script.json with no scene code. Each segment key shows a placeholder until a component is registered for it in src/scenes.tsx.
Build the scratch cut. It costs nothing and gives the user a full film to approve:
mkdir dns-film && cd dns-film
cp -R "$SKILL/assets/remotion/." . && cp "$SKILL/assets/script.json" .
export EXPLAINER_SKILL="$SKILL" # package.json falls back to ~/.claude/skills/explainer-videos
npm install
npm run voice:scratch # macOS say, word times estimated by character count
npm run timeline # public/audio/timing.json -> src/timeline.json (frames)
npm run studio # build scenes against the scratch cut
npm run typecheck && npm run render # out/film.mp4, the scratch cut
Stop and show the scratch cut. Only after the user approves it, make the paid version. Write sfx.json and music.json and place the effects and MUSIC first (remotion-film.md):
npm run voice -- --dry-run && npm run voice
npm run timeline
npm run sfx -- --dry-run && npm run sfx
npm run music -- --dry-run && npm run music
npm run typecheck && npm run render
npm run master && npm run verify
- Scenes cue on words with
cue(key, "word"), the frame of that word relative to the segment start. It throws when the word is missing, so a script edit cannot silently break a cue. - Music goes in through
MUSICinsrc/Film.tsx. It is ducked per frame bysrc/duck.ts, an automation curve built from the narration timings. - Sound effects go in as
<Audio>inside a<Sequence>at a level in dB relative to the voice, becausesfx.pynormalises every clip to the narration's loudness. The starter places none. remotion-film.md has the component. - Pipeline B's design gates (storyboard, art direction, three style versions) are in remotion-film.md. Pipeline C's capture and choreography are in remotion-demo.md.
Scripts
Run each script from the project folder. Every paid script has --dry-run, which needs no key.
| Script | Does | Main flags |
|---|---|---|
preflight.sh [manim|remotion|psychopomp|all] | Checks tools, filters, fonts and the key | |
narrate.py script.json | One MP3 per segment plus timing.json with word times, via ElevenLabs /with-timestamps. Neighbouring text goes along as previous_text and next_text. Every take is kept in <out>/.takes/, so returning to earlier inputs costs nothing | --out DIR, --provider elevenlabs|say, --say-voice NAME, --redo k1,k2, --dry-run, --list-voices |
narrated.py | NarratedScene for Manim. Copy next to scene.py | |
timeline.py script.json | Lays segments on a frame timeline for Remotion, with captions. Fails if a segment is missing from timing.json, its text changed, or its MP3 is missing. Re-run narrate.py after changing voice or settings | --timing, --public, --out, --fps 30, --lead 0.25, --tail 0.45, --outro 3.0, --hold key=sec |
sfx.py sfx.json | Generates sound effects and normalises each to --target on every run | --out audio/sfx (npm run sfx uses public/sfx), --target -23, --redo a,b, --dry-run |
music.py music.json | Generates a music bed from a prompt or a per-chapter composition plan, normalised to --target on every run | --out audio/music.mp3 (npm run music uses public/audio/music.mp3), --target -23, --redo, --dry-run |
finish.py RENDER.mp4 OUT.mp4 | Manim finish. Ducked music bed, soft captions from RENDER.srt when it exists, AAC, faststart | --music FILE, --music-db -11 |
master.sh VIDEO.mp4 [LUFS] | Static gain to -16 LUFS plus a -2 dBFS limiter, in place. Keeps caption streams | |
verify.sh VIDEO.mp4 [RENDER.log] [LUFS] | PASS or FAIL for h264, aac, A/V drift, loudness, true peak and SYNC lines | |
contact_sheet.sh VIDEO OUT.png [COLS] [ROWS] | Grid of evenly spaced frames, timestamped when ffmpeg has drawtext | |
loudness.py FILE... | Prints duration, integrated LUFS and true peak per file |
eleven.py and loudness.py are shared modules. eleven.py reads the key from ELEVENLABS_API_KEY, then XI_API_KEY, then .env.local or .env in the working folder, and retries HTTP 429, 500, 502 and 503.
Data shapes
script.json. Segment order is video order. One to four sentences per segment, so a fix re-records seconds.
{"voice_id": "<voice id>", "model_id": "eleven_multilingual_v2",
"voice_settings": {"stability": 0.5, "similarity_boost": 0.75},
"segments": {"intro1": "Every good explainer answers one question.", "core1": "..."}}
timing.json, written by narrate.py: {key: {duration, hash, text, words: [{w, start, end}]}} in seconds.
sfx.json: {"sounds": {name: {prompt, seconds, influence?, loop?}}}. Example prompts are in audio.md.
music.json is the request body for ElevenLabs POST /v1/music. Use either prompt with music_length_ms and force_instrumental, or composition_plan.chunks with one chunk per chapter, each 3 to 120 seconds.
src/timeline.json, written by timeline.py, in frames:
{"fps": 30, "total": 1234,
"segments": [{"key": "intro1", "start": 0, "voice": 8, "end": 230, "audio": "audio/intro1.mp3",
"words": [["Every", 12, 20]]}],
"captions": [[12, 95, "Every good explainer answers one question."]]}
A segment's scene starts at start, its voice at voice (start plus lead), and the next segment at its end.
Audio levels
sfx.py and music.py normalise every clip to -23 LUFS by default. Set --target to the narration's loudness, which loudness.py audio/*.mp3 prints. With every clip at one loudness, a placement level is dB relative to the voice.
| Layer | Level | Where it is set |
|---|---|---|
| Music under speech | -17 dB, lifting to -11 in pauses of 1.5 s or more and -8 after the last line | duck.ts (Remotion) |
| Music bed, Manim | -11 dB under the voice before a sidechain duck keyed on the voice | finish.py --music-db |
| Sound effects | Accents sat a median of about 24 dB under voice peaks in Sam's mix, never within 6 dB | the <Audio volume> per placement |
| Master | -16 LUFS integrated, true peak at or below -1 dBTP | master.sh, checked by verify.sh |
audio.md has voice settings, SFX and music prompts, the three ducking methods and costs.
Deliver
verify.sh must pass, and the last contact sheet must have been looked at. Then report:
- the output path, duration and resolution,
- loudness and true peak from
verify.sh, - ElevenLabs characters, SFX seconds and music length generated, from the dry runs,
- anything not verified, such as a fact you could not source or a frame you did not check.
References
Read only what the current stage needs.
| File | Read when |
|---|---|
| stages.md | Planning the run. Stage order, gates and Sam's prompts per stage |
| manim.md | Building pipeline A, including parallel chapter workers for long videos |
| manim-style.md | Before the first Manim scene. Look, layout rules and Manim gotchas |
| remotion-film.md | Building pipeline B. Design gates, scenes, cues and the scratch-voice cut |
| remotion-demo.md | Building pipeline C. Capturing the real app and choreographing it |
| psychopomp.md | Building pipeline D |
| recordings.md | Editing real footage with video-edit-cli |
| audio.md | Any voice, SFX or music work, and mixing |
| review.md | Every draft. Frame checklist, feedback rounds and how Sam steers |