Communitygithub.com

motion-doc

Turn any script or text into a voiced, captioned motion-graphics documentary in one fixed visual language — faux desktop, procedural maps, circular ring type, archival cards and a printed closing montage. Uses Remotion for picture, Kokoro for voice, Whisper for word timings and FFmpeg for the mix and burned captions. Use when the user supplies a script, article, narration or voiceover and wants it as a film in this style, or asks for a motion-graphics explainer, doc or reel with this look.

Was ist motion-doc?

motion-doc is a Claude Code agent skill that turn any script or text into a voiced, captioned motion-graphics documentary in one fixed visual language — faux desktop, procedural maps, circular ring type, archival cards and a printed closing montage. Uses Remotion for picture, Kokoro for voice, Whisper for word timings and FFmpeg for the mix and burned captions. Use when the user supplies a script, article, narration or voiceover and wants it as a film in this style, or asks for a motion-graphics explainer, doc or reel with this look.

Funktioniert mit✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/IamChivic/motion-doc-skill/tree/HEAD

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Was macht motion-doc?

A style-locked pipeline: any script becomes a 1080 × 1080, 24 fps motion documentary with the same grammar every time. The style lives in code and in style/; the script only supplies words and beats.

One contract: content/plan.json is the film. Analysis writes it, an editor tightens its copy, Kokoro sets its durations, Remotion renders it, FFmpeg finishes it. Nothing else holds state.


Before you start

npm install                                     # remotion + local fonts
pip install kokoro soundfile faster-whisper      # voice + alignment
sudo apt-get install espeak-ng ffmpeg            # Kokoro fallback G2P, muxing
# no root? pip install imageio-ffmpeg            # bundled ffmpeg binary

Check the optional stack at any time:

python3 scripts/kokoro_tts.py --check
python3 scripts/align_whisper.py --check
python3 scripts/edit.py --check

scripts/render.sh wires up the bundled fonts.conf, local-fonts/ and chrome-libs/, so rendering also works on a bare Linux box where Chrome would otherwise draw no text at all.


Workflow

0. Read the script like an editor

Before running anything, decide: what is the hook, where is the place, what is the evidence, whose voice speaks, what is the last line. If the text has no place and no record, the film will be mostly quote/ring beats — that is allowed, but say so rather than inventing facts.

1. Draft the plan (deterministic)

python3 scripts/analyze.py --script my-script.md --title "The Waterline" \
  --out content/plan.json

It segments narration by spoken time (default 2.6 words/s), scores each beat against the grammar, and extracts phrases for the scene slots. It prints a beat table with seconds and frames — read it.

Script conventions (all optional):

in the scripteffect
# Headingsection break; short headings become ring title cards
> linequote beat, one display line per quoted line
- itemquote beat built from list lines
[[kind: map]]force the next beat's scene
[[pause: 1.2]]hold 1.2 s on the next beat
"quoted phrase"becomes the typed search query / ring candidate

2. Art-direct the copy (the part that matters)

The planner is deliberately literal; it cannot hear the line. Open content/plan.json and rewrite copy per beat against the limits below. This is where the film gets good.

slotlimitnote
ring.text≤ 26 charsone idea, no ellipsis, uppercase
map.word≤ 18 charsa place or a date, not a sentence
map.pins3–5real names from the script
cards.title≤ 54 charsthe record's own title
cards.body≤ 320 charsquote the source, don't paraphrase
quote.lines≤ 5 × 44 charsbreak at breath, last line is the punch
paper.headline≤ 26 charscaps, no ellipsis
paper.columns3 × ~240 charsfinished prose; it is justified
desktop.typed.query≤ 42 charswhat the subject would actually search

Rules: never add ellipses to display type; cut words instead. Keep facts in the script — if the copy needs a fact that is not there, write "to confirm" in note rather than inventing it.

3. Voice it (Kokoro)

python3 scripts/kokoro_tts.py                  # every beat with vo, af_heart
python3 scripts/kokoro_tts.py --voice bm_george --only b03 b04

Each vo line is synthesised to public/audio/<beat>.wav. The beat's frames is then set from the real audio length plus 320 ms of air, and plan.audio cues are rebuilt. Voice is the clock — do not hand-edit frames after this unless you also re-record.

--check prints whether Kokoro, soundfile and espeak-ng are present. If Kokoro is unavailable, rendering still works from the estimated timing; just say the voice track is missing.

4. Render (Remotion)

./scripts/render.sh render        # out/doc.mp4, silent, from content/plan.json
./scripts/render.sh still b03 40  # one frame of one beat, for art direction
./scripts/render.sh beats         # one still per beat -> out/beats/
npm run studio                    # interactive timeline at :3000

Every beat is also its own composition (Beat-b03), so a single frame can be checked without rendering the film.

5. Captions (Whisper)

python3 scripts/align_whisper.py --model small.en

faster-whisper transcribes each voiced beat with word timestamps; words are mapped onto the global timeline through plan.audio, grouped into ≤ 8-word / ≤ 3.4 s cards, and written to:

  • content/captions.json and plan.captions
  • public/captions.srt (portable)
  • public/captions.ass (styled to style/style.json → captions)

Whisper is used only for captions. It never re-times the picture.

6. Finish (FFmpeg)

python3 scripts/edit.py --music music/bed.mp3 --music-gain -23
python3 scripts/edit.py --captions none        # audio only

