Captionv4.0.216
This is a simple data structure for a caption.
tsx
import type {Caption } from '@remotion/captions';
tsx
import type {Caption } from '@remotion/captions';
By establishing a standard data structure, we allow many operations that involve captions to be interoperable:
- Transcribing: Using the
@remotion/install-whisper-cpp
or@remotion/openai-whisper
packages - Formatting: For example, creating pages using
createTikTokStyleCaptions()
- Parsing: Using the
parseSrt()
function - Serializing: For example to a
.srt
file usingserializeSrt()
Fields
text
The text of the caption.
startMs
The start time of the caption in milliseconds.
endMs
The end time of the caption in milliseconds.
timestampMs
The timestamp of the caption as a singular timestamp in milliseconds.
When using @remotion/install-whisper-cpp
, this the t_dtw
value.
Otherwise, it is not defined, but may be the average of the start and end timestamps.
confidence
A number between 0 and 1 that indicates how confident the transcription is.
Whitespace sensitivity
The text
field is white-space sensitive. You should include spaces in it, as none are added automatically.
While rendering, apply the white-space: pre
CSS property to the container of the caption to ensure that the spaces are preserved.