This topic describes the data structures of the request parameters of SubmitHighlightExtractionJob and the response parameters of GetSmartHandleJob.
When you call relevant operations, the region in the OSS URLs of media assets must be the same as the region in the OpenAPI endpoint.
Supported regions: China (Shanghai), China (Beijing), China (Hangzhou), China (Shenzhen), US (Silicon Valley), Singapore. The action recognition capability (corresponding to Strategy.EnableActionRecog and Strategy.CustomActions) is only available in the China (Shanghai) region.
Videos must contain either subtitles or human voices. Materials lacking both are unsupported.
Relevant APIs
To submit a highlight extraction job, see SubmitHighlightExtractionJob. The data structures of key parameters (InputConfig and OutputConfig) are described in the following sections.
To obtain details about a highlight extraction job, see GetSmartHandleJob. The result parameters (AiResult) are described in the following sections.
InputConfig
Configure InputConfig to specify video materials and highlight extraction strategy.
Parameter | Type | Description | Required |
MediaArray | List<Media> |
| Yes |
Strategy | JSON | The highlight extraction strategy.
| No |
Media
Parameter | Type | Description | Required |
MediaId | String | The ID of the media asset. | You must specify either If both are specified, |
MediaURL | String | The OSS URL to the media file. |
Example
{
"MediaArray": [
{
"MediaId": "1cb94770da*******75e6e6c5486302"
}
],
"Strategy": {
"Count": 5,
"ClipDuration": 15,
"EnableActionRecog": true,
"CustomActions": ["Fight","Cry"]
}
}OutputConfig
Configure OutputConfig to specify output settings, such as the storage location and naming of output videos.
Parameter | Type | Description | Required | Example |
NeedExport | Boolean | Specifies whether to directly export clips. Valid values:
Default value: false. | No | false |
OutputMediaTarget | String | Required only if
| No | oss-object |
Endpoint | String | The S3 protocol-compatible endpoint. Specify an OSS endpoint in which the region is the same as where the service is called. | No | https://oss-cn-shanghai.aliyuncs.com |
Bucket | String | Required only if Specify your OSS bucket, which is S3 protocol-compatible. | No | your bucket |
ObjectKey | String | Required only if The naming for the OSS objects. Supported placeholder:
| No | dir/to/testOutput_{index}.mp4 |
ExportAsNewMedia | Boolean | Optional when Specifies whether to output as new media assets. Only supported when Default value: false. | No | false |
Width | Integer | Optional when The output video width in pixels. If not specified, it will be the same as the source video | No | 1280 |
Height | Integer | Optional when The output video height in pixels. If not specified, it will be the same as the source video | No | 720 |
JSONObject | Optional when The stream configuration of the output video, such as CRF and codec. | No | { "Bitrate": 3000 } |
Example
{
"NeedExport": true,
"OutputMediaTarget": "oss-object",
"Endpoint": "https://oss-cn-shanghai.aliyuncs.com"
"Bucket": "your-bucket",
"ObjectKey": "dir/to/testOutput_{index}.mp4",
"ExportAsNewMedia": false,
"Width": 1280,
"Height": 720,
"Video": {
"Bitrate": 3000
}
}GetSmartHandleJob
This section shows the response parameters when you call GetSmartHandleJob to query the result of a highlight extraction job.
AiResult
{
"HighlightResults": [
{
"Media": "MediaId1", //If URL was specified in InputConfig, then URL will be returned here.
"TimeRanges": [
{
"In": 20,
"Out": 30,
"Tags": ["Fight","Cry"], // Detected action tags.
"OutputURL": "http://your bucket.oss-cn-shanghai.aliyuncs.com/output_0.mp4", // Only returned when needExport is set to true.
"MediaId": "MediaId11", // Only returned when ExportAsNewMedia is set to true.
}
]
},
{
"Media": "MediaId2", //If URL was specified in InputConfig, then URL will be returned here.
"TimeRanges": [
{
"In": 2,
"Out": 10,
"Tags": ["Run","Shout"],
"OutputURL": "http://your bucket.oss-cn-******.aliyuncs.com/output_1.mp4" // Only returned when needExport is set to true.
},
{
"In": 40,
"Out": 50,
"OutputURL": "http://your bucket.oss-cn-******.aliyuncs.com/output_2.mp4" // Only returned when needExport is set to true.
}
]
}
]
}