All Products
Search
Document Center

Intelligent Media Services:Movie highlights scene

Last Updated:Apr 12, 2025

This document introduces the synthesis parameters, advanced configurations, and SDK call examples for the smart image-text matching - movie highlights scene.

Important
  • Script-based automatic video production and smart image-text matching video production share the same task submission API. For information about how to distinguish between these two methods through parameters, see Parameter difference description

  • Note: In this interface, the region in all media asset OSS URLs must be consistent with the region in the OpenAPI endpoint.

  • Supported regions: China (Shanghai), China (Beijing), China (Hangzhou), China (Shenzhen), US (West), Singapore.

  • In actual use, replace all parameter examples in the document such as [your-bucket], [your-region-id], [your-file-name], [your-file-path], and media asset IDs (for example, "****9d46c8b4548681030f6e****") with your actual values.

Note
  • For better understanding of this document, we recommend that you first learn about the concepts and usage process of [Smart image-text matching video production - Movie highlights scene] through Smart one-click video production operation guide.

  • Smart image-text matching - Movie highlights scene includes two video production modes. This document will explain the following "modes" in detail:

    • Broadcast mode

    • Storyboard script

Usage instructions

Inputconfig parameter description

You can configure InputConfig to specify parameter configurations for basic materials such as video materials, voiceover, background music, and stickers.

Parameter

Type

Description

Example value

Required

Supported modes

MediaArray

List<String>

Smart image-text matching mode. Supports passing a list of media asset IDs or material OSS URLs. The total video duration is limited to a maximum of two hours.

["****b4549d46c88681030f6e****","****549d46c88b4681030f6e****"]

Yes

All

TitleArray

List<String>

Title array, one is randomly selected for each synthesis.

Maximum of 50 titles, each title not exceeding 50 characters.

["Title 1","Title 2"]

No

All

SubHeadingArray

List<SubHeading>

Subtitle settings

[{"Level":1,"TitleArray":["Level 1 subtitle 1","Level 1 subtitle 2"]},{"Level":3,"TitleArray":["Level 3 subtitle"]}]

No

All

SpeechTextArray

List<String>

  • Voiceover script array, one is randomly selected for each synthesis.

  • Maximum of 50 entries, each voiceover script limited to 1000 characters.

  • Supports controlling speech synthesis through SSML markup language

    Important

    Currently only supports <break> <s> <phoneme>

["Voiceover content 1","Voiceover content 2"]

No

  • Broadcast mode

SceneInfo

SceneInfo

Scene information, used for scene-related parameters.

See Parameter example: Broadcast mode, Parameter example: Storyboard script

Yes

  • Broadcast mode

  • Storyboard script

StickerArray

List<Sticker>

Sticker array, one is randomly selected for each synthesis.

Maximum of 50 stickers.

[{"MediaId":"****9d46c8b4548681030f6e****","X":10,"Y":100,"Width":300,"Height":300,"Opacity":0.6}]

No

All

BackgroundMusicArray

List<String>

Background music array, one is randomly selected for each synthesis.

Maximum of 50 entries, supports media asset ID or OSS URL.

["****b4549d46c88681030f6e****","****549d46c88b4681030f6e****"]

No

All

BackgroundImageArray

List<String>

Background image array, one is randomly selected for each synthesis.

Maximum of 50 entries, supports media asset ID or OSS URL.

["****b4549d46c88681030f6e****","****549d46c88b4681030f6e****"]

No

All

Sceneinfo parameter description

Parameter

Type

Description

Required

Supported modes

Scene

String

Matching scene type. For movie highlights scene, pass the static value "MovieHighlights".

Yes

  • Broadcast mode

  • Storyboard script

ShotInfo

ShotInfo

Set storyboard script

Yes

  • Storyboard script

FaceInfo

FaceInfo

Set face information

No

All

ShotInfo parameter description

Note

This parameter is only applicable to storyboard script mode. If you are using broadcast mode, you do not need to set this parameter.

Parameter

Type

Description

Required

ShotScripts

List<ShotScript>

Storyboard script array

Yes

Shotscript parameter description

Note
  • This parameter is only applicable to storyboard script mode. If you are using broadcast mode, you do not need to set this parameter.

  • In movie highlights scene - storyboard script mode, there are two storyboard modes: "Text description mode" and "Manual parsing mode". When setting parameters, you need to choose one of these two modes.

Parameter

Type

Description

Example value

Required

Storyboard mode

ScriptText

String

