@remotion/video-mattingv4.0.523
Separate a video into opaque base and transparent foreground layers, locally in the browser or Node.js using WebGPU.
Installation
- Remotion CLI
- npm
- bun
- pnpm
- yarn
npx remotion add @remotion/video-matting @huggingface/transformers
This assumes you are currently using v4.0.533 of Remotion.npm i --save-exact @remotion/video-matting@4.0.533 @huggingface/transformers@4.2.0
Also update
remotion and all `@remotion/*` packages to the same version.Remove all
^ character in front of the version numbers of it as it can lead to a version conflict.This assumes you are currently using v4.0.533 of Remotion.pnpm i @remotion/video-matting@4.0.533 @huggingface/transformers@4.2.0
Also update
remotion and all `@remotion/*` packages to the same version.Remove all
^ character in front of the version numbers of it as it can lead to a version conflict.This assumes you are currently using v4.0.533 of Remotion.bun i @remotion/video-matting@4.0.533 @huggingface/transformers@4.2.0
Also update
remotion and all `@remotion/*` packages to the same version.Remove all
^ character in front of the version numbers of it as it can lead to a version conflict.This assumes you are currently using v4.0.533 of Remotion.yarn --exact add @remotion/video-matting@4.0.533 @huggingface/transformers@4.2.0
Also update
remotion and all `@remotion/*` packages to the same version.Remove all
^ character in front of the version numbers of it as it can lead to a version conflict.Studio
Remotion Studio offers Remove background for a selected video. It replaces the video's source with a transparent WebM. Duplicate the layer first if you want to keep the original alongside it.
For programmatic base and foreground outputs, see separateVideoLayers().
Model hosting
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
Requirements
A GPU is needed for this.
Use canUseVideoMatting() 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() checks these media capabilities for the selected input.
License
The package is MIT licensed.
Models retain the licenses listed under getAvailableModels().