すべてのプロダクト
Search
ドキュメントセンター

Intelligent Media Services:スポーツハイライト

最終更新日:Nov 09, 2025

このドキュメントでは、スポーツイベントのハイライトシナリオにおけるインテリジェントな画像テキストマッチングビデオ制作のための合成パラメーターと SDK 呼び出しの例を紹介します。

重要
  • 注:このインターフェイスでは、すべてのメディアアセット OSS URL のリージョンは、OpenAPI サービスエンドポイントのリージョンと一致している必要があります。

  • サポートされているリージョン:中国 (上海)。

  • 実際の使用では、ドキュメント内の [your-bucket]、[your-region-id]、[your-file-name]、[your-file-path]、メディアアセット ID (例: "****9d46c8b4548681030f6e****") などのすべてのパラメーター例を実際の値に置き換える必要があります。

説明

使用方法

InputConfig パラメーター

InputConfig を構成して、ビデオ素材、ナレーション、BGM、ステッカーなどの基本素材のパラメーター構成を指定できます。

パラメーター

タイプ

説明

値の例

必須

SportsCategory

String

スポーツイベントのタイプ

バスケットボール: basketball

卓球: pingpong

basketball

はい

InputMedia

String

入力スポーツイベント素材。MediaId または MediaURL をサポートします

  • 単一の素材のみをサポートします。

  • ビデオのみをサポートします。サポートされているフォーマットについては、「ビデオフォーマット」をご参照ください。

****9d46c8b4548681030f6e****

はい

FaceRegister

List<FaceInfo>

人物 ID、配列の長さは 5 以下です。

パラメーターの例」をご参照ください

いいえ

SlowMotionLogoRegister

SlowMotionLogoRegister

スローモーション識別子。最終的なビデオでスローモーションが必要な場合は、ソースビデオのスローモーションの前に表示されるロゴ識別情報を提供する必要があります。配列の長さは 5 以下です。

パラメーターの例」をご参照ください

いいえ

TransferNameRegister

List<TransferNameInfo>

名前転写識別子。スコアボードのチーム名の略称を完全なチーム名に変換します。配列の長さは 10 以下です。

パラメーターの例」をご参照ください

はい

FaceInfo パラメーター

フィールド

タイプ

説明

値の例

必須

FaceUrls

List<String>

  • 顔画像リンク。正面と側面の顔の両方を含めることをお勧めします。顔画像には 1 人の個人しか含まれていないこと、また、顔がはっきりと見え、明らかな遮蔽や特徴の欠落がないことを確認してください。

  • サポートされているフォーマットについては、「画像フォーマット」をご参照ください。