It mixes every voice cue at its frame offset, adds the music bed with fades, normalises to −16 LUFS / −1.5 dBTP, burns captions.ass, and writes out/final.mp4 (+ out/final.json).

Or all six in one go (no hand art direction)

build.sh overwrites content/plan.json with a fresh draft, so it is for quick turns, not for a curated film:

./scripts/build.sh examples/sample-script.md
./scripts/build.sh my.md --music music/bed.mp3 --captions srt
./scripts/build.sh my.md --skip-tts            # keep existing audio/timing

build.sh skips Kokoro/Whisper with a clear message if they are not installed.


The plan

{
  "version": 1,
  "meta": { "title": "The Waterline", "fps": 24, "width": 1080, "height": 1080,
            "style": "nocturne", "script": "examples/sample-script.md" },
  "voice": { "engine": "kokoro", "voice": "af_heart", "lang": "a", "speed": 1.0 },
  "beats": [
    { "id": "b01", "kind": "desktop", "frames": 144,
      "vo": "narration for this beat", "copy": { "typed": { "query": "vilar de rei" } } }
  ],
  "audio":  [ { "src": "audio/b01.wav", "startFrame": 0, "beat": "b01" } ],
  "music":  { "src": "music/bed.mp3", "gainDb": -23 },
  "captions": [ { "startMs": 0, "endMs": 2400, "text": "The valley is a lake now." } ]
}
  • beats[].frames is authoritative. Sum = film length.
  • kind ∈ desktop | ring | map | cards | zoom | montage | quote.
  • vo is spoken, never drawn.
  • Copy slots per kind: see style/SHOTS.md.
  • Validate any hand edit: python3 -c "import sys;sys.path[:0]=['scripts'];import plan_lib;plan_lib.validate(plan_lib.load('content/plan.json'))"

What must not change

Read style/MOTION.md before touching a scene. In short:

  1. 1080 × 1080, 24 fps, integer frames, hard cuts.
  2. One spring for entrances (damping 14, mass 0.7, stiffness 120, 26 frames).
  3. One eased camera move per beat; no shake, no speed ramps.
  4. Ring type is the only circular device; it surrounds the photo badge.
  5. Palette order mint → plum → chartreuse, no two maps of one colour in a row.
  6. Space Grotesk display / Playfair for records / Inter for UI / Plex Mono for code.
  7. No gradients on type, no shadows on light-ground display type.
  8. The closing newspaper fade is the only dissolve.

Files

SKILL.md                 this file
style/style.json         tokens shared by captions + FFmpeg
style/MOTION.md          animation + type rules (the style contract)
style/SHOTS.md           scene grammar, copy slots, limits
content/plan.json        the film (art-directed example: "The Waterline")
content/captions.json    generated by Whisper
examples/sample-script.md   a script that exercises every scene
scripts/analyze.py       script -> plan draft
scripts/plan_lib.py      load/save/validate/timing helpers
scripts/kokoro_tts.py    voice + real durations
scripts/align_whisper.py word timings -> captions.srt/.ass
scripts/edit.py          FFmpeg mix + burn
scripts/render.sh        Remotion with bundled fonts/libs
scripts/build.sh         all stages
src/plan.ts              plan types + loader
src/Doc.tsx              beats -> scenes, audio cues
src/Root.tsx             Doc + one composition per beat
src/scenes/              Desktop, Ring, Map, Cards, Zoom, Quote, Montage, print
src/components/          MapCanvas (procedural map), Type, Photo, ui chrome
public/assets/           three replaceable images (see "Imagery")

Imagery

Three assets recur across every scene: portrait (the subject), monument (the place object) and waterfall (texture/landscape). Replace public/assets/*.svg with real photos of the same names and update src/assets.ts to the new extensions. The layout depends on square-ish crops, not on content. Maps are drawn in code (MapCanvas), so nothing needs to be supplied for them.

Adding a scene — only if truly needed

  1. Add the kind to SceneKind in src/plan.ts, a copy type, and a case in BeatView (src/Doc.tsx).
  2. Build it from the same primitives (pop, RingType, PhotoBadge, MapCanvas, the palette table) — no new easing or colour.
  3. Add the copy slots + limits to style/SHOTS.md, and a scoring hint to scripts/analyze.py.
  4. Typecheck (npm run typecheck) and render one still before using it.

Verification before delivery

npm run typecheck
python3 -m py_compile scripts/*.py
./scripts/render.sh beats        # one still per beat, catches crashes
./scripts/render.sh render       # full silent film
python3 scripts/edit.py --check  # ffmpeg present

Report honestly: a typecheck and a render prove the film exists, not that it is good. State whether you watched it, whether captions were burned (they need libass + fonts), and which beats are still placeholders.

Troubleshooting

symptomcause / fix
Chrome renders no textno fontconfig: use scripts/render.sh (sets FONTCONFIG_FILE, LD_LIBRARY_PATH)
libnspr4.so: cannot opensame: chrome-libs/ must be on LD_LIBRARY_PATH
Kokoro import errorpip install kokoro soundfile + espeak-ng
Kokoro model downloadfirst run fetches hexgrad/Kokoro-82M (~330 MB), then it is local
Whisper finds no speechcheck public/audio/*.wav exist and plan.audio is populated
captions.ass not burnedlibass needs a real font file: drop Inter-Bold.ttf in public/fonts/ (edit.py passes it as fontsdir) or install fonts system-wide
cuts feel offre-run Kokoro; never hand-tune frames against a transcript
plan rejectedplan_lib.validate names the beat and field

Verwandte Skills