Script text for a single shot, used to describe the content of the shot.

He has been developing a new magic potion recently.

No

Text description mode

SpeechText

String

  • Voiceover script for a single shot, not exceeding 100 characters.

  • Supports controlling speech synthesis through SSML markup language

    Important

    Currently only supports <break> <s> <phoneme>

The old wizard Danny is tinkering with strange instruments. He has been developing a new magic potion recently.

No

All

Duration

Float

Duration of the shot, only effective when there is no voiceover. If voiceover exists, the shot duration is automatically calculated based on the voiceover duration.

5

No

Descriptions

List<String>

Detailed descriptions for a single shot.

["London streets under thick fog, with flowing traffic and people moving quickly"]

No

Manual parsing mode

Characters

List<String>

Character (face) names in a single shot. Note: Character names must match the ImageInfo.Name in FaceInfo.ImageInfoList.

["Daniel"]

No

Settings

List<String>

Scene descriptions for a single shot, for example:.

["On London streets","Under a street lamp"]

No

Volume

Float

  • Volume of the input video. If volume is set here (Volume), the video volume in the current shot will be aligned with this volume. EditingConfig.MediaConfig.Volume will no longer take effect for this group.

  • Value range: [0, 10.0], supports two decimal places.

0.5

No

All

Faceinfo parameter description

Parameter

Type

Description

Required

ImageInfoList

List<ImageInfo>

Character (face) photo list, with a list length limit of 200.

No

Imageinfo parameter description

Parameter

Type

Description

Example value

Required

Name

String

Character (face) name

Daniel

Yes

ImageURL

String

Character (face) photo storage address, must be a publicly accessible URL link. Please ensure that the face image contains only one individual, and the face should be clearly visible without obvious occlusion or missing parts.

http://[your-cdn-domain]/[your-file-path]/face1.png

Yes, one of the two is required

ImageId

String

Image media asset ID

****9d46c886b45481030f6e****

Parameter example: broadcast mode

{
  "MediaArray": [
    "****9d46c886b45481030f6e****",
    "****c886810b4549d4630f6e****",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test1.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test2.png"
  ],
    "SceneInfo": {
    "Scene": "MovieHighlights", //MovieHighlights movie matching
    "FaceInfo": {
      "ImageInfoList": [
        {
          "Name": "Character A",
          "ImageURL": "https://bkimg.cdn.bcebos.com/pic/3853ad1bdd9f70558718bf38?x-bce-process=image/format,f_auto/watermark,image_d2F0ZXIvYmFpa2UyNzI,g_7,xp_5,yp_5,P_20/resize,m_lfit,limit_1,h_1080"
        },
        {
          "Name": "Character B",
          "ImageURL": "https://bkimg.cdn.bcebos.com/pic/622762d0f703918ffbedc1125b3d269759eec42e?x-bce-process=image/format,f_auto/watermark,image_d2F0ZXIvYmFpa2UyNzI,g_7,xp_5,yp_5,P_20/resize,m_lfit,limit_1,h_1080"
        },
        {
          "Name": "Character C",
          "ImageId": "****b681034549d46c880f6e****"
        }
      ]
    }
  },
  "TitleArray": [
    "Huilongguan Hema Fresh Opening",
    "Hema Fresh Opening"
  ],
  "SubHeadingArray": [
    {
      "Level": 1,
      "TitleArray": ["Subtitle 1", "Subtitle 2"]
    },
    {
      "Level": 3,
      "TitleArray": ["Level 3 subtitle"]
    }
  ],
  "SpeechTextArray": [
    "A new Hema Fresh store has opened in a nearby mall. Today is the first day of opening, so hurry up and join the excitement. This Hema store is not large, but there are many people in the mall. Snacks and beverages are relatively cheap, and people are queuing in long lines. Come and see for yourself!",
    "A new Hema Fresh store has opened in a nearby mall. Today is the first day of opening, so hurry up and join the excitement"
  ],
  "Sticker": {
    "MediaId": "****b681034549d46c880f6e****",
    "X": 10,
    "Y": 100,
    "Width": 300,
    "Height": 300
  },
  "StickerArray": [
    {
      "MediaId": "****9d46c8b4548681030f6e****",
      "X": 10,
      "Y": 100,
      "Width": 300,
      "Height": 300,
      "Opacity": 0.6
    },
    {
      "MediaURL": "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test3.png",
      "X": 10,
      "Y": 100,
      "Width": 300,
      "Height": 300
    }
  ],
  "BackgroundMusicArray": [
    "****b4549d46c88681030f6e****",
    "****549d46c88b4681030f6e****",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test4.mp3"
  ],
  "BackgroundImageArray": [
    "****6c886b4549d481030f6e****",
    "****9d46c8548b4681030f6e****",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test1.png"
  ]
}

