Skip to main content

disposeVideoMattingModel()v4.0.523

Releases the memory used by initialized video matting models. Persistent cached model files are not deleted.

Use await using with loadVideoMattingModel() for cleanup at the end of a scope; call disposeVideoMattingModel() when you want to release a model loaded automatically.

dispose.ts
import {disposeVideoMattingModel} from '@remotion/video-matting'; await disposeVideoMattingModel({model: 'modnet'});

Options​

model?​

Only dispose this model. Default: all loaded video matting models.

If the model is in use, disposal waits until active separations using it have finished.

Return value​

A Promise<void> that resolves after the selected models have been disposed.

Compatibility​

BrowsersServersEnvironments
Chrome
Firefox
Safari
Node.js
Bun
Serverless Functions

See also​