SubmitSnapshotJob
Submits a snapshot job. After you call this operation, 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. If the file size exceeds this limit, the job may fail.
-
Make sure that the file is uploaded to Object Storage Service (OSS) before you submit the snapshot job. Otherwise, the job fails. You can configure OSS callback messages to check the file upload status.
-
Snapshot jobs support synchronous and asynchronous modes.
The synchronous mode supports only single-frame snapshots. The snapshot is generated when the API response is returned.
The asynchronous mode does not guarantee real-time processing. After you submit a snapshot job, the task is added to an MPS queue for scheduling and execution. Therefore, the snapshot may not be generated when the API response is returned. After the job is completed, you must call the query snapshot job result operation to poll the execution result, or bind an MNS message to the MPS queue to receive the execution result. For more information, see Receive message notifications.
If you specify the Interval or Num parameter, the asynchronous mode is used.
-
Only JPG images can be generated.
-
For more information about snapshot FAQs, see FAQ about snapshots.
QPS limits
The QPS limit for a single user is 50 calls per second. If the limit is exceeded, API calls are throttled, which may affect your business. Make API calls at a reasonable rate. 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 parameters. |
{"OutputFile":{"Bucket":"example-001","Location":"example-location","Object":"{Count}.jpg"},"Time":"5","Num":"10","Interval":"20"} |
| UserData |
string |
No |
The custom user data. The value can contain Chinese and English characters, digits, and hyphens (-), and cannot start with a special character. The maximum length is 1,024 bytes. |
testid-001 |
| PipelineId |
string |
No |
The MPS queue ID. For more information, see Terms.
|
dd3dae411e704030b921e52698e5**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| RequestId |
string |
The request ID. |
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 specified as Black, black, or #000000. |
black |
| CellSelStep |
string |
The step size for selecting a single image. |
3 |
| CellHeight |
string |
The height of a single image. Default value: the height of the snapshot output resolution. |
100 |
| CellWidth |
string |
The width of a single 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 the single 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 FrameType parameter Settings in the request parameter is 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 resides (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 resides (OSS location). |
example-location |
| Bucket |
string |
The OSS bucket where the output file is stored. |
example |
| TimeArray |
object |
[10050, 50000, 110000, 1000500, 1100500] |
|
| TimePointList |
array |
The array of specified time points. |
[10050, 50000, 110000, 1000500, 1100500] |
|
integer |
The array of specified time points. Unit: milliseconds. The value is a floating-point number with two decimal places. The values can be duplicate and submitted in any order, and are sorted by MPS. You can specify up to 100 time points. If you specify this parameter, do not specify the Num, Time, or Interval parameter. Otherwise, the InvalidParameter.Ambiguity error is returned. |
10050 |
|
| State |
string |
The snapshot status. Valid values:
|
Snapshoting |
| Message |
string |
The error message returned when the snapshot 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 for 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 resides (OSS location). |
example-location' |
| Bucket |
string |
The OSS bucket where the input file is stored. |
example |
| Count |
string |
The number of captured snapshots. |
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 snapshot job fails. This parameter is not returned if the job is successful. |
ResourceContentBad |
| PipelineId |
string |
The MPS queue ID. |
dd3dae411e704030b921e52698e5**** |
| Id |
string |
The snapshot job ID. |
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.