---
name: captions-and-chapters
description: Make captions, chapter maps and feature timestamps from the FINAL edit of a video, never from the draft - word timing from the final audio, words corrected to the approved script's screen spelling, cue length and reading speed, line breaks, safe zones for 16:9 and 9:16, burned-in captions versus SRT and WebVTT sidecar files, YouTube chapter rules (0:00 first, at least three, each 10 seconds or longer), and setting links that land inside the right chapter. Ships two scripts - word timings to SRT/VTT, and chapters to YouTube description lines with the rules checked. Load it for any captions, subtitles, SRT, VTT, transcript, chapters, timestamps, YouTube description, "add captions", "make chapters" or "the chapter link opens the wrong part" job.
metadata:
  license: AGPL-3.0-or-later
  copyright: "2026 DevTribe Labs"
  homepage: https://github.com/DevDadTribe/toolbox
---

# Captions and chapters

Captions and chapters are the last thing built and the first thing a viewer trusts. When they are
made from the draft, every cut after that moves the words: a caption shows a line the voice no
longer says, a chapter link opens the previous section, a burned-in cue covers the button being
clicked. The fix is simple and strict: **build them from the final edit, then check them against
the final film.**

The examples use an invented product, **Acme Bookings**.

| File | What it holds |
|---|---|
| `references/captions.md` | word timing, spelling, cue rules, line breaks, safe zones, burned-in versus sidecar, SRT and VTT details |
| `references/chapters.md` | chapter maps from final frames, YouTube chapter rules, setting and feature timestamps, player data |
| `scripts/captions_from_words.py` | word timings (Whisper-style JSON) to SRT and/or VTT with length, duration and reading-speed rules |
| `scripts/chapters_to_youtube.py` | chapter starts in frames to YouTube description lines and a WebVTT chapters file, rules checked |
| `examples/acme-words.json`, `examples/acme-chapters.json` | small inputs to try both scripts |

## The order

1. **Lock the picture and the mix.** Captions and chapters come after the last cut. Any later
   change in length means building them again.
2. **Get word times from the final audio.** Run Whisper or faster-whisper with word timestamps on
   the final mixed narration (or the narration stem laid on the final timeline). Not on the raw
   take: edits moved every word.
3. **Correct the words to the approved script.** Speech-to-text spells brands wrong. Captions use
   the script's screen spelling, not its speech spelling and not the transcript's guess.
4. **Build the cues** with `scripts/captions_from_words.py`, then read them.
5. **Build the chapter map** from measured final frames (`references/chapters.md`), then
   `scripts/chapters_to_youtube.py` for the description lines.
6. **Check against the film:** play each chapter link, look at a frame under every burned-in cue,
   read the sidecar file in a real player.

## Hard rules

1. **Final edit only.** Never ship captions or chapter times from a draft or from the script's
   planned timing.
2. **One source of words.** The approved script, with screen spelling. The transcript gives the
   times, not the spelling.
3. **Clamp every cue end to the next cue's start.** Overlapping cues stack on screen at cuts.
4. **Captions never cover what the voice is pointing at,** nor the presenter's face, nor the
   platform's own buttons on 9:16.
5. **Ship a sidecar file for anything with speech** (VTT for the web, SRT where asked). Burn
   captions in as well for social and ads that autoplay muted.
6. **A changed VTT does not fix a burned-in caption.** Re-render the picture.
7. **Chapters start where their section starts,** on the first spoken word or the section intro,
   and cover the whole film with no gaps.
8. **Rebuild every timestamp after any change in length**: captions, chapters, setting links.
9. **Compare times at frame precision.** Floating-point seconds once sent a chapter link to the
   previous chapter (626.8333 rounded the wrong way).
10. **Never caption an availability label** ("beta", "coming soon"). If the voice says it, the
    film is wrong; see `video-brief-script-shots`.

## Default numbers

| Rule | 16:9 tutorial | 9:16 social or ad |
|---|---|---|
| Characters per line | up to 42 | up to about 26, or 2 to 4 words a cue |
| Lines per cue | up to 2 | 1 (2 at most) |
| Cue duration | 1 to 6 s | 0.5 to 2.5 s for word-group captions |
| Reading speed | up to about 17 to 20 characters a second | the same, the pace of speech |
| Text height | at least 30 px at 1080p | about 48 to 60 px at 1080 wide |
| Where | lower third, off the click target | inside the platform's safe zone, clear of the bottom UI |

These are starting points. Check the platform's current safe-zone and caption guidance.

## Quick commands

```bash
python3 -I scripts/captions_from_words.py --help
python3 -I scripts/captions_from_words.py examples/acme-words.json --format both --out /tmp/acme
python3 -I scripts/chapters_to_youtube.py --help
python3 -I scripts/chapters_to_youtube.py examples/acme-chapters.json --vtt /tmp/acme-chapters.vtt

# word times with faster-whisper (pip install faster-whisper)
python3 -c "from faster_whisper import WhisperModel as W; import json,sys; \
s,_=W('small.en').transcribe(sys.argv[1], word_timestamps=True); \
print(json.dumps([{'word':w.word.strip(),'start':w.start,'end':w.end} for x in s for w in x.words]))" final-mix.wav > words.json

# burn a sidecar into the picture (re-render; a sidecar edit alone never changes burned pixels)
ffmpeg -i film.mp4 -vf "subtitles=film.srt:force_style='FontSize=22,MarginV=60'" -c:a copy film-captioned.mp4
```

Optional: if you have Remotion's own `remotion-captions` skill installed, use it to draw animated
word captions from the same corrected word list. The rules here still apply.

## Related skills

`video-brief-script-shots` (the script and chapter list these build from), `narration-and-presenter`
(where the words come from), `motion-design` (caption motion), `long-tutorial-pipeline` (long
chaptered films), `review-and-publish` (player checks after upload), `anti-ai-slop-copy` (chapter
titles and descriptions).

## Say what you checked

Name what you checked: which chapter links you played, which cues you looked at under the picture,
which player loaded the sidecar. Write NOT VERIFIED, in those words, for the rest.
