Submits a snapshot job.
Usage notes
- Only JPG images can be generated by calling this operation.
- Asynchronous mode: This operation may return a response before snapshots are captured. Snapshot jobs are queued in the background and asynchronously processed by ApsaraVideo Media Processing (MPS). If the Interval or Num parameter is set, the snapshot job is processed in asynchronous mode. For information about frequently asked questions (FAQ) about capturing snapshots, see FAQ about capturing snapshots.
- Notifications: When you submit a snapshot job, the PipelineId parameter is required. An asynchronous message is sent only after the notification feature is enabled for the MPS queue.
QPS limit
You can call this operation up to 50 times per second per account. Requests that exceed this limit are dropped and you will experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see QPS limit.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | SubmitSnapshotJob |
The operation that you want to perform. Set the value to SubmitSnapshotJob. |
Input | String | Yes | null |
The information about the job input. The value must be a JSON object. You must grant
MPS-related permissions to the Object Storage Service (OSS) bucket that stores the
OSS object to be used as the job input. To grant the permissions, you can log on to
the MPS console, choose Workflows > Media Buckets in the left-side navigation pane,
and then click Add Bucket. Then, you must perform URL encoding for the OSS object.
Example: Note The OSS bucket must reside in the same region as your MPS service.
|
SnapshotConfig | String | Yes | null |
The snapshot capturing configuration. For more information, see the "AliyunSnapshotConfig" section in the Data types topic. Note If you set the Interval parameter that is nested under SnapshotConfig, snapshots are
captured at the specified intervals. The default value of the Interval parameter is
10, in seconds. If an input video is short but you specify large values for both the
Num and Interval parameters, the actual number of snapshots captured may be smaller
than the specified number. For example, if you set the Num parameter to 5 and the
Interval parameter to 3 for a video of 10 seconds, the number of snapshots captured
cannot reach 5.
|
UserData | String | No | testid-001 |
The custom data. The custom data can contain letters, digits, and hyphens (-) and be up to 1,024 bytes in size. The custom data cannot start with a special character. |
PipelineId | String | No | dd3dae411e704030b921e52698e5**** |
The ID of the MPS queue to which you want to submit the snapshot job. To obtain the ID, you can log on to the MPS console and choose Global Settings > Pipelines in the left-side navigation pane. Note Make sure that an available Message Service (MNS) topic is bound to the specified
MPS queue. Otherwise, the relevant messages may fail to be sent as expected.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 19B6D8C5-A5DD-467A-B435-29D393C71E2D |
The ID of the request. |
SnapshotJob | Object |
The information about the snapshot job. |
|
CreationTime | String | 2021-05-19T03:11:48Z |
The time when the job was created. |
SnapshotConfig | Object |
The snapshot capturing configuration. |
|
Time | String | 5 |
The start time for capturing snapshots. Unit: milliseconds. |
TileOut | Object |
The tiling configuration. |
|
Padding | String | 0 |
The distance between two consecutive single images in the tiled image.
|
Color | String | black |
The background color.
Note If you want to set the background color to black, you can specify the color keyword
in one of the following three formats: Black, black, and #000000.
|
CellSelStep | String | 3 |
The stride of a single image. |
CellHeight | String | 100 |
The height of a single image. The default value is the height of a captured snapshot. |
CellWidth | String | 100 |
The width of a single image. The default value is the width of a captured snapshot. |
Margin | String | 5 |
The margin width of the tiled image.
|
Columns | String | 10 |
The number of columns that the tiled image contains. Default value: 10. |
IsKeepCellPic | String | false |
Indicates whether the single images are retained. Valid values:
|
Lines | String | 10 |
The number of rows that the tiled image contains. Default value: 10. |
Interval | String | 20 |
The interval for capturing snapshots.
|
FrameType | String | intra |
The snapshot type. Default value: normal. Valid values:
Note If the FrameType parameter is set to intra in the request, only keyframes are captured.
If no keyframe is found at a specified time point, the keyframe closest to the specified
time point is captured. Keyframes are captured faster than normal frames if the same
snapshot rules are applied.
|
Width | String | 8 |
The width of a captured snapshot. |
Height | String | 8 |
The height of a captured snapshot. |
OutputFile | Object |
The information about the output file of the snapshot job. |
|
RoleArn | String | acs:ram::1:role/testrole |
The Alibaba Cloud Resource Name (ARN) of the specified RAM role. Format: acs:ram::$accountID:role/$roleName. |
Object | String | test.png |
The OSS object that is generated as the output file of the snapshot job. |
Location | String | example-location |
The ID of the region in which the OSS bucket that stores the object is located. |
Bucket | String | example |
The OSS bucket that stores the object. |
Num | String | 10 |
The number of snapshots. If the Num parameter is set in the request, snapshots are captured at intervals. |
TileOutputFile | Object |
The information about the output file of the tiling job. |
|
RoleArn | String | acs:ram::1:role/testrole |
The ARN of the specified RAM role. Format: acs:ram::$accountID:role/$roleName. |
Object | String | example.png |
The OSS object that is generated as the output file of the tiling job. |
Location | String | example-location |
The ID of the region in which the OSS bucket that stores the object is located. |
Bucket | String | example |
The OSS bucket that stores the object. |
State | String | Snapshoting |
The status of the snapshot job. Valid values:
|
Message | String | The resource operated InputFile is bad |
The error message returned when the job fails. This parameter is not returned if the job is successful. |
MNSMessageResult | Object |
The message sent by MNS to notify the user of the job result. |
|
MessageId | String | 799454621135656C7F815F198A76**** |
The ID of the message. This parameter is not returned if the job fails. |
ErrorMessage | String | The resource operated InputFile is bad |
The error message returned when the job fails. This parameter is not returned if the job is successful. |
ErrorCode | String | InvalidParameter |
The error code returned when the job fails. This parameter is not returned if the job is successful. |
Input | Object |
The information about the job input. |
|
RoleArn | String | acs:ram::1:role/testrole |
The ARN of the specified RAM role. Format: acs:ram::$accountID:role/$roleName. |
Object | String | example.flv |
The OSS object that is used as the input file. |
Location | String | example-location' |
The ID of the region in which the OSS bucket that stores the object is located. |
Bucket | String | example |
The OSS bucket that stores the object. |
Count | String | 1 |
The number of snapshots that are captured. |
TileCount | String | 5 |
The number of single images that are contained in the tiled image. |
UserData | String | testid-001 |
The custom data. |
Code | String | ResourceContentBad |
The error code returned when the job fails. This parameter is not returned if the job is successful. |
PipelineId | String | dd3dae411e704030b921e52698e5**** |
The ID of the MPS queue to which the snapshot job is submitted. |
Id | String | f4e3b9ba9f3840c39d6e288056f0**** |
The ID of the snapshot job. |
Examples
Sample request
http(s)://mts.cn-hangzhou.aliyuncs.com/?Action=SubmitSnapshotJob
&Input={"Bucket":"example-bucket","Location":"example-location","Object":"example%2Ftest.flv"}
&SnapshotConfig={"OutputFile":{"Bucket":"example-001","Location":"example-location","Object":"{Count}.jpg"},"Time":"5","Num":"10","Interval":"20"}
&UserData=testid-001
&PipelineId=dd3dae411e704030b921e52698e5****
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<SubmitSnapshotJobResponse>
<RequestId>19B6D8C5-A5DD-467A-B435-29D393C71E2D</RequestId>
<SnapshotJob>
<CreationTime>2021-05-19T03:11:48Z</CreationTime>
<SnapshotConfig>
<Time>5</Time>
<TileOut>
<Padding>0</Padding>
<Color>black</Color>
<CellSelStep>3</CellSelStep>
<CellHeight>100</CellHeight>
<CellWidth>100</CellWidth>
<Margin>5</Margin>
<Columns>10</Columns>
<IsKeepCellPic>false</IsKeepCellPic>
<Lines>10</Lines>
</TileOut>
<Interval>20</Interval>
<FrameType>intra</FrameType>
<Width>8</Width>
<Height>8</Height>
<OutputFile>
<RoleArn>acs:ram::1:role/testrole</RoleArn>
<Object>test.png</Object>
<Location>example-location</Location>
<Bucket>example</Bucket>
</OutputFile>
<Num>10</Num>
<TileOutputFile>
<RoleArn>acs:ram::1:role/testrole</RoleArn>
<Object>example.png</Object>
<Location>example-location</Location>
<Bucket>example</Bucket>
</TileOutputFile>
</SnapshotConfig>
<State>Snapshoting</State>
<Message>The resource operated InputFile is bad</Message>
<MNSMessageResult>
<MessageId>799454621135656C7F815F198A76****</MessageId>
<ErrorMessage>The resource operated InputFile is bad</ErrorMessage>
<ErrorCode>InvalidParameter</ErrorCode>
</MNSMessageResult>
<Input>
<RoleArn>acs:ram::1:role/testrole</RoleArn>
<Object>example.flv</Object>
<Location>example-location'</Location>
<Bucket>example</Bucket>
</Input>
<Count>1</Count>
<TileCount>5</TileCount>
<UserData>testid-001</UserData>
<Code>ResourceContentBad</Code>
<PipelineId>dd3dae411e704030b921e52698e5****</PipelineId>
<Id>f4e3b9ba9f3840c39d6e288056f0****</Id>
</SnapshotJob>
</SubmitSnapshotJobResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "19B6D8C5-A5DD-467A-B435-29D393C71E2D",
"SnapshotJob" : {
"CreationTime" : "2021-05-19T03:11:48Z",
"SnapshotConfig" : {
"Time" : "5",
"TileOut" : {
"Padding" : "0",
"Color" : "black",
"CellSelStep" : "3",
"CellHeight" : "100",
"CellWidth" : "100",
"Margin" : "5",
"Columns" : "10",
"IsKeepCellPic" : "false",
"Lines" : "10"
},
"Interval" : "20",
"FrameType" : "intra",
"Width" : "8",
"Height" : "8",
"OutputFile" : {
"RoleArn" : "acs:ram::1:role/testrole",
"Object" : "test.png",
"Location" : "example-location",
"Bucket" : "example"
},
"Num" : "10",
"TileOutputFile" : {
"RoleArn" : "acs:ram::1:role/testrole",
"Object" : "example.png",
"Location" : "example-location",
"Bucket" : "example"
}
},
"State" : "Snapshoting",
"Message" : "The resource operated InputFile is bad",
"MNSMessageResult" : {
"MessageId" : "799454621135656C7F815F198A76****",
"ErrorMessage" : "The resource operated InputFile is bad",
"ErrorCode" : "InvalidParameter"
},
"Input" : {
"RoleArn" : "acs:ram::1:role/testrole",
"Object" : "example.flv",
"Location" : "example-location'",
"Bucket" : "example"
},
"Count" : "1",
"TileCount" : "5",
"UserData" : "testid-001",
"Code" : "ResourceContentBad",
"PipelineId" : "dd3dae411e704030b921e52698e5****",
"Id" : "f4e3b9ba9f3840c39d6e288056f0****"
}
}
Error codes
For a list of error codes, visit the API Error Center.