Skip to main content
rule CX Codex

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

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/display-captions.md
Open on GitHub

What 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/captions and lay out each caption page inside a <Sequence>

How to install display-captions

Manually: put the files in place

.claude/rules/display-captions.md

The paths frontmatter field limits the files

Step 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.

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set33

The whole set →
calculate-metadata The calculate-metadata rule configures Remotion composition metadata before rendering, including duration, dimensions, FPS, props, and the output filename. CX Codex +1 ★ 849repo stars measuring-text measuring-text — a rule to calculate text size, fit fonts to containers, and detect overflow. Use it when building dynamic text in Remotion and need precise dimensions to avoid clipping or wrong scaling. CX Codex +1 ★ 849repo stars fonts Guides Claude Code on loading Google Fonts and local font assets in Remotion video projects without render glitches. CX Codex +1 ★ 849repo stars videos videos — a rule for embedding video in Remotion compositions with trimming, volume control, playback speed, looping and pitch adjustment. Lets you work with video files in animations without repeating boilerplate code. CX Codex +1 ★ 849repo stars compositions Sets guidelines for structuring Remotion compositions, still frames, folders, and dynamic metadata in src/Root.tsx. CX Codex +1 ★ 849repo stars transitions This rule guides Claude Code in adding fullscreen transitions between Remotion scenes or clips. Use it when building a composition from multiple scenes. CX Codex +1 ★ 849repo stars audio Rule for handling sound in Remotion: import audio files, trim, adjust volume and playback speed, shift pitch. Requires the @remotion/media package. CX Codex +1 ★ 849repo stars gifs gifs is a Claude Code rule for synchronizing GIF, APNG, AVIF, and WebP animations with Remotion composition timelines. CX Codex +1 ★ 849repo stars

Project sponsors

Companies that keep this analytics open