Parameter example: Storyboard script

{
  "MediaArray": [
    "****9d46c886b45481030f6e****",
    "****c886810b4549d4630f6e****",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test1.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test2.png"
  ],
   "SceneInfo": {
    "Scene": "MovieHighlights", // MovieHighlights movie matching
    "ShotInfo": {
      "ShotScripts": [
        {
          // For each shot, choose either manual parsing mode or text description mode
          // Text description mode, start
          "ScriptText": "This is the script text for the first scene",
          // Text description mode, end
          "SpeechText": "This is the voiceover script for the first scene"
        },
        {
          // For each shot, choose either manual parsing mode or text description mode
          // Manual parsing mode, start
          "Descriptions": ["Character C enters the room", "Camera slowly pulls back to the view outside the window"],
          "Characters": ["Character C"],
          "Settings": ["Modern office", "Skyscraper"],
          // Manual parsing mode end

          "SpeechText": "This is the voiceover script for the second scene"
        },
        {
          // Text description mode start
          "ScriptText": "This is the script text for the third scene. When there is no voiceover script, the shot supports configuring Duration to control the shot duration.",
          // Text description mode, end

          "Duration": 8.0, // Supported when there is no voiceover script
          "Volume": 1.0 //Set the original sound volume of video material
        }
      ]
    },
    "FaceInfo": {
      "ImageInfoList": [
        {
          "Name": "Character A",
          "ImageURL": "https://bkimg.cdn.bcebos.com/pic/3853ad1bdd9f70558718bf38?x-bce-process=image/format,f_auto/watermark,image_d2F0ZXIvYmFpa2UyNzI,g_7,xp_5,yp_5,P_20/resize,m_lfit,limit_1,h_1080"
        },
        {
          "Name": "Character B",
          "ImageURL": "https://bkimg.cdn.bcebos.com/pic/622762d0f703918ffbedc1125b3d269759eec42e?x-bce-process=image/format,f_auto/watermark,image_d2F0ZXIvYmFpa2UyNzI,g_7,xp_5,yp_5,P_20/resize,m_lfit,limit_1,h_1080"
        },
        {
          "Name": "Character C",
          "ImageId": "****b681034549d46c880f6e****"
        }
      ]
    }
  },
  "TitleArray": [
    "Huilongguan Hema Fresh Opening",
    "Hema Fresh Opening"
  ],
  "StickerArray": [
    {
      "MediaId": "****9d46c8b4548681030f6e****",
      "X": 10,
      "Y": 100,
      "Width": 300,
      "Height": 300
    },
    {
      "MediaURL": "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test3.png",
      "X": 10,
      "Y": 100,
      "Width": 300,
      "Height": 300,
      "Opacity": 0.6
    }
  ],
  "BackgroundMusicArray": [
    "****b4549d46c88681030f6e****",
    "****549d46c88b4681030f6e****",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test4.mp3"
  ],
  "BackgroundImageArray": [
    "****6c886b4549d481030f6e****",
    "****9d46c8548b4681030f6e****",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test1.png"
  ]
}

EditingConfig parameter description

Note
  • You can configure EditingConfig to specify parameters such as volume, position, and other synthesis parameters for the output video materials. If you have no special requirements, we recommend using the default configuration. This field can be left empty.

  • The parameter descriptions for "Broadcast mode" and "Storyboard script" in the movie highlights scene are the same.

Parameter

Type

Description

Example value

Required

MediaConfig

JSON

Input video material related configuration.

See Parameter example

No

TitleConfig

JSON

Title-related configuration. Supports configuring caption parameters. For field details, see: Banner text.

See Parameter example

No

SubHeadingConfig

JSON

Multi-level subtitle related configuration. Supports setting caption parameters.

JSON field description:

See Parameter example

No

SpeechConfig

JSON

Voiceover script related configuration.

See Parameter example

No

BackgroundMusicConfig

JSON

Background music related configuration.

{"Volume":0.2}

No

BackgroundImageConfig

JSON

Background image related configuration.

{"SubType":"Blur","Radius":0.5}

No

ProcessConfig

Mix editing processing configuration.

See Parameter example

No