["http://[your-bucket].oss-[your-region-id].aliyuncs.com/test1.png","http://[your-bucket].oss-[your-region-id].aliyuncs.com/test1.png""]

はい

Name

String

人物の名前。入力ビデオのスコアボードに表示される名前と一致する必要があります

James

はい

SlowMotionLogoRegister パラメーター

フィールド

タイプ

説明

値の例

必須

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

はい

TransferNameInfo パラメーター

フィールド

タイプ

説明

値の例

必須

OriginalName

String

イベントスコアボードのチーム名の略称

Rockets

はい

TransferName

String

完全なチーム名

Houston Rockets

はい

パラメーターの例

{
  "SportsCategory": "Basketball",
  "InputMedia": "http://[your-bucket].oss-[your-region-id].aliyuncs.com/[your-file-path]/[your-file-name]_{index}.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 パラメーター

説明

現在、EditingConfig パラメーターの構成はサポートされていません。

OutputConfig パラメーター

OutputConfig を構成して、出力アドレス、命名規則、最終ビデオの幅と高さ、出力ビデオ数などの合成パラメーターを指定できます。

パラメーター

タイプ

説明

値の例

必須

MediaURL

String

出力ビデオアドレス。{index} プレースホルダーを含める必要があります。

ルール: http://[your-bucket].oss-[your-region-id].aliyuncs.com/[your-file-path]/[your-file-name]_{index}.mp4

例: http://example.oss-cn-shanghai.aliyuncs.com/example/example_{index}.mp4

GeneratePreviewOnly=false で、出力先が OSS の場合に必須

StorageLocation

String

VOD に出力されるメディアファイルのストレージの場所を指定します。

ルール: [your-vod-bucket].oss-[your-region-id].aliyuncs.com

例: outin-****6c886b4549d481030f6e****.oss-cn-shanghai.aliyuncs.com

GeneratePreviewOnly=false で、出力先が VOD の場合に必須

FileName

String

出力ファイル名。{index} プレースホルダーを含める必要があります。

ルール: [your-file-name]__{index}.mp4

例: example_{index}.mp4

GeneratePreviewOnly=false で、出力先が VOD の場合に必須

GeneratePreviewOnly

ブール値

  • GeneratePreviewOnly = true の場合、現在のタスクはプレビュー用のタイムラインのみを生成し、実際にはビデオを合成しないことを示します。出力ビデオアドレスとディメンションを入力する必要はありません。

  • ワンクリックビデオ制作タスクが完了した後、GetBatchMediaPoducingJob を通じてタスク結果をクエリできます。返されるサブタスクリストには、編集プロジェクト ID (projectId) が含まれます。その後、GetEditingProject を呼び出してプレビュータイムラインを取得できます。

false

いいえ、デフォルトは false です

Count

整数

出力ビデオの数。現在、Count=1 をサポートしています。将来的には複数の出力ビデオのサポートが追加される可能性があります。

1

いいえ、デフォルトは 1 です

Width

整数

ビデオの幅 (px)

1080

はい

Height

整数

ビデオの高さ (px)

1920

はい

ビデオ詳細

JSONObject

Crf、Codec などの出力ビデオストリーム関連の構成。

{"Crf": 27}

いいえ

パラメーターの例

{
 	"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 呼び出しの例

前提条件

IMS サーバー SDK をインストール済みであること。詳細については、「準備」をご参照ください。

コード例

コード例を展開して表示

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;

/**
 *  // Maven の依存関係をインポートする必要があります:
 *   <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 {
        // Alibaba Cloud アカウントの AccessKey は、すべての API 操作に対するアクセス権限を持っています。API アクセスや日常の操作には、Resource Access Management (RAM) ユーザーを使用することをお勧めします。
        // この例では、AccessKey ID と AccessKey Secret は環境変数から取得されます。構成方法については、https://www.alibabacloud.com/help/zh/sdk/developer-reference/v2-manage-access-credentials をご参照ください
        com.aliyun.credentials.Client credentialClient = new com.aliyun.credentials.Client();

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

        // AccessKey ID と AccessKey Secret をハードコーディングするには、次の行を使用します。ただし、セキュリティ上の懸念から、AccessKey ID と AccessKey Secret をハードコーディングしないことをお勧めします。
        // config.accessKeyId = <ステップ 2 で作成した AccessKey ID>;
        // config.accessKeySecret = <ステップ 2 で作成した 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].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);

        // ビデオの幅と高さ、縦長のビデオを生成
        //int outputWidth = 1080;
        //int outputHeight = 1920;

        //// ビデオの幅と高さ、横長のビデオを生成
        int outputWidth = 1920;
        int outputHeight = 1080;

        // 出力 OSS アドレス、{index} プレースホルダーを含める必要があります
        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);

        // スポーツハイライトタスクの送信
        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);

        // すべてが完了するまでタスクのステータスをポーリング
        System.out.println("Waiting job finished...");
        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("Produce failed. BatchJobId: " + jobId);
            }

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

API 呼び出しパラメーターの詳細

InputConfig を展開して表示

{
  "Category": "Basketball",
  "InputMedia": "http://[your-bucket].oss-[your-region-id].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"
    }
  ]
}

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

処理ロジック

  • SportsCategory に基づいてスポーツイベントのタイプを決定します: バスケットボール-basketball、卓球-pingpong。

  • 人物 ID パラメーター FaceRegister を使用して、最終的なビデオに表示するアスリートのショットを設定します。

  • スローモーション識別子パラメーター SlowMotionLogoRegister を使用して、最終的なビデオに含めるスローモーションリプレイを設定します。

  • 名前転写パラメーター TransferNameRegister を使用して、スコアボードのチーム名の略称を完全なチーム名に変換します。

リファレンス