Skip to content

🎥 Make videos programmatically with React

AI model refacotr

Jonny Burgerb2678a65eca2
diff --git a/packages/docs/docs/video-matting/can-use-video-matting.mdx b/packages/docs/docs/video-matting/can-use-video-matting.mdx
index e1c4a1ea36..ff07d4f01d 100644
--- a/packages/docs/docs/video-matting/can-use-video-matting.mdx
+++ b/packages/docs/docs/video-matting/can-use-video-matting.mdx
@@ -52,7 +52,7 @@ When `supported` is `false`, a human-readable explanation of the reason.
## Compatibility
-<CompatibilityTable chrome firefox safari nodejs bun="" serverlessFunctions={false} clientSideRendering={false} serverSideRendering player studio />
+<CompatibilityTable chrome firefox safari nodejs bun="" serverlessFunctions={false} clientSideRendering serverSideRendering player studio />
## See also
diff --git a/packages/docs/docs/video-matting/get-available-models.mdx b/packages/docs/docs/video-matting/get-available-models.mdx
index 3ab99262ff..0546d19f29 100644
--- a/packages/docs/docs/video-matting/get-available-models.mdx
+++ b/packages/docs/docs/video-matting/get-available-models.mdx
@@ -20,9 +20,17 @@ console.log(models);
| `modnet` | People | 25.9 MB | Default |
| `ben2-base` | General foreground subjects | 219.1 MB | Experimental and higher-resource |
-The [`modnet` model](https://huggingface.co/Xenova/modnet) is Apache-2.0 licensed. The [`ben2-base` model](https://huggingface.co/onnx-community/BEN2-ONNX) is the MIT-licensed BEN2 Base export.
+The [`modnet` model](https://huggingface.co/Xenova/modnet) is Apache-2.0 licensed.
+The [`ben2-base` model](https://huggingface.co/onnx-community/BEN2-ONNX) is the MIT-licensed BEN2 Base export.
+
+## Model hosting
+
+The `modelId` values identify the upstream Hugging Face models.
+
+We noticed that hosting the models on R2 leads to faster downloading than through Hugging Face directly.
+We mirrored the models to `remotion.media`, keeping them byte-identical.
+We also notified Hugging Face and they are investigating the issue. We may migrate back to the official hosting in the future.
-The `modelId` values identify these upstream Hugging Face models for provenance. Runtime files are downloaded from immutable paths on `remotion.media` and are byte-identical to files from the pinned upstream revisions.
## Return value
@@ -46,7 +54,7 @@ The total size in bytes of all runtime files downloaded for WebGPU.
## Compatibility
-<CompatibilityTable chrome firefox safari nodejs="" bun="" serverlessFunctions="" clientSideRendering={false} serverSideRendering player studio hideServers />
+<CompatibilityTable chrome firefox safari nodejs="" bun="" serverlessFunctions="" clientSideRendering serverSideRendering player studio hideServers />
## See also
diff --git a/packages/docs/docs/video-matting/index.mdx b/packages/docs/docs/video-matting/index.mdx
index 5da68b178b..9b03d48a94 100644
--- a/packages/docs/docs/video-matting/index.mdx
+++ b/packages/docs/docs/video-matting/index.mdx
@@ -6,7 +6,7 @@ crumb: 'Separate a video into layers'
# @remotion/video-matting<AvailableFrom v="4.0.523" />
-Separate a video into an opaque base layer and a foreground layer with alpha, locally in the browser or [Node.js](/docs/video-matting/node) using WebGPU.
+Separate a video into background and foreground layers, locally in the browser or [Node.js](/docs/video-matting/node) using WebGPU.
import {TableOfContents} from './table-of-contents';
@@ -49,11 +49,11 @@ export const matteVideo = async (file: File) => {
};
```
-Pass a `File` from a file input to `matteVideo()`. On return, `await using` releases the model from memory and removes temporary output files. The returned blobs remain usable, and downloaded model files stay cached for future runs.
-
## Model hosting
-Model files are downloaded from immutable paths on `remotion.media`. We find that downloads are faster from a R2 mirror than from Hugging Face directly. The models are byte-identical to the ones you can find from Hugging Face.
+We noticed that hosting the models on R2 leads to faster downloading than through Hugging Face directly.
+We mirrored the models to `remotion.media`, keeping them byte-identical.
+We also notified Hugging Face and they are investigating the issue. We may migrate back to the official hosting in the future.
## APIs
@@ -61,12 +61,13 @@ Model files are downloaded from immutable paths on `remotion.media`. We find tha
## Requirements
-WebGPU requires HTTPS in production or `localhost` during development. Use [`canUseVideoMatting()`](/docs/video-matting/can-use-video-matting) to check whether the selected model is supported.
-
-If the page uses a strict Content Security Policy, add `https://remotion.media` to its `connect-src` directive, for example `connect-src 'self' https://remotion.media`.
+A GPU is needed for this.
+Use [`canUseVideoMatting()`](/docs/video-matting/can-use-video-matting) to check whether your system can use video matting.
-The browser must also be able to decode the input video and encode VP9 with alpha through WebCodecs. [`separateVideoLayers()`](/docs/video-matting/separate-video-layers) checks these media capabilities for the selected input.
+The browser must also be able to decode the input video and encode VP9 with alpha through WebCodecs.
+[`separateVideoLayers()`](/docs/video-matting/separate-video-layers) checks these media capabilities for the selected input.
## License
-The package is MIT licensed. Downloaded model weights retain the licenses listed under [`getAvailableModels()`](/docs/video-matting/get-available-models).
+The package is MIT licensed.
+Models retain the licenses listed under [`getAvailableModels()`](/docs/video-matting/get-available-models).
diff --git a/packages/docs/docs/whisper-webgpu/index.mdx b/packages/docs/docs/whisper-webgpu/index.mdx
index 2190b969ef..14e8a86df0 100644
--- a/packages/docs/docs/whisper-webgpu/index.mdx
+++ b/packages/docs/docs/whisper-webgpu/index.mdx
@@ -35,13 +35,18 @@ const {captions} = toCaptions({whisperWebGpuOutput: transcription});
console.log(captions);
```
-[`downloadWhisperModel()`](/docs/whisper-webgpu/download-whisper-model) stores model files in the persistent cache. Call [`loadWhisperModel()`](/docs/whisper-webgpu/load-whisper-model) when you want to initialize the model explicitly.
-
-See [Using `@remotion/whisper-webgpu` in Node.js](/docs/whisper-webgpu/node) for a complete Node.js example.
+[`downloadWhisperModel()`](/docs/whisper-webgpu/download-whisper-model) stores model files in the persistent cache.
+Call [`loadWhisperModel()`](/docs/whisper-webgpu/load-whisper-model) when you want to initialize the model explicitly.
## Model hosting
-We noticed that hosting the models on R2 leads to faster downloading than through Hugging Face. Therefore, we mirrored the models to `remotion.media`, keeping them byte-identical.
+We noticed that hosting the models on R2 leads to faster downloading than through Hugging Face directly.
+We mirrored the models to `remotion.media`, keeping them byte-identical.
+We also notified Hugging Face and they are investigating the issue. We may migrate back to the official hosting in the future.
+
+## On the server
+
+See [`@remotion/whisper-webgpu` in Node.js](/docs/whisper-webgpu/node) for a complete Node.js example.
## APIs
@@ -49,7 +54,8 @@ We noticed that hosting the models on R2 leads to faster downloading than throug
## Requirements
-WebGPU requires HTTPS in production or `localhost` during development. Use [`canUseWhisperWebGpu()`](/docs/whisper-webgpu/can-use-whisper-webgpu) to check for a usable adapter.
+You obviously need a GPU.
+Use [`canUseWhisperWebGpu()`](/docs/whisper-webgpu/can-use-whisper-webgpu) to determine if it is supported.
## License
diff --git a/packages/docs/docs/whisper-webgpu/table-of-contents.tsx b/packages/docs/docs/whisper-webgpu/table-of-contents.tsx
index bf8c6938ab..3834d4d17b 100644
--- a/packages/docs/docs/whisper-webgpu/table-of-contents.tsx
+++ b/packages/docs/docs/whisper-webgpu/table-of-contents.tsx
@@ -5,17 +5,13 @@ import {TOCItem} from '../../components/TableOfContents/TOCItem';
export const TableOfContents: React.FC = () => {
return (
<Grid>
- <TOCItem link="/docs/whisper-webgpu/node">
- <strong>Using in Node.js</strong>
- <div>Decode media and transcribe it in Node.js</div>
- </TOCItem>
<TOCItem link="/docs/whisper-webgpu/can-use-whisper-webgpu">
<strong>canUseWhisperWebGpu()</strong>
- <div>Check whether WebGPU is available</div>
+ <div>Check whether transcription is possible</div>
</TOCItem>
<TOCItem link="/docs/whisper-webgpu/get-available-models">
<strong>getAvailableModels()</strong>
- <div>List timestamped models and their download sizes</div>
+ <div>List models and their download sizes</div>
</TOCItem>
<TOCItem link="/docs/whisper-webgpu/clear-stale-models">
<strong>clearStaleModels()</strong>
@@ -32,6 +28,10 @@ export const TableOfContents: React.FC = () => {
<TOCItem link="/docs/whisper-webgpu/load-whisper-model">
<strong>loadWhisperModel()</strong>
<div>Initialize a downloaded model</div>
+ </TOCItem>
+ <TOCItem link="/docs/whisper-webgpu/dispose-whisper-model">
+ <strong>disposeWhisperModel()</strong>
+ <div>Release model memory</div>
</TOCItem>
<TOCItem link="/docs/whisper-webgpu/remove-whisper-model">
<strong>removeWhisperModel()</strong>
@@ -43,16 +43,12 @@ export const TableOfContents: React.FC = () => {
</TOCItem>
<TOCItem link="/docs/whisper-webgpu/to-captions">
<strong>toCaptions()</strong>
- <div>Convert a transcription to Remotion captions</div>
+ <div>Convert a transcription to <code>@remotion/captions</code></div>
</TOCItem>
<TOCItem link="/docs/whisper-webgpu/resample-to-16khz">
<strong>resampleTo16Khz()</strong>
<div>Decode and resample browser audio</div>
</TOCItem>
- <TOCItem link="/docs/whisper-webgpu/dispose-whisper-model">
- <strong>disposeWhisperModel()</strong>
- <div>Release model memory</div>
- </TOCItem>
</Grid>
);
};