The Composite After Video Matting API provides advanced video portrait compositing services. It allows you to take the results of a portrait matting process and seamlessly integrate the subject into a new background—whether it be an image, another video, or a solid color.
mattingAlphaFileUrl.taskId.compositeFileUrl.Enum: application/json
Bearer authentication token. Example: Bearer {{APIKey}}.
The URL of the original source video file.
The URL of the alpha channel (mask) file, typically retrieved from a previous Video Matting task.
The type of background to apply. Enum: image, video, or color.
The URL of the background image or video file. Required if backgroundType is image or video.
The hex or name of the background color. Required if backgroundType is color.
Specifies the bitrate for the generated video (e.g., 16m, 500k).
The horizontal (x) coordinate for overlay positioning when backgroundType is image.
The vertical (y) coordinate for overlay positioning when backgroundType is image.
Returns 0 for success, or a specific error code.
Returns "success" or a descriptive error message.
The unique identifier for the task. Use this ID with the Polling API to retrieve the generated output.
Use the Polling API to retrieve the processing results.
Alternatively, you can enable Callback to receive task results automatically upon completion.
{
"code": 0,
"message": "success",
"data": {
"task": {
"taskId": "09f426f4bd9e4aa3bd5742f8cf998f02",
"status": 3,
"taskType": "image_matting_composite_video",
"reason": ""
},
"mattingResult": {
"compositeFileUrl": "https://dreamface-resource-aigc.oss-us-east-1.aliyuncs.com/apiDocsAdmin/2025-4-1744805988229-compositeFileUrl.mp4"
}
}
}curl -X POST 'https://api.newportai.com/api/async/image_matting_composite_video' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {{APIKey}}' \
-d '{
"srcFileUrl": "https://d2t5pyzt5qvy2d.cloudfront.net/api/static_resource/prod/default/mq0MSmKgPGQQsxS9UovqH.mp4",
"mattingAlphaFileUrl": "https://dreamface-resource-aigc.oss-us-east-1.aliyuncs.com/apiDocsAdmin/2025-4-1744805292668-videoMatting_mattingAlphaFileUrl.mp4",
"backgroundColor": "232d84",
"backgroundType": "color"
}'{
"code": 0,
"message": "success",
"data": {
"taskId": "32da4d099e51496d20fd83f49bbe985d"
}
}