tencent cloud

Submitting Tasks
Last updated: 2025-11-19 17:02:09
Submitting Tasks
Last updated: 2025-11-19 17:02:09

Feature Description

Submit a video portrait matting task.

Authorization Description

When using with a sub-account, the ci:CreateBodyJointsDetectJob permission is required. For details, see Cloud Infinite action.
When a sub-account uses an asynchronous processing interface, the cam:passrole permission is required. The asynchronous processing interface performs read and write operations on COS resources through the "role" in CAM. The PassRole permission is used for role passing. For details, refer to Access Management - Write Operation - PassRole API.

Activating a Service

Using this feature requires enabling Cloud Infinite in advance and binding a bucket. For details, see Bind bucket.
Use this feature requires enabling AI Content Recognition Service in advance via console or API. For details, see Enable AI Content Recognition Service.

Use Limits

When using this API, please confirm the relevant restrictions first. For details, see Usage Limits.

Fee Description

This API is a paid service. Generated costs will be charged by Cloud Infinite. For detailed billing instructions, see Content recognition.


Request

Request sample

POST /jobs HTTP/1.1
Host: <BucketName-APPID>.ci.<Region>.myqcloud.com
Date: <GMT Date>
Authorization: <Auth String>
Content-Length: <length>
Content-Type: application/xml

<body>
Note:
Authorization: Auth String. For details, see Request Signature document.

Request header

This API only uses common request headers. For details, see Common Request Headers documentation.

Request body

The implementation of this request operation requires the following request body.
<Request>
<Tag>SegmentVideoBody</Tag>
<Input>
<Object>input/test.mp4</Object>
</Input>
<Operation>
<SegmentVideoBody>
<Mode>Mask</Mode>
</SegmentVideoBody>
<UserData>This is my data.</UserData>
<JobLevel>0</JobLevel>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-123456789</Bucket>
<Object>output/out.mp4</Object>
</Output>
</Operation>
<CallBack>http://callback.demo.com</CallBack>
<CallBackFormat>JSON<CallBackFormat>
</Request>
The data are described as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Request
None.
Container for saving requests
Container
Yes
The specific data description of the Container type Request is as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Tag
Request
Create task Tag: SegmentVideoBody
String
Yes
Input
Request
Object information to be operated
Container
Yes
Operation
Request
Operation rule
Container
Yes
CallBackFormat
Request
Job callback format, JSON or XML, default is XML, priority is higher than the callback format of the queue
String
No
CallBackType
Request
Job callback type, Url or TDMQ, default is Url, priority is higher than the callback type of the queue
String
No
CallBack
Request
Job callback address, priority is higher than the callback address of the queue. When set to no, it means the queue's callback address does not generate a callback.
String
No
CallBackMqConfig
Request
Task callback TDMQ configuration, required when CallBackType is TDMQ. For details, see CallBackMqConfig.
Container
No
The specific data description of the Container type Input is as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Object
Request.Input
File path
String
Yes
The specific data description of the Container type
Operation
is as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
SegmentVideoBody
Request.Operation
Video portrait matting configuration
Container
No
Output
Request.Operation
Output configuration
Container
Yes
UserData
Request.Operation
Pass through user information Printable ASCII code Length not exceeding 1024
String
No
JobLevel
Request.Operation
Task priority, level limit: 0, 1, 2. Higher levels indicate higher task priority, default is 0.
String
No
The specific data description of the Container type SegmentVideoBody is as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Mode
Request.Operation.SegmentVideoBody
Matting Mode
Mask: Output alpha channel result
Foreground: Output foreground video
Combination: Output the video synthesized from the foreground after matting and the custom background
Default value: Mask
String
No
SegmentType
Request.Operation.SegmentVideoBody
Matting Type
HumanSeg: Portrait matting
GreenScreenSeg: Green screen matting
SolidColorSeg: Solid color background matting
Default value: HumanSeg
String
No
BackgroundRed
Request.Operation.SegmentVideoBody
The parameter takes effect when mode is Foreground, with background color set to red, parameter value range [0, 255], default value 0.
String
No
BackgroundGreen
Request.Operation.SegmentVideoBody
The parameter takes effect when mode is Foreground, with background color set to green, parameter value range [0, 255], default value 0.
String
No
BackgroundBlue
Request.Operation.SegmentVideoBody
The parameter takes effect when mode is Foreground, with background color set to blue, parameter value range [0, 255], default value 0.
String
No
BackgroundLogoUrl
Request.Operation.SegmentVideoBody
Import a background file. This parameter is required when mode is Combination, and the background file must be in the same bucket as the source file.
String
No
BinaryThreshold
Request.Operation.SegmentVideoBody
Adjust the edge position of image matting, with a value range of [0, 255], and a default value of 0.
String
No
RemoveRed
Request.Operation.SegmentVideoBody
Background color for solid color background matting (red), takes effect when SegmentType is SolidColorSeg, value range is [0, 255], default value is 0.
String
No
RemoveGreen
Request.Operation.SegmentVideoBody
Background color for solid color background matting (green), takes effect when SegmentType is SolidColorSeg, value range is [0, 255], default value is 0.
String
No
RemoveBlue
Request.Operation.SegmentVideoBody
Background color for solid color background matting (blue), takes effect when SegmentType is SolidColorSeg, value range is [0, 255], default value is 0.
String
No
The specific data description of the Container type Output is as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Region
Request.Operation.Output
Region of the storage bucket
String
Yes
Bucket
Request.Operation.Output
Bucket for storing results
String
Yes
Object
Request.Operation.Output
Output result filename
String
Yes

