---
name: studio-kinetic-captions
description: Create time-aligned animated captions (word highlight, pop-in, karaoke) for short-form video with Whisper timing, Remotion or FFmpeg/ASS rendering, plus a separate SRT/VTT track. Use for "add captions", "TikTok style subtitles", "burn in subtitles", "animated captions for Reels/Shorts".
version: "1.1.0"
category: build
platforms: [CLAUDE_CODE, CURSOR, CODEX_CLI]
---

# Kinetic video captions

Good kinetic captions are timed to the word, grouped by phrase, held still while the eye reads, and always shipped alongside an editable sidecar file. This skill covers transcription, segmentation, styling, rendering and verification.

## When to use

- Short vertical video (Reels, Shorts, TikTok) that needs burned-in, animated captions.
- Talking-head or voiceover clips where most viewers watch muted.
- Producing both an open-caption render and a closed-caption track (SRT/VTT) for platforms and accessibility.

## Agree on inputs first

- Source video, its resolution, fps and duration (`ffprobe` it).
- Transcript: existing script, or generate one. Script text wins over ASR text when both exist; ASR only supplies timing.
- Style: word-by-word highlight, phrase pop-in, karaoke fill, or static block.
- Brand font and colors; caption position; max words per cue.
- Outputs: captioned MP4, SRT and/or VTT, optional transparent caption overlay.

## Toolchain

- **Timing**: `whisper.cpp` or `faster-whisper` with word timestamps; WhisperX for tighter forced alignment.
- **Rendering**: Remotion (`@remotion/captions` provides `createTikTokStyleCaptions`) for designed animation; FFmpeg with an ASS subtitle file for a fast, dependency-light burn-in.
- **Alternatives**: After Effects or CapCut for manual work; `pysubs2` for generating ASS from Python.

## Workflow

### 1. Get word timings

```bash
# extract 16 kHz mono audio
ffmpeg -i input.mp4 -vn -ac 1 -ar 16000 -c:a pcm_s16le audio.wav

# faster-whisper (Python)
python - <<'PY'
from faster_whisper import WhisperModel
import json
m = WhisperModel("large-v3", compute_type="int8")
segs, _ = m.transcribe("audio.wav", word_timestamps=True, vad_filter=True)
words = [{"text": w.word.strip(), "start": w.start, "end": w.end} for s in segs for w in s.words]
json.dump(words, open("words.json", "w"), indent=1)
PY
```

whisper.cpp alternative: `whisper-cli -m ggml-large-v3.bin -f audio.wav -ojf -ml 1` (one word per segment, full JSON). If you have a script, align it to these timings and fix misheard names and numbers by hand.

### 2. Segment into cues

Rules that match professional subtitle guidelines, tightened for mobile:

- 1 to 4 words per kinetic cue (2 to 3 is typical for vertical); 1 to 2 lines and at most about 32 characters per line for traditional subtitles.
- Break at phrase boundaries (after punctuation, before conjunctions and prepositions). Never split an article from its noun or a name across cues.
- Minimum cue duration 0.7 s (pad into silence if needed); reading speed at most about 17 characters per second (the Netflix adult guideline is 20 cps; slower is safer for animated text).
- Leave a 2 frame gap between consecutive cues, or chain them exactly; never overlap.
- Do not let a cue span a hard cut; end it at the cut frame.

### 3. Pick the safe area

For 1080x1920 vertical, platform UI covers roughly the bottom 20 to 25% (captions, buttons) and the top 10 to 14%, plus a right rail of about 120 px. Place caption centers around 60 to 70% of height (y about 1150 to 1350) and keep a 90 px side margin. For 16:9, use the lower third inside a 5% title-safe margin.

### 4a. Render with Remotion

```tsx
import { createTikTokStyleCaptions } from "@remotion/captions";
const { pages } = createTikTokStyleCaptions({
  captions,
  combineTokensWithinMilliseconds: 1200,
});
// Each page has startMs and tokens[{text, fromMs, toMs}].
// In a <Sequence> per page, highlight the token where fromMs <= nowMs < toMs.
```

Animation guidelines:

- Entry: scale 0.85 to 1.0 with a spring (`spring({frame, fps, config: {damping: 200}})`) over 4 to 6 frames, or a short 6 to 8 px upward slide. No more.
- Emphasis: change color or weight of the active word; avoid scaling the active word so much that line width changes, because a reflowing line forces re-reading. Reserve width with a fixed-width layout or scale from center with `transform` only.
- Keep the baseline and position fixed during a cue.
- Stroke plus shadow for legibility: e.g. 8 px black stroke via `paint-order: stroke` and `-webkit-text-stroke`, or a rounded backplate at 70 to 85% opacity.