FECanvas

JSON

Canvas configuration for frontend page preview.

{"Width": 1080,"Height": 1920}

No

ProduceConfig

JSON

Standard editing synthesis configuration. For field details, see: EditingProduceConfig

{"AutoRegisterInputVodMedia":true,"OutputWebmTransparentChannel":true,"CoverConfig":{"StartTime":3.3},"AudioChannelCopy":"left","PipelineId":"***d54a97cff4108b555b01166d4b***","MaxBitrate":5000,"KeepOriginMaxBitrate":false,"KeepOriginVideoMaxFps":false}

No

Processconfig parameter description

Parameter

Type

Description

Example value

Required

AllowVfxEffect

Boolean

Whether to allow adding special effects.

true

No, default is false

VfxEffectProbability

Float

Probability of applying effects to each video clip. Value range: 0.0 - 1.0, supports 2 decimal places.

0.6

No, default is 0.5

AllowTransition

Boolean

Whether to allow adding transition effects.

true

No, default is false

TransitionDuration

Float

Transition duration in seconds. If the transition duration > clip duration - 1, the transition effect on that clip will not take effect.

0.5

No, default is 0.5 seconds

TransitionList

List<String>

Custom transition effect list. When AllowTransition=true, a transition effect is randomly selected from the list for synthesis. For the available range of transition effects, see Transition effect library. If this parameter is null, effects will be randomly selected from the following: "linearblur", "colordistance", "crosshatch", "dreamyzoom", "doomscreentransition_up"

["directional", "linearblur"]

No

UseUniformTransition

Boolean

Whether to use consistent transition effects in a single output video.

true

No, default is true

AllowDuplicateMatch

Boolean

Indicates whether matched clips can be reused.

false

No, default is false

EnableClipDetection:

Boolean

Whether to perform shot detection on materials. Only configurable for movie highlights. Supports automatic shot division and recognition of shot types (opening/ending, advertisements, black screens, etc. will not be included in the output video).

true

No, default is true

EnableTemporalOpt

Boolean

Whether to perform temporal optimization on matching results. Only configurable for movie highlights. When the input shot information or commentary script basically maintains the same order as the source content, it is recommended to set this to true.

false

No, default is false

EditingConfig parameter example

All parameters in EditingConfig are optional. The following is the default configuration.

{
  "MediaConfig": {
    "Volume": 0 // Default video material is muted
  },
  "TitleConfig": {
    "Alignment": "TopCenter",
    "AdaptMode": "AutoWrap",
    "Font": "Alibaba PuHuiTi 2.0 95 ExtraBold",
    "SizeRequestType": "Nominal",
    "Y": 0.1, // Y-coordinate value of the title when the output is in portrait mode
    "Y": 0.05, // Y-coordinate value of the title when the output is in landscape mode
    "Y": 0.08 // Y-coordinate value of the title when the output is in square mode
  },
  "SpeechConfig": {
    "Volume": 1,  // Default voiceover audio uses original volume
    "SpeechRate": 0,
    "Voice": null,
    "Style": null,
    "CustomizedVoice": null, // Voice clone voiceId. If this field is filled, Voice and Style will be ineffective.
    "AsrConfig": {
      "Alignment": "TopCenter",
      "AdaptMode": "AutoWrap",
      "Font": "Alibaba PuHuiTi 2.0 65 Medium",
      "SizeRequestType": "Nominal",
      "Spacing": -1,
      "Y": 0.8, // Y-coordinate value of the caption when the output is in portrait mode
      "Y": 0.9, // Y-coordinate value of the caption when the output is in landscape mode
      "Y": 0.85 // Y-coordinate value of the caption when the output is in square mode
    }
  },
  "SubHeadingConfig": {
    "1": {
      "Y": 0.3,
      "FontSize": 40
    },
    "3": {
      "Y": 0.5,
      "FontSize": 30
    }
  },
  "BackgroundMusicConfig": {
    "Volume": 0.2,   // Background music defaults to 20% volume,
    "Style": null
  },
  "ProcessConfig": {
    "AllowVfxEffect": false,	  // Whether to add special effects
    "AllowTransition": false,	  // Whether to add transition effects
    "AllowDuplicateMatch": false, // In image-text matching mode, whether matched clips can be reused
    "EnableClipDetection": true, // Whether to perform shot detection
    "EnableTemporalOpt": true // Whether to perform temporal optimization
  }
}

TemplateConfig parameter description

