Skip to main content

Captionv4.0.216

This is a simple data structure for a caption.

tsx
import type {Caption} from '@remotion/captions';
(alias) type Caption = { text: string; startMs: number; endMs: number; timestampMs: number | null; confidence: number | null; } import Caption
tsx
import type {Caption} from '@remotion/captions';
(alias) type Caption = { text: string; startMs: number; endMs: number; timestampMs: number | null; confidence: number | null; } import Caption

By establishing a standard data structure, we allow many operations that involve captions to be interoperable:

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.

See also