All Products
Search
Document Center

Intelligent Media Services:Sports highlights

Last Updated:Jun 02, 2026

Use these parameters and SDK examples to generate sports event highlights.

Important

The region in the OSS URL must match the API service endpoint region. Only the China (Shanghai) region is supported.

Note

Read Batch video production first for an overview of the parameters and workflow.

Usage notes

InputConfig

Specifies source materials and processing options.

Parameter

Type

Description

Example

Required

SportsCategory

String

The type of sports event.

Valid values:

  • basketball

  • pingpong

basketball

Yes

InputMedia

String

The source video. Specify a media asset ID or media URL.

  • Only a single input is supported.

  • Only video files in the Video formats list are supported.

****9d46c8b4548681030f6e****

Yes

FaceRegister

List<FaceInfo>

Face registration settings. Maximum 5 entries.

Parameter example

No

SlowMotionLogoRegister

SlowMotionLogoRegister

Logos that precede slow-motion scenes in the source video. Required to include slow-motion shots in highlights. Maximum 5 entries.

Parameter example

No

TransferNameRegister

List<TransferNameInfo>

Maps abbreviated scoreboard names to full team or player names. Maximum 10 entries.

Parameter example

Yes

FaceInfo

Field

Type

Description

Example

Required

FaceUrls

List<String>

  • URLs of face images. Provide both frontal and side-view photos for best results. Each image must contain only one clear, unobstructed face.

  • Accepted types: Image formats.

