display-captions — Claude Code rule: TikTok-style captions in Remotion
display-captions — a rule that walks through drawing captions in Remotion: grouping them into TikTok-style pages and highlighting whichever word is being spoken.
no license ★ 849 updated 2026-01-24
.claude/rules/display-captions.mdWhat display-captions 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.
What it helps with
- 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 for the agent
- Render the captions as TikTok-style pages in Remotion, switching every 1200 ms
- Highlight the word being spoken right now in
#39E508 - Add
@remotion/captionsand lay out each caption page inside a<Sequence>
How to install display-captions
Manually: put the files in place
.claude/rules/display-captions.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/display-captions.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/display-captions.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/display-captions.mdManually: put the files in place
.clinerules/display-captions.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about display-captions
How to install display-captions in Claude Code?
Copy the rule file into the project at .claude/rules/display-captions.md. Claude then reads it whenever the work touches captions in Remotion.
What does display-captions do?
It shows how to group captions into TikTok-style pages and highlight the active word, with code for createTikTokStyleCaptions(), rendering inside <Sequence> and comparing token timings.
What do I need before using the examples?
The @remotion/captions package and captions that already follow the Caption format. Without the package the imports will not resolve.