RemotionUI

SRT Caption Track

Render Remotion captions straight from an SRT or WebVTT file. Install with npx remotion-ui@latest add srt-caption-track.

PrimitiveData & media

srt-caption-track30fps · 960×540
Install
$ npx remotion-ui@latest add srt-caption-track

Renders a caption track directly from an SRT or WebVTT file.

This is a utility, not a look. Every caption style in the registry takes a TikTokPage, which until now had to be hand-authored — so the styles could only be demoed against a handful of fake words. This turns a real transcript into those pages and sequences them.

Any caption style

renderPage swaps in whichever style should draw the page. The default is caption-highlight.

<SrtCaptionTrack
  src={staticFile("episode.srt")}
  renderPage={(page) => <KaraokeCaptions page={page} mode="underline" />}
/>

Subtitle files have no word timing

An SRT cue says "these nine words happen between 4.2s and 6.8s" and nothing more, so a word-highlight style fed raw cues has nothing to highlight.

wordTiming="distribute" (the default) spreads each cue's span across its words weighted by length, which tracks a read closely enough for a highlight to follow it. wordTiming="cue" keeps each cue as one token instead — honest, but only useful for styles that show a whole line at once.

If real word timestamps are available — from Whisper, for instance — pass them through captions and no distribution happens.

Loading

src is fetched behind delayRender(), so the render waits for the file rather than producing empty frames. Pass source instead when the transcript text is already in hand.

Utility, not a look. Installs @remotion/captions and caption-highlight.

Agent notes

Install first, then import the copied source component locally. AI guide →

Import
@/remotion/primitives/srt-caption-track
  • Use when: captioned videos, social clips, and synced text scenes.
  • Customize: src, source, captions, wordTiming, plus copied source for timing, layout, colors, and typography.
  • Rule: do not import this component from the remotion-ui npm package; it is copied into your project.

Usage

Example
import { SrtCaptionTrack } from "@/remotion/primitives/srt-caption-track"; <SrtCaptionTrack src={staticFile("episode.srt")} /> // Any caption style can render the pages. <SrtCaptionTrack src={staticFile("episode.srt")} renderPage={(page) => <KaraokeCaptions page={page} mode="underline" />} />

API Reference

PropTypeDescription
srcstringURL of an SRT or WebVTT file. Fetched behind delayRender().
sourcestringRaw subtitle text, when the transcript is already in hand.
captionsCaption[]Pre-parsed captions — e.g. from Whisper, which has real word timing.
wordTiming"distribute" | "cue"Subtitle files have no word timestamps. `distribute` spreads each cue across its words by length so highlight styles have something to highlight.
combineTokensWithinMillisecondsnumberTokens closer than this share a page.
offsetInFramesnumberShift the whole track. Positive delays it.
renderPage(page: TikTokPage, index: number) => ReactNodeDraws one page. Defaults to CaptionHighlight.
activeColorstringPassed to the default renderer.
inactiveColorstringPassed to the default renderer.
fontSizenumberPassed to the default renderer.

Related

On this page