Submits a snapshot job. After this operation is called, ApsaraVideo Media Processing takes snapshots and generates image sprites for the input file.
Operation description
-
The maximum size of a single input file is 100 GB. Exceeding this limit may cause the job to fail.
-
Make sure that the file is successfully uploaded to OSS before you submit a snapshot job. Otherwise, the job may fail. You can configure OSS callback messages to check the file upload status.
-
Snapshot jobs support synchronous and asynchronous modes.
The synchronous mode supports only a single snapshot. The image is generated when the API response is returned.
The asynchronous mode does not guarantee timeliness. After a snapshot job is submitted, the task is added to an MPS queue and scheduled for execution. Therefore, the snapshot may not be generated when the API response is returned. After the execution is complete, you must call the query snapshot job results operation to poll the execution results, or bind an MNS message to the MPS queue to receive the execution results. For more information, see Receive message notifications.
If you specify either the Interval or Num parameter, the asynchronous mode is used.
-
Currently, only JPG images can be generated.
-
For more FAQ about snapshots, see Snapshot FAQ.
QPS limits
The QPS limit for a single user calling this operation is 50 requests per second. If the limit is exceeded, API calls are throttled, which may affect your business. Make API calls properly. For more information, see QPS limits.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
mts:SubmitSnapshotJob |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Input |
string |
Yes |
The job input. For more information, see Input details. Note
|
{"Bucket":"example-bucket","Location":"example-location","Object":"example%2Ftest.flv"} |
| SnapshotConfig |
string |
Yes |
The snapshot configuration. For more information, see SnapshotConfig parameter details. |
{"OutputFile":{"Bucket":"example-001","Location":"example-location","Object":"{Count}.jpg"},"Time":"5","Num":"10","Interval":"20"} |
| UserData |
string |
No |
The custom user data. It supports Chinese and English characters, digits, and hyphens (-). It cannot start with a special character and can be up to 1,024 bytes in length. |
testid-001 |
| PipelineId |
string |
No |
The ID of the MPS queue. For more information, see Terms.
|
dd3dae411e704030b921e52698e5**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| RequestId |
string |
The ID of the request. |
19B6D8C5-A5DD-467A-B435-29D393C71E2D |
| SnapshotJob |
object |
The snapshot job. |
|
| CreationTime |
string |
The time when the job was created. The time is displayed in UTC and follows the ISO 8601 standard in the YYYY-MM-DDTHH:mm:ssZ format. |
2021-05-19T03:11:48Z |
| SnapshotConfig |
object |
The snapshot configuration. |
|
| Time |
string |
The start time of the snapshot. Unit: milliseconds. |
5 |
| TileOut |
object |
The image sprite configuration. |
|
| Padding |
string |
The spacing between images.
|
0 |
| Color |
string |
The background color.
Note
A color keyword supports three formats. For example, black can be represented as Black, black, or #000000. |
black |
| CellSelStep |
string |
The step size for selecting individual images. |
3 |
| CellHeight |
string |
The height of an individual image. Default value: the height of the snapshot output resolution. |
100 |
| CellWidth |
string |
The width of an individual image. Default value: the width of the snapshot output resolution. |
100 |
| Margin |
string |
The width of the outer frame.
|
5 |
| Columns |
string |
The number of columns in the image sprite. Default value: 10. |
10 |
| IsKeepCellPic |
string |
Specifies whether to retain individual images. Valid values:
|
false |
| Lines |
string |
The number of rows in the image sprite. Default value: 10. |
10 |
| Interval |
string |
The time interval between snapshots.
|
20 |
| FrameType |
string |
The snapshot type. Default value: normal. Valid values:
Note
If the Settings for the FrameType request parameter are set to I-frame (keyframe), only keyframes are captured. If the specified time point is not a keyframe, the nearest keyframe is captured. Under the same snapshot rules, capturing keyframes is faster than capturing normal frames. |
intra |
| Width |
string |
The width of the output snapshot image. |
8 |
| Height |
string |
The height of the output snapshot image. |
8 |
| OutputFile |
object |
The OSS configuration for the snapshot output. |
|
| RoleArn |
string |
The ARN of the specified role. Format: acs:ram::$accountID:role/$roleName. |
acs:ram::1:role/testrole |
| Object |
string |
The output file (OSS object). |
test.png |
| Location |
string |
The data center where the output OSS bucket is located (OSS location). |
example-location |
| Bucket |
string |
The OSS bucket where the output file is stored. |
example |
| Num |
string |
The number of snapshots. If this parameter is specified, sequential snapshots are taken. |
10 |
| TileOutputFile |
object |
The OSS configuration for the output image sprite. |
|
| RoleArn |
string |
The ARN of the specified role. Format: acs:ram::$accountID:role/$roleName. |
acs:ram::1:role/testrole |
| Object |
string |
The output file (OSS object). |
example.png |
| Location |
string |
The data center where the output OSS bucket is located (OSS location). |
example-location |
| Bucket |
string |
The OSS bucket where the output file is stored. |
example |
| TimeArray |
object |
||
| TimePointList |
array |
The array of specified time points. |
|
|
integer |
The array of specified time points. Unit: milliseconds. The values are floating-point numbers with two decimal places. The values can be duplicate and submitted in any order, and are sorted by MPS. A maximum of 100 time points can be specified. When this parameter is specified, the Num, Time, and Interval parameters cannot be specified. Otherwise, the InvalidParameter.Ambiguity error is returned. |
[10050, 50000, 110000, 1000500, 1100500] |
|
| State |
string |
The snapshot status. Valid values:
|
Snapshoting |
| Message |
string |
The error message returned when the job fails. This parameter is not returned if the job is successful. |
The resource operated InputFile is bad |
| MNSMessageResult |
object |
The result of the MNS notification sent to the user upon job completion. |
|
| MessageId |
string |
The message ID returned when the notification is successful. This parameter is not returned if the notification fails. |
799454621135656C7F815F198A76**** |
| ErrorMessage |
string |
The error message returned when the notification fails. This parameter is not returned if the notification is successful. |
The resource operated InputFile is bad |
| ErrorCode |
string |
The error code returned when the notification fails. This parameter is not returned if the notification is successful. |
InvalidParameter |
| Input |
object |
The job input. |
|
| RoleArn |
string |
The ARN of the specified role. Format: acs:ram::$accountID:role/$roleName. |
acs:ram::1:role/testrole |
| Object |
string |
The input file (OSS object). |
example.flv |
| Location |
string |
The data center where the input OSS bucket is located (OSS location). |
example-location' |
| Bucket |
string |
The OSS bucket where the input file is stored. |
example |
| Count |
string |
The number of captured images. |
1 |
| TileCount |
string |
The number of images in the image sprite. |
5 |
| UserData |
string |
The custom user data. |
testid-001 |
| Code |
string |
The error code returned when the job fails. This parameter is not returned if the job is successful. |
ResourceContentBad |
| PipelineId |
string |
The ID of the MPS queue. |
dd3dae411e704030b921e52698e5**** |
| Id |
string |
The ID of the snapshot job. |
f4e3b9ba9f3840c39d6e288056f0**** |
Examples
Success response
JSON format
{
"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"
},
"TimeArray": {
"TimePointList": [
0
]
}
},
"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
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.