Use these parameters and SDK examples to generate sports event highlights.
The region in the OSS URL must match the API service endpoint region. Only the China (Shanghai) region is supported.
Read Batch video production first for an overview of the parameters and workflow.
Usage notes
-
To generate a highlights clip from a full game video, call the SubmitSportsHighlightsJob API. Key parameters are described in InputConfig and OutputConfig below.
-
To get the details of a video generation job, call the GetBatchMediaProducingJob API.
InputConfig
Specifies source materials and processing options.
|
Parameter |
Type |
Description |
Example |
Required |
|
SportsCategory |
String |
The type of sports event. Valid values:
|
basketball |
Yes |
|
InputMedia |
String |
The source video. Specify a media asset ID or media URL.
|
****9d46c8b4548681030f6e**** |
Yes |
|
FaceRegister |
List<FaceInfo> |
Face registration settings. Maximum 5 entries. |
No |
|
|
SlowMotionLogoRegister |
Logos that precede slow-motion scenes in the source video. Required to include slow-motion shots in highlights. Maximum 5 entries. |
No |
||
|
TransferNameRegister |
List<TransferNameInfo> |
Maps abbreviated scoreboard names to full team or player names. Maximum 10 entries. |
Yes |
FaceInfo
|
Field |
Type |
Description |
Example |
Required |
|
FaceUrls |
List<String> |
|
["http://[your-bucket].oss-[your-region-id].aliyuncs.com/test1.png","http://[your-bucket].oss-[your-region-id].aliyuncs.com/test1.png"] |
Yes |
|
Name |
String |
The person's name. Must match the scoreboard name in the input video. |
John Doe |
Yes |
SlowMotionLogoRegister
|
Field |
Type |
Description |
Example |
Required |
|
SlowMotionLogoUrls |
List<String> |
|
["http://[your-bucket].oss-[your-region-id].aliyuncs.com/test1.png","http://[your-bucket].oss-[your-region-id].aliyuncs.com/test1.png"] |
Yes |
TransferNameInfo
|
Field |
Type |
Description |
Example |
Required |
|
OriginalName |
String |
The abbreviated name from the scoreboard. |
Rockets |
Yes |
|
TransferName |
String |
The full name. |
Houston Rockets |
Yes |
Parameter example
{
"SportsCategory": "basketball",
"InputMedia": "http://[your-bucket].oss-[your-region-id].aliyuncs.com/[your-file-path]/[your-file-name].mp4",
"FaceRegister": [
{
"FaceUrls": ["http://testcdn.com/front.jpg", "http://testcdn.com/side.jpg"],
"Name": "James"
}
],
"SlowMotionLogoRegister": {
"SlowMotionLogoUrls": ["http://testcdn.com/logo1.jpg", "http://testcdn.com/logo2.jpg"]
},
"TransferNameRegister": [
{
"OriginalName": "IND",
"TransferName": "Indiana Pacers"
}
]
}
EditingConfig
Not currently supported.
OutputConfig
Specifies output video settings: destination, file naming, dimensions, and video count.
|
Parameter |
Type |
Description |
Example |
Required |
|
MediaURL |
String |
Output video URL. Must include the |
Format: http://[your-bucket].oss-[your-region-id].aliyuncs.com/[your-file-path]/[your-file-name]_{index}.mp4 Example: http://example.oss-cn-shanghai.aliyuncs.com/example/example_{index}.mp4 |
Required when GeneratePreviewOnly is false and the output destination is OSS. |
|
StorageLocation |
String |
Storage location for the output file in ApsaraVideo VOD. |
Format: [your-vod-bucket].oss-[your-region-id].aliyuncs.com Example: outin-****6c886b4549d481030f6e****.oss-cn-shanghai.aliyuncs.com |
Required when GeneratePreviewOnly is false and the output destination is ApsaraVideo VOD. |
|
FileName |
String |
Output file name. Must contain the {index} placeholder. |
Format: [your-file-name]_{index}.mp4 Example: example_{index}.mp4 |
Required when GeneratePreviewOnly is false and the output destination is ApsaraVideo VOD. |
|
GeneratePreviewOnly |
Boolean |
|
false |
No. The default value is false. |
|
Count |
Integer |
Number of output videos. Currently only 1 is supported. |
1 |
No. The default value is 1. |
|
Width |
Integer |
The width of the output video, in pixels. |
1080 |
Yes |
|
Height |
Integer |
The height of the output video, in pixels. |
1920 |
Yes |
|
JSONObject |
Settings for the output video stream, such as CRF and codec. |
{"Crf": 27} |
No |
Parameter example
{
"MediaURL": "http://[your-bucket].oss-[your-region-id].aliyuncs.com/xxx_{index}.mp4",
"Count": 1,
"Width": 1080,
"Height": 1920,
"Video": {"Crf": 27},
"GeneratePreviewOnly": false
}
SDK example
Prerequisite
You have installed the server-side SDK of IMS. For more information, see Preparations.
Code sample
API request parameters
Processing logic
-
SportsCategorydetermines the event type:basketballorpingpong. -
FaceRegisteridentifies shots of specified athletes for the highlights. -
SlowMotionLogoRegisterprovides logos to detect slow-motion replays in the source video. -
TransferNameRegistermaps abbreviated scoreboard names to full team names.
API reference
-
To submit a sports highlights job, see SubmitSportsHighlightsJob.
-
To retrieve details of a batch video production job, see GetBatchMediaProducingJob.
-
To get ready for the use of server-side SDK, see Preparations.
-
To submit a media editing and production job, see SubmitMediaProducingJob.