TemplateConfig is a common parameter for one-click video production, used to set one-click video production templates. For detailed parameter descriptions and usage examples, see TemplateConfig parameter description

OutputConfig parameter description

Note

You can configure OutputConfig to specify parameters such as output address, naming rules, output width and height, number of output videos, and other synthesis parameters.

Parameter

Type

Description

Example value

Required

MediaURL

String

Output video address, must contain the placeholder {index}.

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

Example: http://example.oss-[your-region-id].aliyuncs.com/example/example_{index}.mp4

Required when GeneratePreviewOnly=true and the output video is to OSS

StorageLocation

String

Specifies the storage location of media files output to VOD.

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

Example: outin-****6c886b4549d481030f6e****.oss-[your-region-id].aliyuncs.com

Required when GeneratePreviewOnly=true and the output video is to VOD

FileName

String

Output file name, must contain the placeholder {index}.

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

Example: example_{index}.mp4

Required when GeneratePreviewOnly=true and the output video is to VOD

GeneratePreviewOnly

Boolean

  • When GeneratePreviewOnly = true, it indicates that the current task only generates a timeline for preview and does not actually synthesize the video. The output video address can be omitted.

  • After the one-click video production task is completed, you can query the task result through GetBatchMediaPoducingJob. The returned subtask list will include the editing project ID (projectId). You can then call GetEditingProject to get the preview timeline.

false

No, default is false

Count

Integer

Number of output videos

  • Movie highlights scene - Broadcast mode: The quantity limit does not exceed the length of InputConfig.SpeechTextArray.

  • Movie highlights scene - Storyboard script: Currently supports Count=1, may support outputting multiple videos in the future.

1

No, default is 1

Width

Integer

Output width, in px

1080

Yes

Height

Integer

Output height, in px

1920

Yes

Video

JSONObject

Output video stream related configuration, such as Crf, Codec, etc.

{"Crf": 27}

No

Parameter example

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

Sdk call examples

Prerequisites

You have installed the IMS server SDK. For more information, see Preparations.

Code example

Using broadcast mode as an example

Expand to view code example

package com.example;

import com.alibaba.fastjson.JSONObject;
import com.aliyun.ice20201109.Client;
import com.aliyun.ice20201109.models.*;
import com.aliyun.teaopenapi.models.Config;

import java.util.*;

/**
 *  Need to include Maven dependencies:
 *   
 *      com.aliyun
 *      ice20201109
 *      2.3.0
 *  
 *  
 *      com.alibaba
 *      fastjson
 *      1.2.9
 *  
 */

public class SmartMixBatchEditingService {

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

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

    public void initClient() throws Exception {
        // The AccessKey pair of an Alibaba Cloud account has permissions to call all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M.
        // In this example, the AccessKey ID and the AccessKey secret are obtained from the environment variables. For configuration method, see: 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);

        // To hard-code your AccessKey ID and AccessKey secret, use the following lines. However, we recommend that you do not hard-code your AccessKey ID and AccessKey secret for security concerns.
        // config.accessKeyId = ;
        // config.accessKeySecret = ;
        config.endpoint = "ice." + regionId + ".aliyuncs.com";
        config.regionId = regionId;
        iceClient = new Client(config);
    }

