downloadVideoMattingModel()v4.0.528
Downloads a video matting model from remotion.media into the browser cache without initializing WebGPU. Call loadVideoMattingModel() or separateVideoLayers() afterwards.
The browser Cache API or a Transformers.js custom cache must be enabled.
download-model.tsimport {downloadVideoMattingModel } from '@remotion/video-matting'; const {alreadyDownloaded } = awaitdownloadVideoMattingModel ({model : 'modnet',onProgress : ({progress }) =>console .log (progress ), });console .log (alreadyDownloaded );
Options
model
One of the names returned by getAvailableModels().
onProgress?
Called as files download. Default: no callback. The callback receives:
file
The file being downloaded, or null for aggregate progress.
progress
Aggregate progress between 0 and 1.
loadedBytes
Bytes downloaded in this call.
totalBytes
Estimated total model size in bytes.
Return value
alreadyDownloaded
true if all files were already cached before this call.
Compatibility
| Browsers | Environments | |||||
|---|---|---|---|---|---|---|
Chrome | Firefox | Safari | ||||