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
$ npx remotion-ui@latest add srt-caption-trackRenders 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 →
@/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-uinpm package; it is copied into your project.
Usage
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
| Prop | Type | Default | Description |
|---|---|---|---|
| src | string | - | URL of an SRT or WebVTT file. Fetched behind delayRender(). |
| source | string | - | Raw subtitle text, when the transcript is already in hand. |
| captions | Caption[] | - | Pre-parsed captions — e.g. from Whisper, which has real word timing. |
| wordTiming | "distribute" | "cue" | "distribute" | Subtitle files have no word timestamps. `distribute` spreads each cue across its words by length so highlight styles have something to highlight. |
| combineTokensWithinMilliseconds | number | 1200 | Tokens closer than this share a page. |
| offsetInFrames | number | 0 | Shift the whole track. Positive delays it. |
| renderPage | (page: TikTokPage, index: number) => ReactNode | - | Draws one page. Defaults to CaptionHighlight. |
| activeColor | string | "#ff6b00" | Passed to the default renderer. |
| inactiveColor | string | "#ffffff" | Passed to the default renderer. |
| fontSize | number | - | Passed to the default renderer. |