    public void runExample() throws Exception {

        // Video materials
        List mediaArray = Arrays.asList(
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-1.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-2.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-3.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-4.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-5.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-6.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-7.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-8.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-9.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-10.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-11.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-12.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-13.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-14.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-15.mp4",
            "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-16.mp4"
        );

        // Voiceover script
        String speechText = "In the vast expanse of the deep blue, a vibrant canvas is slowly unfolding. In the crystal clear blue waters, coral reefs are like underwater forests, colorful and diverse. They are important cornerstones of marine biodiversity, providing shelter for countless small fish, shellfish, and seaweed. Lazy and adorable sea lions enjoy the warm sunshine on the rocks, basking comfortably, living in harmony with nature. Dolphins swim together in the azure waters, chasing and playing with each other, demonstrating the agility and wisdom bestowed by nature. However, the beautiful marine environment is facing unprecedented challenges. Various garbage pollution is like scars imprinted on the skin of the ocean, ruthlessly eroding the originally pure ecological environment. Many species face crises of food shortages, increased diseases, and even population decline. We must take action to protect this beautiful but fragile blue home, allowing the future ocean to regain its purity and vitality.";

        // Video title
        String title = "Protect Our Blue Home";
        // Scene information
        JSONObject sceneInfo = new JSONObject();
        sceneInfo.put("Scene","MovieHighlights");
        // Face information
        JSONObject faceInfo = new JSONObject();
        sceneInfo.put("FaceInfo",faceInfo);
        JSONArray imageInfoList =new JSONArray();
        JSONObject imageInfo1=new JSONObject();
        imageInfo1.put("Name","Character A");
        imageInfo1.put("ImageURL", "https://bkimg.cdn.bcebos.com/pic/3853ad1bdd9f70558718bf38?x-bce-process=image/format,f_auto/watermark,image_d2F0ZXIvYmFpa2UyNzI,g_7,xp_5,yp_5,P_20/resize,m_lfit,limit_1,h_1080");
        imageInfoList.add(imageInfo1);
        faceInfo.put("ImageInfoList",imageInfoList);

        JSONObject inputConfig = new JSONObject();
        inputConfig.put("MediaArray", mediaArray);
        inputConfig.put("SpeechText", speechText);
        inputConfig.put("Title", title);
        inputConfig.put("SceneInfo", sceneInfo);

        // Number of videos to produce
        int produceCount = 4;

        // Output width and height, generate portrait video
        int outputWidth = 1080;
        int outputHeight = 1920;

        //// Output width and height, generate landscape video
        //int outputWidth = 1920;
        //int outputHeight = 1080;

        // Output OSS address, must include {index} placeholder
        String mediaUrl = "http://" + bucket + ".oss-" + regionId + ".aliyuncs.com/smart_mix/output_{index}.mp4";

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

        // Submit one-click video production task
        SubmitBatchMediaProducingJobRequest request = new SubmitBatchMediaProducingJobRequest();
        request.setInputConfig(inputConfig.toJSONString());
        request.setOutputConfig(outputConfig.toJSONString());

        SubmitBatchMediaProducingJobResponse response = iceClient.submitBatchMediaProducingJob(request);
        String jobId = response.getBody().getJobId();
        System.out.println("Start smart mix batch job, batchJobId: " + jobId);

        // Poll task status until all are finished
        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("BatchJobId: " + jobId + ", status:" + status);

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

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

API call parameter details

Expand to view InputConfig

{
  "MediaArray": [
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-1.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-2.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-3.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-4.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-5.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-6.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-7.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-8.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-9.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-10.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-11.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-12.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-13.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-14.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-15.mp4",
    "http://[your-bucket].oss-[your-region-id].aliyuncs.com/test_media/sea/sea-16.mp4"
  ],
  "SpeechText": "In the vast expanse of the deep blue, a vibrant canvas is slowly unfolding. In the crystal clear blue waters, coral reefs are like underwater forests, colorful and diverse. They are important cornerstones of marine biodiversity, providing shelter for countless small fish, shellfish, and seaweed. Lazy and adorable sea lions enjoy the warm sunshine on the rocks, basking comfortably, living in harmony with nature. Dolphins swim together in the azure waters, chasing and playing with each other, demonstrating the agility and wisdom bestowed by nature. However, the beautiful marine environment is facing unprecedented challenges. Various garbage pollution is like scars imprinted on the skin of the ocean, ruthlessly eroding the originally pure ecological environment. Many species face crises of food shortages, increased diseases, and even population decline. We must take action to protect this beautiful but fragile blue home, allowing the future ocean to regain its purity and vitality.",
  "Title":"Protect Our Blue Home",
  "SceneInfo": {
    "Scene": "MovieHighlights", //MovieHighlights movie matching
    "FaceInfo": {
      "ImageInfoList": [
        {
          "Name": "Character A",
          "ImageURL": "https://****.cdn.bcebos.com/pic/3853ad1bdd9f70558718bf38?x-bce-process=image/format,f_auto/watermark,image_d2F0ZXIvYmFpa2UyNzI,g_7,xp_5,yp_5,P_20/resize,m_lfit,limit_1,h_1080"
        }
      ]
    }
  }
}

Expand to view OutputConfig

{
  "Count": 1,
  "Height": 1080,
  "Width": 1920,
  "MediaURL": "http://[your-bucket].oss-[your-region-id].aliyuncs.com/script/output_{index}_w.mp4"
}

Advanced configuration

For advanced configuration details, see Batch one-click video production mixing logic and advanced configuration

FAQ

For common questions about script-based automatic video production, see Movie highlights FAQ:

  • What is the difference between [Broadcast mode] and [Storyboard script]?

  • How to correctly set face information?

References