Video Matting

POSThttps://api.newportai.com/api/async/image_matting_process_video

The Video Matting API allows you to extract high-quality portrait subjects from video content with precise matting effects. This service provides an efficient way to isolate subjects, featuring customizable video bitrates and an optional green screen spill removal for professional background replacement workflows.

  • Submit a POST request to the Video Matting API to obtain a taskId.
  • Submit a POST request to the Polling API to retrieve the processed video result.
  • Configure a Callback URL to receive results automatically on completion.

Request Headers

Content-Type string Required

Enum: application/json

Authorization string Required

Bearer authentication token. Example: Bearer {{APIKey}}.

Request Body Parameters

srcFileUrl string Required

The URL of the source video file. Note: Only .mp4 format is supported.

bitRate string Optional

Specifies the target video bitrate. Default: 16m. Supported units: k (kbps) or m (mbps).

removeColorSpill boolean Optional

Enables removal of color fringes (spill) typically caused by green screen backgrounds. Default: false.

Response

code integer

Returns 0 for success, or a specific error code.

message string

Returns "success" or a descriptive error message.

data object
taskId string

The unique identifier for the task. Use this ID with the Polling API to retrieve the generated output.

Errors

10192Illegal param

Polling

Use the Polling API to retrieve the processing results.

Callback

Alternatively, you can enable Callback to receive task results automatically upon completion.

0Task Completed
{
  "code": 0,
  "message": "success",
  "data": {
    "task": {
      "taskId": "2e25206a92fb497e9fc546cc6b099789",
      "status": 3,
      "taskType": "image_matting_process_image",
      "reason": ""
    },
    "mattingResult": {
      "mattingFileUrl": "https://dreamface-resource-aigc.oss-us-east-1.aliyuncs.com/apiDocsAdmin/2025-4-1744805123831-videoMatting_mattingFileUrl.mp4",
      "mattingAlphaFileUrl": "https://dreamface-resource-aigc.oss-us-east-1.aliyuncs.com/apiDocsAdmin/2025-4-1744805292668-videoMatting_mattingAlphaFileUrl.mp4"
    }
  }
}
Request
cURL
curl -X POST 'https://api.newportai.com/api/async/image_matting_process_video' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {{APIKey}}' \
  -d '{
    "srcFileUrl": "https://d2t5pyzt5qvy2d.cloudfront.net/api/static_resource/prod/default/mq0MSmKgPGQQsxS9UovqH.mp4",
    "bitRate": "16m",
    "removeColorSpill": false
  }'
0Successful
{
  "code": 0,
  "message": "success",
  "data": {
    "taskId": "2e25206a92fb497e9fc546cc6b099789"
  }
}