Skip to main content

Exporting subtitles

The following ways are available for exporting captions in Remotion.

Burned-in subtitles​

If you want the subtitles to be part of the video itself (burned in), render the video as usual.

npx remotion render

Exporting all captions as .srt​

To automatically merge all subtitles from from components which implement captionsSchema and export them as a single .srt file is not yet possible.

Follow this issue to get notified when we implement this.

Emitting a .srt file alongside the render​

If you keep your captions in one place and collect them manually, you can emit a separate .srt file using the <Artifact> component together with serializeSrt().

Exporting captions as .srt
const {pages} = createTikTokStyleCaptions({ captions, combineTokensWithinMilliseconds: 3000, }); const srtContent = serializeSrt({ lines: pages.map(({tokens}) => tokens.map(({text, fromMs, toMs}) => ({ text, startMs: fromMs, endMs: toMs, timestampMs: null, confidence: null, })), ), }); export const MyComp = () => { const frame = useCurrentFrame(); return ( <> {frame === 0 ? <Artifact filename="subtitles.srt" content={srtContent} /> : null} {/* Rest of your video content */} </> ); };

The artifact will be saved to out/[composition-id]/subtitles.srt when rendering.

Show captions only in previews​

Use isRendering from useRemotionEnvironment() to keep captions visible in Studio and the Player while leaving them out of the rendered video.

MyVideo.tsx
import {Video} from '@remotion/media'; import {staticFile, useRemotionEnvironment} from 'remotion'; import {SimpleCaptions} from './SimpleCaptions'; export const MyVideo = () => { const {isRendering} = useRemotionEnvironment(); return ( <> <Video src={staticFile('video.mp4')} /> {isRendering ? null : <SimpleCaptions />} </> ); };

See also​