["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>

  • URLs of logo images that precede slow-motion scenes in the source video.

  • Accepted types: Image formats.

["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 {index} placeholder.

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

  • When true, the job generates only a preview timeline without producing an output video. Output URL and dimensions are not required.

  • When the job is complete, call GetBatchMediaProducingJob to get the results. The projectId of the editing project is included in the sub-task list of the response. Then, call GetEditingProject to get the preview timeline.

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

Video

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

Expand to view

package com.example.vodservicesdktest.ice.editing;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import com.aliyun.ice20201109.Client;
import com.aliyun.ice20201109.models.GetBatchMediaProducingJobRequest;
import com.aliyun.ice20201109.models.GetBatchMediaProducingJobResponse;
import com.aliyun.ice20201109.models.SubmitSportsHighlightsJobRequest;
import com.aliyun.ice20201109.models.SubmitSportsHighlightsJobResponse;
import com.aliyun.teaopenapi.models.Config;

/**
 *  Add the following Maven dependencies:
 *   <dependency>
 *      <groupId>com.aliyun</groupId>
 *      <artifactId>ice20201109</artifactId>
 *      <version>3.4.0</version>
 *  </dependency>
 *  <dependency>
 *      <groupId>com.alibaba</groupId>
 *      <artifactId>fastjson</artifactId>
 *      <version>1.2.9</version>
 *  </dependency>
 */
public class SportsHighlightsJobService {

    static final String regionId = "[your-region-id]";
    static final String bucket = "[your-bucket]";
    private Client iceClient;

    public static void main(String[] args) throws Exception {
        SportsHighlightsJobService scriptBatchEditingService = new SportsHighlightsJobService();
        scriptBatchEditingService.initClient();
        scriptBatchEditingService.runExample();
    }

    public void initClient() throws Exception {
        // An AccessKey pair from an Alibaba Cloud account can call all API operations. For security, we recommend using a RAM user for API calls and routine O&M.
        // This example shows how to configure the AccessKey ID and AccessKey Secret in environment variables. For more information, see https://www.alibabacloud.com/help/en/sdk/developer-reference/v2-manage-access-credentials
        com.aliyun.credentials.Client credentialClient = new com.aliyun.credentials.Client();

        Config config = new Config();
        config.setCredential(credentialClient);

        // If you want to hard-code the AccessKey ID and AccessKey Secret, use the following code. However, we strongly recommend that you do not hard-code them in your project to prevent AccessKey pair leakage and ensure the security of all your resources.
        // config.accessKeyId = <Your AccessKey ID>;
        // config.accessKeySecret = <Your AccessKey Secret>;
        config.endpoint = "ice." + regionId + ".aliyuncs.com";
        config.regionId = regionId;
        iceClient = new Client(config);
    }

    public void runExample() throws Exception {

        JSONObject inputConfig = new JSONObject();
        inputConfig.put("SportsCategory", "basketball");
        inputConfig.put("InputMedia", "http://[your-bucket].oss-[your-region-id].aliyuncs.com/basketball.mp4");

        JSONArray transferNameRegisterArray = new JSONArray();
        JSONObject transferName = new JSONObject();
        transferName.put("OriginalName", "IND");
        transferName.put("TransferName", "Indiana Pacers");
        transferNameRegisterArray.add(transferName);
        inputConfig.put("TransferNameRegister", transferNameRegisterArray);

        // Output video dimensions for a vertical video
        //int outputWidth = 1080;
        //int outputHeight = 1920;

        // Output video dimensions for a horizontal video
        int outputWidth = 1920;
        int outputHeight = 1080;

        // The OSS URL for the output video. Must include the {index} placeholder.
        String mediaUrl = "http://" + bucket + ".oss-" + regionId + ".aliyuncs.com/sports_highlights/output_{index}.mp4";

        JSONObject outputConfig = new JSONObject();
        outputConfig.put("MediaURL", mediaUrl);
        outputConfig.put("Width", outputWidth);
        outputConfig.put("Height", outputHeight);

        // Submit a sports highlights job
        SubmitSportsHighlightsJobRequest request = new SubmitSportsHighlightsJobRequest();
        request.setInputConfig(inputConfig.toJSONString());
        request.setOutputConfig(outputConfig.toJSONString());

        SubmitSportsHighlightsJobResponse response = iceClient.submitSportsHighlightsJob(request);
        String jobId = response.getBody().getJobId();
        System.out.println("Start sports highlights job, JobId: " + jobId);

        // Poll for job completion
        System.out.println("Waiting for job to finish...");
        int maxTry = 3000;
        int i = 0;
        while (i < maxTry) {
            Thread.sleep(3000);
            i++;
            GetBatchMediaProducingJobRequest getRequest = new GetBatchMediaProducingJobRequest();
            getRequest.setJobId(jobId);
            GetBatchMediaProducingJobResponse getResponse = iceClient.getBatchMediaProducingJob(getRequest);
            String status = getResponse.getBody().getEditingBatchJob().getStatus();
            System.out.println("JobId: " + jobId + ", status:" + status);

            if ("Failed".equals(status)) {
                System.out.println("Job failed. JobInfo: " + JSONObject.toJSONString(getResponse.getBody().getEditingBatchJob()));
                throw new Exception("Production failed. BatchJobId: " + jobId);
            }

            if ("Finished".equals(status)) {
                System.out.println("Job finished. JobInfo: " + JSONObject.toJSONString(getResponse.getBody().getEditingBatchJob()));
                break;
            }
        }
    }
}

API request parameters

Expand to view InputConfig

{
  "SportsCategory": "basketball",
  "InputMedia": "http://[your-bucket].oss-[your-region-id].aliyuncs.com/basketball-0707.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"
    }
  ]
}

Expand to view OutputConfig

{
  "Count": 1,
  "Height": 1080,
  "Width": 1920,
  "MediaURL": "http://[your-bucket].oss-[your-region-id].aliyuncs.com/[your-file-path]/[your-file-name]_{index}.mp4"
}

Processing logic

  • SportsCategory determines the event type: basketball or pingpong.

  • FaceRegister identifies shots of specified athletes for the highlights.

  • SlowMotionLogoRegister provides logos to detect slow-motion replays in the source video.

  • TransferNameRegister maps abbreviated scoreboard names to full team names.

API reference