```bash
npx remotion render src/index.ts Captioned out/captioned.mp4 --codec=h264 --crf=18
```

### 4b. Render with FFmpeg and ASS

Generate an ASS file (pysubs2 or by hand). Karaoke-style highlight uses `\k` tags in centiseconds:

```
[Script Info]
ScriptType: v4.00+
PlayResX: 1080
PlayResY: 1920

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Cap,Inter,84,&H0000E6FF,&H00FFFFFF,&H00000000,&H64000000,-1,0,0,0,100,100,0,0,1,6,2,2,90,90,620,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:01.20,0:00:02.40,Cap,,0,0,0,,{\fad(80,0)\fscx85\fscy85\t(0,120,\fscx100\fscy100)}{\k30}This {\k40}changes {\k50}everything
```

ASS colors are `&HAABBGGRR` (alpha first, then blue, green, red; alpha 00 is opaque). With `\k`, words start in SecondaryColour and switch to PrimaryColour as they are sung.

```bash
ffmpeg -i input.mp4 -vf "subtitles=captions.ass:fontsdir=./fonts" \
  -c:v libx264 -crf 18 -preset slow -pix_fmt yuv420p -c:a copy -movflags +faststart captioned.mp4
```

### 5. Write the sidecar

SRT uses `HH:MM:SS,mmm`; VTT uses `HH:MM:SS.mmm` and starts with `WEBVTT`. Sidecars should use full phrases (subtitle-length cues), not one word per cue. Convert with `ffmpeg -i captions.srt captions.vtt`. To mux soft subs into MP4: `ffmpeg -i captioned.mp4 -i captions.srt -map 0 -map 1 -c copy -c:s mov_text out.mp4`.

## Common variants

- **Transparent overlay** for an editor: Remotion with `--codec=prores --prores-profile=4444 --pixel-format=yuva444p10le` and transparent background.
- **Horizontal 16:9**: lower third, 2 lines, 42 characters per line max, smaller entry motion.
- **Translated captions**: retime per language; German and French run 20 to 30% longer.
- **No burn-in**: deliver VTT plus SRT only; most platforms accept SRT upload.

## Quality checks

```bash
ffprobe -v error -show_entries format=duration -of csv=p=0 captioned.mp4
ffprobe -v error -show_entries stream=codec_name,width,height,r_frame_rate -of csv=p=0 captioned.mp4
```

Script checks on the cue list:

- Start times strictly increase; every `end > start`; no overlaps; last cue ends before video duration.
- Every cue at least 0.7 s and at most 17 to 20 characters per second.
- No cue crosses a scene cut (`ffmpeg -i input.mp4 -vf "select='gt(scene,0.4)',showinfo" -f null -` lists cut times).
- Contrast: caption fill vs its outline or backplate at least 4.5:1 (WCAG AA); test frames at the brightest background.
- Visual: export stills at the 3 busiest moments (`ffmpeg -ss 12.3 -i captioned.mp4 -frames:v 1 s1.png`) and confirm nothing sits under platform UI.
- Watch the full clip on a phone at 1x, muted. Every cue must be readable before it disappears.
- Spelling of names, brands and numbers matches the script.

## Pitfalls and fixes

| Problem                           | Fix                                                                             |
| --------------------------------- | ------------------------------------------------------------------------------- |
| Captions drift late over time     | Variable frame rate source; transcode to CFR (`-fps_mode cfr -r 30`) before timing |
| Wrong font in burn-in             | libass falls back silently; pass `fontsdir` and check the log for "fontselect"  |
| Line jumps when a word highlights | Active word scaled or bolded changes width; reserve width or only change color  |
| Captions cut off by UI            | Respect the vertical safe area; MarginV about 600 at 1920 tall                  |
| Flicker between cues              | Gaps of 1 frame; chain cues or use at least 2 frames                            |
| Hallucinated words in silence     | Enable VAD and drop words with very low probability                             |

## Deliverables

- [ ] Captioned MP4 (H.264, yuv420p, faststart, original audio)
- [ ] SRT and VTT sidecars with phrase-level cues
- [ ] Word timing JSON and the style source (ASS file or Remotion component)
- [ ] Stills at the 3 hardest moments for contrast review
- [ ] Notes on any script vs spoken differences

[Type Foundry reference](https://skills-hub.ai/showcases/projects/type-foundry)
