Skip to content

πŸŽ₯ Make videos programmatically with React

First doc page about captions

Jonny Burger280d79c6154a
diff --git a/packages/captions/README.md b/packages/captions/README.md
index 60096efe06..318585cf41 100644
--- a/packages/captions/README.md
+++ b/packages/captions/README.md
@@ -15,4 +15,4 @@ Remove the `^` character from the version number to use the exact version.
## Usage
-See the [documentation](https://remotion.dev/docs/captions) for more information.
+See the [documentation](https://remotion.dev/docs/captions/api) for more information.
diff --git a/packages/captions/package.json b/packages/captions/package.json
index 08392fe495..5090a7a909 100644
--- a/packages/captions/package.json
+++ b/packages/captions/package.json
@@ -30,5 +30,5 @@
"publishConfig": {
"access": "public"
},
- "homepage": "https://remotion.dev/docs/captions"
+ "homepage": "https://remotion.dev/docs/captions/api"
}
diff --git a/packages/docs/docs/captions/GuideTableOfContents.tsx b/packages/docs/docs/captions/GuideTableOfContents.tsx
new file mode 100644
index 0000000000..a01f10ed27
--- /dev/null
+++ b/packages/docs/docs/captions/GuideTableOfContents.tsx
@@ -0,0 +1,16 @@
+import React from 'react';
+import {Grid} from '../../components/TableOfContents/Grid';
+import {TOCItem} from '../../components/TableOfContents/TOCItem';
+
+export const GuideTableOfContents: React.FC = () => {
+ return (
+ <div>
+ <Grid>
+ <TOCItem link="/docs/captions/transcribing">
+ <strong>{'Transcribing audio'}</strong>
+ <div>Options for generating captions from audio</div>
+ </TOCItem>
+ </Grid>
+ </div>
+ );
+};
diff --git a/packages/docs/docs/captions/api.mdx b/packages/docs/docs/captions/api.mdx
new file mode 100644
index 0000000000..d4c82686f0
--- /dev/null
+++ b/packages/docs/docs/captions/api.mdx
@@ -0,0 +1,25 @@
+---
+image: /generated/articles-docs-captions-api.png
+title: '@remotion/captions'
+crumb: 'Subtitle videos'
+---
+
+_Available from v4.0.216_
+
+The `@remotion/captions` package provides utilities for dealing with subtitles.
+
+At the centre of this caption is the [`Caption`](/docs/captions/caption) type, which defines a standard shape for captions from different sources.
+
+Captions generated from [`@remotion/install-whisper-cpp`](/docs/install-whisper-cpp) [can be converted](/docs/install-whisper-cpp/to-captions) into the `Caption` type.
+
+import {TableOfContents} from './TableOfContents';
+
+<Installation pkg="@remotion/captions" />
+
+## APIs
+
+<TableOfContents />
+
+## License
+
+MIT
diff --git a/packages/docs/docs/captions/caption.mdx b/packages/docs/docs/captions/caption.mdx
index af5b325f3d..adc097c4ea 100644
--- a/packages/docs/docs/captions/caption.mdx
+++ b/packages/docs/docs/captions/caption.mdx
@@ -54,4 +54,4 @@ While rendering, apply the [`white-space: pre`](https://developer.mozilla.org/en
## See also
- [Source code for this type](https://github.com/remotion-dev/remotion/blob/main/packages/captions/src/caption.ts)
-- [`@remotion/captions`](/docs/captions)
+- [`@remotion/captions`](/docs/captions/api)
diff --git a/packages/docs/docs/captions/create-tiktok-style-captions.mdx b/packages/docs/docs/captions/create-tiktok-style-captions.mdx
index f9a8a430f2..ebee10237b 100644
--- a/packages/docs/docs/captions/create-tiktok-style-captions.mdx
+++ b/packages/docs/docs/captions/create-tiktok-style-captions.mdx
@@ -131,4 +131,4 @@ While rendering, apply the [`white-space: pre`](https://developer.mozilla.org/en
## See also
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/captions/src/create-tiktok-style-captions.ts)
-- [`@remotion/captions`](/docs/captions)
+- [`@remotion/captions`](/docs/captions/api)
diff --git a/packages/docs/docs/captions/ensure-max-characters-per-line.mdx b/packages/docs/docs/captions/ensure-max-characters-per-line.mdx
index 64fb275588..889f32ef1c 100644
--- a/packages/docs/docs/captions/ensure-max-characters-per-line.mdx
+++ b/packages/docs/docs/captions/ensure-max-characters-per-line.mdx
@@ -11,4 +11,4 @@ This is an internal, undocumented API for now.
## See also
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/captions/src/ensure-max-characters-per-line.ts)
-- [`@remotion/captions`](/docs/captions)
+- [`@remotion/captions`](/docs/captions/api)
diff --git a/packages/docs/docs/captions/index.mdx b/packages/docs/docs/captions/index.mdx
index c19200a36b..dba38c75f2 100644
--- a/packages/docs/docs/captions/index.mdx
+++ b/packages/docs/docs/captions/index.mdx
@@ -1,25 +1,18 @@
---
image: /generated/articles-docs-captions-index.png
-title: '@remotion/captions'
+title: Captions
crumb: 'Subtitle videos'
+sidebar_label: Overview
---
-_Available from v4.0.216_
+import {GuideTableOfContents} from './GuideTableOfContents';
-The `@remotion/captions` package provides utilities for dealing with subtitles.
+# Captions
-At the centre of this caption is the [`Caption`](/docs/captions/caption) type, which defines a standard shape for captions from different sources.
+Learn how to add captions and subtitles to your Remotion videos.
-Captions generated from [`@remotion/install-whisper-cpp`](/docs/install-whisper-cpp) [can be converted](/docs/install-whisper-cpp/to-captions) into the `Caption` type.
+<GuideTableOfContents />
-import {TableOfContents} from './TableOfContents';
+## See also
-<Installation pkg="@remotion/captions" />
-
-## APIs
-
-<TableOfContents />
-
-## License
-
-MIT
+- [`@remotion/captions`](/docs/captions/api) - API reference for caption utilities
diff --git a/packages/docs/docs/captions/parse-srt.mdx b/packages/docs/docs/captions/parse-srt.mdx
index f23de6c1cd..06518b05b8 100644
--- a/packages/docs/docs/captions/parse-srt.mdx
+++ b/packages/docs/docs/captions/parse-srt.mdx
@@ -6,7 +6,7 @@ crumb: '@remotion/captions'
# parseSrt()<AvailableFrom v="4.0.216"/>
-Parses the contents of a SubRip file (`.srt`) and returns an array of [`Caption`](/docs/captions) items.
+Parses the contents of a SubRip file (`.srt`) and returns an array of [`Caption`](/docs/captions/caption) items.
```tsx twoslash title="Example usage"
import {parseSrt} from '@remotion/captions';
@@ -70,4 +70,4 @@ An array of [`Caption`](/docs/captions/caption) items.
## See also
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/captions/src/parse-srt.ts)
-- [`@remotion/captions`](/docs/captions)
+- [`@remotion/captions`](/docs/captions/api)
diff --git a/packages/docs/docs/captions/serialize-srt.mdx b/packages/docs/docs/captions/serialize-srt.mdx
index 4eec3c263f..e92ee275ae 100644
--- a/packages/docs/docs/captions/serialize-srt.mdx
+++ b/packages/docs/docs/captions/serialize-srt.mdx
@@ -76,4 +76,4 @@ A string in the SubRip format (`.srt`).
## See also
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/captions/src/serialize-srt.ts)
-- [`@remotion/captions`](/docs/captions)
+- [`@remotion/captions`](/docs/captions/api)
diff --git a/packages/docs/docs/captions/transcribing.mdx b/packages/docs/docs/captions/transcribing.mdx
new file mode 100644
index 0000000000..4b6b510e2a
--- /dev/null
+++ b/packages/docs/docs/captions/transcribing.mdx
@@ -0,0 +1,43 @@
+---
+image: /generated/articles-docs-captions-transcribing.png
+title: Transcribing audio
+crumb: '@remotion/captions'
+---
+
+# Transcribing audio
+
+Remotion provides several built-in options for transcribing audio to generate captions:
+
+- [`@remotion/install-whisper-cpp`](/docs/install-whisper-cpp) - Transcribe audio locally on a server using [Whisper.cpp](https://github.com/ggerganov/whisper.cpp)
+- [`@remotion/whisper-web`](/docs/whisper-web) - Transcribe audio in the browser using WebAssembly
+- [`@remotion/openai-whisper`](/docs/openai-whisper) - Use the OpenAI Whisper API for cloud-based transcription
+
+## Comparison
+
+| | [`@remotion/install-whisper-cpp`](/docs/install-whisper-cpp) | [`@remotion/whisper-web`](/docs/whisper-web) | [`@remotion/openai-whisper`](/docs/openai-whisper) |
+| -------------------- | --------------------------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------ |
+| **Environment** | Server (Node.js) | Client (Browser) | Cloud (API) |
+| **Speed** | Fast (depends on hardware) | Slow (WASM overhead) | Fast |
+| **Cost** | Free | Free | Paid (OpenAI API pricing) |
+| **Offline support** | βœ… | βœ… | ❌ |
+| **No server needed** | ❌ | βœ… | βœ… |
+| **Convert function** | [`convertToCaptions()`](/docs/install-whisper-cpp/convert-to-captions) | [`toCaptions()`](/docs/whisper-web/to-captions) | [`openaiWhisperApiToCaptions()`](/docs/openai-whisper/openai-whisper-api-to-captions) |
+
+## The `Caption` type
+
+All of these options can output captions in the [`Caption`](/docs/captions/caption) type format, which is recommended for use with Remotion. This format:
+
+- Enables usage of the APIs in [`@remotion/captions`](/docs/captions/api), such as [`createTikTokStyleCaptions()`](/docs/captions/create-tiktok-style-captions)
+- Matches the format used in the [Remotion Editor Starter](https://github.com/remotion-dev/template-video-editor)
+- Is compatible with the [Animated Captions](https://github.com/remotion-dev/animated-captions) package
+
+## Alternatives
+
+You can use other ways of transcribing audio, such as [ElevenLabs](https://elevenlabs.io/).
+You can also define your own caption format and not rely on the `Caption` type - this page is solely about the built-in options.
+
+
+## See also
+
+- [`Caption`](/docs/captions/caption) - The caption data structure
+- [`@remotion/captions`](/docs/captions/api) - Caption manipulation utilities
diff --git a/packages/docs/docs/editor-starter/captioning.mdx b/packages/docs/docs/editor-starter/captioning.mdx
index 0f5763cf4b..359c0ecd4d 100644
--- a/packages/docs/docs/editor-starter/captioning.mdx
+++ b/packages/docs/docs/editor-starter/captioning.mdx
@@ -39,7 +39,7 @@ The [inspector](/docs/editor-starter/tracks-items-assets#inspectors) allows user
## Automated creation of pages
-Captions are automatically split into "pages" for easier management. Pages are timed groups of words or sentences that fit nicely on screen. This is achieved by using [`createTikTokStyleCaptions`](/docs/captions/create-tiktok-style-captions) from [`@remotion/captions`](/docs/captions) package.
+Captions are automatically split into "pages" for easier management. Pages are timed groups of words or sentences that fit nicely on screen. This is achieved by using [`createTikTokStyleCaptions`](/docs/captions/create-tiktok-style-captions) from [`@remotion/captions`](/docs/captions/api) package.
## Limits
@@ -78,6 +78,6 @@ We recommend that you convert the captions to the [`Caption`](/docs/captions/cap
## See also
-- [`@remotion/captions`](/docs/captions)
+- [`@remotion/captions`](/docs/captions/api)
- [`@remotion/whisper-web`](/docs/whisper-web)
- [`@remotion/install-whisper-cpp`](/docs/install-whisper-cpp)
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 cdeab23504..7b70c3527a 100644
--- a/packages/docs/docs/install-whisper-cpp/convert-to-captions.mdx
+++ b/packages/docs/docs/install-whisper-cpp/convert-to-captions.mdx
@@ -8,7 +8,7 @@ crumb: '@remotion/install-whisper-cpp'
This API was deprecated as of Remotion 4.0.216.
-It is recommended to use the [`toCaptions()`](/docs/install-whisper-cpp/to-captions) function from `@remotion/install-whisper-cpp` instead, and then process the captions using [`createTikTokStyleCaptions()`](/docs/captions/create-tiktok-style-captions) from [`@remotion/captions`](/docs/captions).
+It is recommended to use the [`toCaptions()`](/docs/install-whisper-cpp/to-captions) function from `@remotion/install-whisper-cpp` instead, and then process the captions using [`createTikTokStyleCaptions()`](/docs/captions/create-tiktok-style-captions) from [`@remotion/captions`](/docs/captions/api).
[Click here](https://github.com/remotion-dev/remotion/blob/v4.0.215/packages/docs/docs/install-whisper-cpp/convert-to-captions.mdx) to see documentation for this function that was previously on this page.
diff --git a/packages/docs/docs/install-whisper-cpp/to-captions.mdx b/packages/docs/docs/install-whisper-cpp/to-captions.mdx
index d9e872a824..9400469efd 100644
--- a/packages/docs/docs/install-whisper-cpp/to-captions.mdx
+++ b/packages/docs/docs/install-whisper-cpp/to-captions.mdx
@@ -6,7 +6,7 @@ crumb: '@remotion/install-whisper-cpp'
# toCaptions()<AvailableFrom v="4.0.216"/>
-Converts the output from [`transcribe()`](/docs/install-whisper-cpp/transcribe) into an array of [`Caption`](/docs/captions/caption) objects, so you can use the functions from [`@remotion/captions`](/docs/captions).
+Converts the output from [`transcribe()`](/docs/install-whisper-cpp/transcribe) into an array of [`Caption`](/docs/captions/caption) objects, so you can use the functions from [`@remotion/captions`](/docs/captions/api).
```tsx twoslash title="generate-captions.mjs"
import {toCaptions, transcribe} from '@remotion/install-whisper-cpp';
@@ -53,4 +53,4 @@ console.log(captions); /*
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/install-whisper-cpp/src/to-captions.ts)
- [`@remotion/install-whisper-cpp`](/docs/install-whisper-cpp)
-- [`@remotion/captions`](/docs/captions)
+- [`@remotion/captions`](/docs/captions/api)
diff --git a/packages/docs/docs/openai-whisper/index.mdx b/packages/docs/docs/openai-whisper/index.mdx
index e29630f629..7c67438bab 100644
--- a/packages/docs/docs/openai-whisper/index.mdx
+++ b/packages/docs/docs/openai-whisper/index.mdx
@@ -24,5 +24,5 @@ MIT
## See also
-- [`@remotion/captions`](/docs/captions)
+- [`@remotion/captions`](/docs/captions/api)
- [`@remotion/install-whisper-cpp`](/docs/install-whisper-cpp)
diff --git a/packages/docs/docs/openai-whisper/openai-whisper-api-to-captions.mdx b/packages/docs/docs/openai-whisper/openai-whisper-api-to-captions.mdx
index ba4f768435..a690eb6c30 100644
--- a/packages/docs/docs/openai-whisper/openai-whisper-api-to-captions.mdx
+++ b/packages/docs/docs/openai-whisper/openai-whisper-api-to-captions.mdx
@@ -35,4 +35,4 @@ const {captions} = openAiWhisperApiToCaptions({transcription});
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/openai-whisper/src/openai-whisper-api-to-captions.ts)
- [`@remotion/openai-whisper`](/docs/openai-whisper)
- [`@remotion/install-whisper-cpp`](/docs/install-whisper-cpp)
-- [`@remotion/captions`](/docs/captions)
+- [`@remotion/captions`](/docs/captions/api)
diff --git a/packages/docs/docs/whisper-web/to-captions.mdx b/packages/docs/docs/whisper-web/to-captions.mdx
index 67ef92dd2e..690c680139 100644
--- a/packages/docs/docs/whisper-web/to-captions.mdx
+++ b/packages/docs/docs/whisper-web/to-captions.mdx
@@ -6,7 +6,7 @@ crumb: '@remotion/whisper-web'
# toCaptions()
-Converts the output from [`transcribe()`](/docs/whisper-web/transcribe) into an array of [`Caption`](/docs/captions/caption) objects, so you can use the functions from [`@remotion/captions`](/docs/captions).
+Converts the output from [`transcribe()`](/docs/whisper-web/transcribe) into an array of [`Caption`](/docs/captions/caption) objects, so you can use the functions from [`@remotion/captions`](/docs/captions/api).
```tsx twoslash
import {toCaptions, transcribe, resampleTo16Khz} from '@remotion/whisper-web';
@@ -55,4 +55,4 @@ console.log(captions); /*
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/whisper-web/src/to-captions.ts)
- [`@remotion/whisper-web`](/docs/whisper-web)
-- [`@remotion/captions`](/docs/captions)
+- [`@remotion/captions`](/docs/captions/api)
diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.ts
index 0c4f379b9c..333802facd 100644
--- a/packages/docs/sidebars.ts
+++ b/packages/docs/sidebars.ts
@@ -218,7 +218,7 @@ const sidebars: SidebarsConfig = {
label: '@remotion/captions',
link: {
type: 'doc',
- id: 'captions/index',
+ id: 'captions/api',
},
items: [
'captions/caption',
@@ -1169,6 +1169,15 @@ const sidebars: SidebarsConfig = {
},
items: ['ai/bolt', 'ai/chatbot', 'ai/mcp', 'ai/system-prompt'],
},
+ {
+ type: 'category',
+ label: 'Captions',
+ link: {
+ type: 'doc',
+ id: 'captions/index',
+ },
+ items: ['captions/transcribing'],
+ },
{
type: 'category',
label: 'Tooling',
diff --git a/packages/studio-shared/src/package-info.ts b/packages/studio-shared/src/package-info.ts
index e6177c5b4c..b365caed28 100644
--- a/packages/studio-shared/src/package-info.ts
+++ b/packages/studio-shared/src/package-info.ts
@@ -339,7 +339,7 @@ export const apiDocs: {[key in Pkgs]: string | null} = {
'animated-emoji': 'https://www.remotion.dev/docs/animated-emoji',
webcodecs: 'https://remotion.dev/webcodecs',
convert: 'https://convert.remotion.dev',
- captions: 'https://remotion.dev/docs/captions',
+ captions: 'https://remotion.dev/docs/captions/api',
'openai-whisper': 'https://www.remotion.dev/docs/openai-whisper',
'eslint-config-internal': null,
compositor: null,