Skip to content

🎥 Make videos programmatically with React

update docs with best practices

Jonny Burger46e82acaee1f
diff --git a/packages/docs/docs/install-whisper-cpp/convert-to-captions.mdx b/packages/docs/docs/install-whisper-cpp/convert-to-captions.mdx
index 1dcb3c7917..b377e5b0ab 100644
--- a/packages/docs/docs/install-whisper-cpp/convert-to-captions.mdx
+++ b/packages/docs/docs/install-whisper-cpp/convert-to-captions.mdx
@@ -19,7 +19,7 @@ import { transcribe, convertToCaptions } from "@remotion/install-whisper-cpp";
const { transcription } = await transcribe({
inputPath: "/path/to/audio.wav",
whisperPath: path.join(process.cwd(), "whisper.cpp"),
- model: "base.en",
+ model: "medium.en",
tokenLevelTimestamps: true,
});
diff --git a/packages/docs/docs/install-whisper-cpp/download-whisper-model.mdx b/packages/docs/docs/install-whisper-cpp/download-whisper-model.mdx
index 9e17fa56a3..15d2fe6db8 100644
--- a/packages/docs/docs/install-whisper-cpp/download-whisper-model.mdx
+++ b/packages/docs/docs/install-whisper-cpp/download-whisper-model.mdx
@@ -16,7 +16,7 @@ import path from "path";
import { downloadWhisperModel } from "@remotion/install-whisper-cpp";
const { alreadyExisted } = await downloadWhisperModel({
- model: "base.en",
+ model: "medium.en",
folder: path.join(process.cwd(), "whisper.cpp"),
});
```
diff --git a/packages/docs/docs/install-whisper-cpp/index.mdx b/packages/docs/docs/install-whisper-cpp/index.mdx
index 8d250c43d1..e355a79396 100644
--- a/packages/docs/docs/install-whisper-cpp/index.mdx
+++ b/packages/docs/docs/install-whisper-cpp/index.mdx
@@ -15,7 +15,7 @@ import { TableOfContents } from "../../components/TableOfContents/install-whispe
## Example usage
-Install Whisper v1.5.4 and the `base.en` model to the `whisper.cpp` folder.
+Install Whisper at commit `48a145` (a ref that we find works well and supports token-level timestamps) and the `base.en` model to the `whisper.cpp` folder.
```tsx twoslash title="install-whisper.cpp"
// @module: esnext
@@ -25,29 +25,41 @@ import {
downloadWhisperModel,
installWhisperCpp,
transcribe,
+ convertToCaptions,
} from "@remotion/install-whisper-cpp";
const to = path.join(process.cwd(), "whisper.cpp");
await installWhisperCpp({
to,
- version: "1.5.4",
+ version: "48a145", // Commit after 1.5.4 that supports token-level timestamps
});
await downloadWhisperModel({
- model: "base.en",
+ model: "medium.en",
folder: to,
});
const { transcription } = await transcribe({
- model: "base.en",
+ model: "medium.en",
whisperPath: to,
inputPath: "/path/to/audio.wav",
+ tokenLevelTimestamps: true,
});
for (const token of transcription) {
console.log(token.timestamps.from, token.timestamps.to, token.text);
}
+
+// Optional: Apply our recommended postprocessing
+const { captions } = convertToCaptions({
+ transcription,
+ combineTokensWithinMilliseconds: 200,
+});
+
+for (const line of captions) {
+ console.log(line.text, line.startInSeconds);
+}
```
## Functions
diff --git a/packages/docs/docs/install-whisper-cpp/install-whisper-cpp.mdx b/packages/docs/docs/install-whisper-cpp/install-whisper-cpp.mdx
index c658834af2..cf21736f41 100644
--- a/packages/docs/docs/install-whisper-cpp/install-whisper-cpp.mdx
+++ b/packages/docs/docs/install-whisper-cpp/install-whisper-cpp.mdx
@@ -17,7 +17,7 @@ import { installWhisperCpp } from "@remotion/install-whisper-cpp";
const { alreadyExisted } = await installWhisperCpp({
to: path.join(process.cwd(), "whisper.cpp"),
- version: "1.5.4",
+ version: "48a145",
});
```
diff --git a/packages/docs/docs/install-whisper-cpp/transcribe.mdx b/packages/docs/docs/install-whisper-cpp/transcribe.mdx
index 372b716d39..61d58be22f 100644
--- a/packages/docs/docs/install-whisper-cpp/transcribe.mdx
+++ b/packages/docs/docs/install-whisper-cpp/transcribe.mdx
@@ -18,7 +18,7 @@ import { transcribe } from "@remotion/install-whisper-cpp";
const { transcription } = await transcribe({
inputPath: "/path/to/audio.wav",
whisperPath: path.join(process.cwd(), "whisper.cpp"),
- model: "base.en",
+ model: "medium.en",
tokenLevelTimestamps: true,
});
diff --git a/packages/it-tests/download-whisper.mjs b/packages/it-tests/download-whisper.mjs
index e657c0af27..a2f0ea13db 100644
--- a/packages/it-tests/download-whisper.mjs
+++ b/packages/it-tests/download-whisper.mjs
@@ -8,7 +8,7 @@ const to = path.join(process.cwd(), "whisper.cpp");
await installWhisperCpp({
to,
- version: "1.5.4",
+ version: "48a145",
});
await downloadWhisperModel({