Response

Response Headers

This API only returns the public response header. For details, see Common Response Headers documentation.

Response Body

The response body is returned as application/xml. An example including the complete node data is shown below:
<Response>
<JobsDetail>
<Code>Success</Code>
<Message/>
<JobId>ac7c990a00bf211ed946af9e0691f2b7a</JobId>
<State>Submitted</State>
<CreationTime>2022-06-27T14:44:10+0800</CreationTime>
<StartTime>-</StartTime>
<EndTime>-</EndTime>
<QueueId>pcd463e1467964d39ad2d3f66aacd8199</QueueId>
<Tag>SegmentVideoBody</Tag>
<Input>
<BucketId>test-123456789</BucketId>
<Object>input/test.mp4</Object>
<Region>ap-chongqing</Region>
</Input>
<Operation>
<SegmentVideoBody>
<Mode>Mask</Mode>
</SegmentVideoBody>
<UserData>This is my data.</UserData>
<JobLevel>0</JobLevel>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-123456789</Bucket>
<Object>output/out.mp4</Object>
</Output>
</Operation>
</JobsDetail>
</Response>
The data are as follows:
Node Name (Keyword)
Parent Node
Description
Type
Response
None.
Container for saving results
Container
Container node Response content:
Node Name (Keyword)
Parent Node
Description
Type
JobsDetail
Response
Task detailed information
Container array
The content of Container node
JobsDetail
:
Node Name (Keyword)
Parent Node
Description
Type
Code
Response.JobsDetail
error code, meaningful only when State is Failed
String
Message
Response.JobsDetail
error description, meaningful only when State is Failed
String
JobId
Response.JobsDetail
Create task ID
String
Tag
Response.JobsDetail
Create task Tag: SegmentVideoBody
String
State
Response.JobsDetail
Task Status
Submitted Pending execution
Running: Executing
Success: Execution successful
Failed: Execution failed
Pause: Task pause. When the pause queue is triggered, to-be-executed tasks become paused state.
Cancel: Task cancelled
String
CreationTime
Response.JobsDetail
Task creation time
String
StartTime
Response.JobsDetail
Task Start Time
String
EndTime
Response.JobsDetail
Task End Time
String
QueueId
Response.JobsDetail
Task's Queue ID
String
Input
Response.JobsDetail
Request.Input node in the same request
Container
Operation
Response.JobsDetail
Rules of this task
Container
Container node Operation content:
Node Name (Keyword)
Parent Node
Description
Type
SegmentVideoBody
Response.JobsDetail.Operation
Request.Operation.SegmentVideoBody in the same request
Container
Output
Response.JobsDetail.Operation
Same as Request.Operation.Output in the request
Container
UserData
Response.JobsDetail.Operation
Pass through user information
String
JobLevel
Response.JobsDetail.Operation
Task Priority
String
MediaInfo
Response.JobsDetail.Operation
Output file's media information, do not return if the task is incomplete, see MediaInfo for details.
Container
MediaResult
Response.JobsDetail.Operation
Output file's basic information, do not return if the task is incomplete, see MediaResult for details.
Container

Error Codes

This request returns common error responses and error codes. For more information, see Error Codes.

Examples

Request

POST /jobs HTTP/1.1
Authorization: q-sign-algorithm=sha1&q-ak=**********************************&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=**************************************
Host: test-1234567890.ci.ap-beijing.myqcloud.com
Content-Length: 166
Content-Type: application/xml

<Request>
<Tag>SegmentVideoBody</Tag>
<Input>
<Object>input/test.mp4</Object>
</Input>
<Operation>
<SegmentVideoBody>
<Mode>Mask</Mode>
</SegmentVideoBody>
<UserData>This is my data.</UserData>
<JobLevel>0</JobLevel>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-123456789</Bucket>
<Object>output/out.mp4</Object>
</Output>
</Operation>
<CallBack>http://callback.demo.com</CallBack>
<CallBackFormat>JSON<CallBackFormat>
</Request>

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 230
Connection: keep-alive
Date: Mon, 28 Jun 2022 15:23:12 GMT
Server: tencent-ci
x-ci-request-id: NTk0MjdmODlfMjQ4OGY3XzYzYzhf****

<Response>
<JobsDetail>
<Code>Success</Code>
<Message/>
<JobId>ac7c990a00bf211ed946af9e0691f2b7a</JobId>
<State>Submitted</State>
<CreationTime>2022-06-27T14:44:10+0800</CreationTime>
<StartTime>-</StartTime>
<EndTime>-</EndTime>
<QueueId>pcd463e1467964d39ad2d3f66aacd8199</QueueId>
<Tag>SegmentVideoBody</Tag>
<Input>
<BucketId>test-123456789</BucketId>
<Object>input/test.mp4</Object>
<Region>ap-chongqing</Region>
</Input>
<Operation>
<SegmentVideoBody>
<Mode>Mask</Mode>
</SegmentVideoBody>
<UserData>This is my data.</UserData>
<JobLevel>0</JobLevel>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-123456789</Bucket>
<Object>output/out.mp4</Object>
</Output>
</Operation>
</JobsDetail>
</Response>

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback