
MODNet Video Matting
Cuts people out of video with a soft alpha matte that keeps hair and fine edges, with no green screen and no…
Fine-tunableBACKGROUND_MATTING_V2Cuts a person out of video precisely, hair included, when you also give a picture of the empty background from the same still camera; returns the matte or the person over a flat colour.

Background Matting V2 by Shanchuan Lin, Andrey Ryabtsev, Soumyadip Sengupta, Brian Curless, Steve Seitz and Ira Kemelmacher-Shlizerman, released under the MIT License.
| Name | Type | Required | Default | Details |
|---|---|---|---|---|
video | file | Yes | — | The video of people: MP4, MOV, WebM or MKV, at most 256 MB, 300 frames and 2,073,600 pixels a frame. The result has no sound. 1–2048 characters · video/mp4, quicktime, webm, x-matroska |
background | file | Yes | — | A PNG, JPEG or WebP picture of the scene without the person, from the same still camera, at most 50 MB; it is scaled to the video's size. 1–2048 characters · image/png, jpeg, webp |
smooth | boolean | No | true | Smooths a matte pixel that jumps for one frame while the frames around it agree. |
output | text | No | composite | composite: the people over a flat backdrop colour; matte: the alpha matte as a grey video, white = person. Allowed: composite, matte |
backdrop | text | No | green | The flat colour behind the people in a composite. Allowed: green, blue, white, black, gray |
Output. Returns MP4 video: The people over a flat colour, or their alpha matte as a grey video: an H.264 MP4 without sound, the input's size and frame rate.
Send your API key in the X-API-Key header. The run is asynchronous: submit it, then poll it until it finishes. Create an API key.
curl -X POST "https://api.kainguru.com/api/v1/executions?mlFlowId=BACKGROUND_MATTING_V2" \
-H "X-API-Key: kg_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"input": {
"background": "https://example.com/input.png",
"video": "https://example.com/input.png",
"backdrop": "green",
"output": "composite",
"smooth": true
},
"outputFormat": "json"
}'
# Poll until the execution reaches a terminal state
curl "https://api.kainguru.com/api/v1/executions/{executionId}" \
-H "X-API-Key: kg_your_api_key"from kainguru import KainguruClient
with KainguruClient(api_key="kg_your_api_key", base_url="https://api.kainguru.com/api") as client:
submitted = client.executions.execute(
"BACKGROUND_MATTING_V2",
{
"background": "https://example.com/input.png",
"video": "https://example.com/input.png",
"backdrop": "green",
"output": "composite",
"smooth": True
},
output_format="json",
)
result = client.executions.await_completion(submitted.id)
print(result.execution.output)You can fine-tune Background Matting v2 on your own data and run the tuned model through the same API. Dataset: One ZIP (at most 4 GB, 128 MB a clip, no password) with 2 to 100 clips, a grey matte video for each, and manifest.jsonl with one line per clip: {"video", "matte", "background"} (the empty scene). More: Good to know, in the README.
The steps are in the docs.
Price per frame: 0.002185 credits ($0.00002185). The price is shown again before every run; all prices are on the pricing page.

Cuts people out of video with a soft alpha matte that keeps hair and fine edges, with no green screen and no…
Fine-tunable
Colourises black-and-white video with DeOldify's video model: plausible colour for every frame, laid over the original…
Fine-tunable
Makes a face in a video say new words. Send a clip of one talking face and an audio file; the mouth and jaw move to…
Fine-tunable
Raises a video's frame rate 2, 3, 4 or 8 times by predicting the frames in between, fast enough for long clips (RIFE…
Fine-tunable
Removes burned-in subtitles and captions from a video: finds the text on every frame and fills it in from the rest of…
Fine-tunable
Finds every face in a short video and covers it on each frame with a blur, pixelation or a solid box.