# display-captions

display-captions — a rule that walks through drawing captions in Remotion: grouping them into TikTok-style pages and highlighting whichever word is being spoken.

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 849 repo stars
- Author: coleam00
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/coleam00/second-brain-skills/tree/HEAD/.claude/skills/remotion/rules/display-captions.md
- Updated: 2026-01-24
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/display-captions

## What it does

Existing `Caption` data can be drawn on screen. The snippets rely on `@remotion/captions`, so the package goes in first; the rule lists the add command for npm and its bun, yarn and pnpm counterparts.

\`createTikTokStyleCaptions()` handles the grouping. `combineTokensWithinMilliseconds` decides how many words share a page — a larger value keeps more of the line visible at once. Pages are rendered one per `<Sequence>`, with start and end frames derived from the page `startMs` and the video `fps`.

Per-word highlighting reads the page `tokens`. Each token carries `fromMs` and `toMs`, and whichever range covers the current moment gets the highlight colour. Inside a sequence the clock restarts at zero, so `page.startMs` has to be added back before comparing — skip that and the wrong word lights up.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/rules/display-captions.md` — The paths frontmatter field limits the files

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### Cursor

**Manually: put the files in place**
- File: `.cursor/rules/display-captions.mdc` — Frontmatter: description, globs, alwaysApply

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/display-captions.instructions.md` — The applyTo field sets which files it applies to

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/display-captions.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/display-captions.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/coleam00/second-brain-skills/tree/HEAD/.claude/skills/remotion/rules/display-captions.md

## When to use it
- turn a finished transcript into TikTok-style caption pages
- highlight the word being spoken at the current frame
- split a long caption list into timed pages
- convert caption milliseconds into Remotion frame counts
- centre caption text over the video

## Example prompts
- Render the captions as TikTok-style pages in Remotion, switching every 1200 ms
- Highlight the word being spoken right now in `#39E508`
- Add `@remotion/captions` and lay out each caption page inside a `<Sequence>`

## Similar
- [remotion-captions](https://affpapa.org/en/nevibecode/skills/remotion-dev-remotion-captions.md) — skill · 373700 installs
- [ffmpeg-captions-subtitles](https://affpapa.org/en/nevibecode/skills/ffmpeg-captions-subtitles.md) — skill · 634 installs
- [viral-video-animated-captions](https://affpapa.org/en/nevibecode/skills/viral-video-animated-captions.md) — skill · 196 installs
- [embedded-captions](https://affpapa.org/en/nevibecode/skills/embedded-captions.md) — skill · ★ 328 repo stars
- [caption-animation](https://affpapa.org/en/nevibecode/skills/caption-animation.md) — skill · 4300 installs
- [remotion-video-toolkit](https://affpapa.org/en/nevibecode/skills/remotion-video-toolkit.md) — skill · 804 installs

From the same set: [coleam00/second-brain-skills](https://affpapa.org/en/nevibecode/by/coleam00/second-brain-skills.md) — 33 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
