remotion-captions
Transcribe, display, and animate captions in Remotion compositions.
Install
npx skills add https://github.com/remotion-dev/skills --skill remotion-captions- metadata
- tags: captions, subtitles, display, element
Displaying captions in Remotion
This guide explains how to display captions in Remotion, assuming you already have captions in the Caption format.
Prerequisites
Read Transcribing audio [blocked] for how to generate captions.
First, the @remotion/captions package needs to be installed.
If it is not installed, use the following command:
Adding the Basic Captions element
Use the Basic Captions element to display captions.
Alternatives are available at Remotion Captions Elements, but use Basic Captions unless there are more precise specifications.
Fetch its source code from https://www.remotion.dev/elements/captions/basic-captions.md and save it as basic-captions.element.tsx in the project unchanged.
Displaying captions alongside video content
Keep each clip's video and captions inside the same <Sequence> or <TransitionSeries.Sequence>.
Put the clip's trimBefore, durationInFrames, and playbackRate on that shared parent so trimming or changing the speed affects both.
For independently positioned clips, put from on the shared <Sequence> too.
Give every captioned clip its own group and inline caption array; do not combine captions from multiple clips into one overlay outside the scene timeline.
Moving, reordering, trimming, or deleting the group then affects its video and captions together.
Putting captions inside a scene is insufficient if trimBefore or playbackRate is still applied only to <Video>: its sibling captions do not inherit those props. Apply them to the shared parent instead.
The Caption editor writes back to the array literal on the selected <BasicCaptions> source node, so inline the captions directly in its captions prop.
Passing a variable or component prop such as captions={captions} leaves no source array for the editor to update.
If the captions were transcribed to a JSON file, copy its contents into the prop.
Give the caption area a width and position it over the video. In this
1920px-wide composition, the 900px caption area is centered by translating it
(1920 - 900) / 2 = 510 pixels from the left:
To change a captioned clip's speed, set playbackRate on its shared sequence.
durationInFrames selects a range of source frames; the group occupies durationInFrames / playbackRate frames in its parent timeline.
Update the composition duration when changing the total timeline length.
If a caption has pageBreakAfter: true, the current page ends after that caption and the next caption starts a new page.
White-space preservation
The captions are whitespace sensitive. You should include spaces in the text field before each word.