Video Background Blur

VIDEO_BACKGROUND_BLUR

Blurs or replaces everything behind the person in a short clip, as a video call does; the person stays sharp.

Video Editingbackground-blurportrait-mattingvideoapache-2.0
Video Background Blur: Video Editing model on Kainguru

About Video Background Blur

Blurs everything behind the person in a short clip, the way a video-call background does. A portrait matte is estimated on every frame. The person stays sharp. The background is either blurred or replaced with a flat colour.

Weights

Portrait matting is MODNet (trimap-free portrait matting), by ZHKKKe. The file used here is onnx/model.onnx (25,888,640 bytes) from Xenova/modnet at revision fa2fa546052fba4c08921230a26cc69a333fca12.

Model card:

https://huggingface.co/Xenova/modnet/blob/fa2fa546052fba4c08921230a26cc69a333fca12

That card states the licence is Apache-2.0. The original MODNet project is https://github.com/ZHKKKe/MODNet (Apache-2.0). Xenova converted the weights to ONNX.

The file is public. An anonymous request for the bytes returns HTTP 302 to the file, with linked size 25,888,640.

Each frame is resized to 512 by 512, converted to RGB, rescaled by 1/255, then normalised with mean 0.5 and standard deviation 0.5, matching preprocessor_config.json at that revision. The network returns a 512 by 512 matte in the range 0 to 1. The matte is resized to the frame and feathered with a small blur before compositing.

Limits

The request is rejected when the file is over 50 MB, when the clip is longer than 30 seconds or 900 frames, when either side is over 1280 pixels, when the file is not a readable MP4, MOV or WebM, or when strength, mode or background_color is outside the bounds above.

MODNet is a portrait matte. It expects one person, roughly facing the camera. Crowds, animals, objects and full-body shots far from the camera are outside what this matte is for. A missed edge leaves some of the background sharp, or softens part of the person. The model runs on CPU.

Video Background Blur inputs and output

NameTypeRequiredDefaultDetails
videofileYes—Short clip (MP4, MOV or WebM). At most 50 MB, 30 seconds, 900 frames, and 1280 pixels on a side.
video/mp4
strengthintegerNo25Blur radius for the background when mode is blur.
5–99
modetextNoblurblur softens the background. color fills it with background_color.
Allowed: blur, color
background_colortextNo#00a86bHex colour used when mode is color.

Output. Returns binary file.

Run Video Background Blur with the API

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
curl -X POST "https://api.kainguru.com/api/v1/executions?mlFlowId=VIDEO_BACKGROUND_BLUR" \
  -H "X-API-Key: kg_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "video": "https://example.com/input.png",
    "background_color": "#00a86b",
    "mode": "blur",
    "strength": 25
  },
  "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"
Python
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(
        "VIDEO_BACKGROUND_BLUR",
        {
          "video": "https://example.com/input.png",
          "background_color": "#00a86b",
          "mode": "blur",
          "strength": 25
        },
        output_format="json",
    )
    result = client.executions.await_completion(submitted.id)
    print(result.execution.output)

Video Background Blur pricing

Price per request: 3.52 credits ($0.0352). The price is shown again before every run; all prices are on the pricing page.

Licence and source

Video Object Detection: Video Editing model on Kainguru
Video Editing

Video Object Detection

Draws a labelled box on every object DETR detects in a short clip, across the 80 COCO classes.

Wan 2.1 VACE 1.3B: Video Editing model on Kainguru
Video Editing

Wan 2.1 VACE 1.3B

Video-editing model (Wan 2.1 VACE, 1.3B): follows a control clip, redoes a masked area or the end of a clip, or puts…

Fine-tunable
FILM: Video Editing model on Kainguru
Video Editing

FILM

Makes slow motion and higher frame rates by painting the frames between two frames, even when things move far between…

Fine-tunable
MODNet Video Matting: Video Editing model on Kainguru
Video Editing

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-tunable
RealBasicVSR: Video Editing model on Kainguru
Video Editing

RealBasicVSR

Enlarges a real-world video 4 times, looking across frames so detail stays steady and flicker is lower than with…

Fine-tunable
ReCamMaster: Video Editing model on Kainguru
Video Editing

ReCamMaster

Video-editing model (ReCamMaster on Wan 2.1, 1.3B) that re-renders a clip along a new camera path: pan, tilt, zoom…

Fine-tunable