Skip to content

🎥 Make videos programmatically with React

awesome

Jonny Burgerae51909a9a77
diff --git a/packages/captions/src/captions.ts b/packages/captions/src/caption.ts
similarity index 100%
rename from packages/captions/src/captions.ts
rename to packages/captions/src/caption.ts
index 63d333b34c..28c5d0def1 100644
--- a/packages/captions/src/captions.ts
+++ b/packages/captions/src/caption.ts
@@ -1,7 +1,7 @@
export type Caption = {
text: string;
- timestampMs: number | null;
startMs: number;
endMs: number;
+ timestampMs: number | null;
confidence: number | null;
};
diff --git a/packages/captions/src/create-tiktok-style-captions.ts b/packages/captions/src/create-tiktok-style-captions.ts
index afeefe7928..b0543befc3 100644
--- a/packages/captions/src/create-tiktok-style-captions.ts
+++ b/packages/captions/src/create-tiktok-style-captions.ts
@@ -1,4 +1,4 @@
-import {Caption} from './captions';
+import {Caption} from './caption';
export type TikTokToken = {
text: string;
diff --git a/packages/captions/src/index.ts b/packages/captions/src/index.ts
index 03ab477927..7c8a3d61f8 100644
--- a/packages/captions/src/index.ts
+++ b/packages/captions/src/index.ts
@@ -1,4 +1,4 @@
-export {Caption} from './captions';
+export {Caption} from './caption';
export {
TikTokPage,
TikTokToken,
diff --git a/packages/captions/src/parse-srt.ts b/packages/captions/src/parse-srt.ts
index 8644f6ce77..a4d9ae1a80 100644
--- a/packages/captions/src/parse-srt.ts
+++ b/packages/captions/src/parse-srt.ts
@@ -1,4 +1,4 @@
-import {Caption} from './captions';
+import {Caption} from './caption';
function toSeconds(time: string) {
const [first, second, third] = time.split(':');
diff --git a/packages/docs/docs/captions/caption.mdx b/packages/docs/docs/captions/caption.mdx
index 606e1ea1c6..3c2733e416 100644
--- a/packages/docs/docs/captions/caption.mdx
+++ b/packages/docs/docs/captions/caption.mdx
@@ -18,3 +18,32 @@ By establishing a standard data structure, we allow many operations that involve
- Formatting (for example, creating pages using [`createTikTokStyleCaptions()`](/docs/captions/create-tiktok-style-captions))
- Parsing (using the [`parseSrt()`](/docs/captions/parse-srt) function)
- Serializing (for example to a .srt file)
+
+## 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.
+
+## See also
+
+- [Source code for this type](https://github.com/remotion-dev/remotion/blob/main/packages/captions/src/caption.ts)
+- [`@remotion/captions`](/docs/captions)