Tous les produits
Search
Centre de documentation

Intelligent Media Services:Scénario de temps forts de film

Dernière mise à jour :Aug 11, 2026

Paramètres de composition, configurations avancées et exemples d'appels SDK pour le scénario de temps forts de film.

Important
  • La génération vidéo par script automatisé et la correspondance intelligente de contenu partagent la même API de soumission de tâche. Pour les distinguer selon leurs paramètres, consultez Différences de paramètres.

  • La région spécifiée dans l'URL OSS de tous les ressources multimédias doit correspondre à la région de l'endpoint OpenAPI.

  • Régions prises en charge : Chine (Shanghai), Chine (Pékin), Chine (Hangzhou), Chine (Shenzhen), États-Unis (Ouest) et Singapour.

  • Dans les exemples, remplacez les espaces réservés tels que [your-bucket], [your-region-id], [your-file-name], [your-file-path] ainsi que les ID de ressources multimédias (par exemple, "****9d46c8b4548681030f6e****") par vos propres valeurs.

Remarque

Remarques sur l'utilisation

Paramètres InputConfig

InputConfig définit les paramètres de base des ressources : clips vidéo, narration, musique de fond et stickers.

Paramètre

Type

Description

Exemple

Obligatoire

Modes pris en charge

MediaArray

List<String>

  • Liste d'ID de ressources multimédias ou d'URL OSS. La durée totale des vidéos ne doit pas dépasser deux heures.

  • Formats pris en charge : Formats vidéo.

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

Oui

Entièrement pris en charge

TitleArray

List<String>

Tableau de titres. Un titre est sélectionné aléatoirement pour chaque vidéo.

Maximum : 50 titres, 50 caractères chacun.

["Titre 1","Titre 2"]

Non

Entièrement pris en charge

SubHeadingArray

List<SubHeading>

Paramètres des sous-titres.

[{"Level":1,"TitleArray":["Sous-titre niveau 1-1","Sous-titre niveau 1-2"]},{"Level":3,"TitleArray":["Sous-titre niveau 3"]}]

Non

Tous les modes

SpeechTextArray

List<String>

  • Tableau de scripts de narration. Un script est sélectionné aléatoirement pour chaque vidéo.

  • Maximum : 50 scripts, 1 000 caractères chacun.

  • Contrôlez la synthèse vocale avec SSML.

    Important

    Actuellement, seuls <break>, <s> et <phoneme> sont pris en charge. Pour les timbres CosyVoice, seuls <break>, <s> et <sub> sont pris en charge.

["Contenu de narration 1","Contenu de narration 2"]

Non

  • Mode narration globale

SceneInfo

SceneInfo

Paramètres liés au scénario.

Exemple de paramètre : Mode narration globale et Exemple de paramètre : Mode storyboard.

Oui

  • Mode narration globale

  • Mode storyboard

StickerArray

List<Sticker>

  • Tableau de stickers. Un sticker est sélectionné aléatoirement pour chaque vidéo. Maximum : 50. Utilisez des ID de ressources multimédias ou des URL OSS.

  • Règle de randomisation : supposons que vous fournissiez 10 stickers et que le nombre de vidéos à produire soit fixé à 20. Un nombre aléatoire entre 1 et 10 est d'abord généré, par exemple 3. Ensuite, les stickers sont sélectionnés dans l'ordre suivant : 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, etc.

  • Formats pris en charge : Formats d'image.

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

Non

Tous les modes

BackgroundMusicArray

List<String>

  • Tableau de pistes musicales de fond. Une piste est sélectionnée aléatoirement pour chaque vidéo. Maximum : 50. Utilisez des ID de ressources multimédias ou des URL OSS.

  • Règle de randomisation : supposons que vous fournissiez 10 pistes musicales et que le nombre de vidéos à produire soit fixé à 20. Un nombre aléatoire entre 1 et 10 est d'abord généré, par exemple 3. Ensuite, les pistes sont sélectionnées dans l'ordre suivant : 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, etc.

  • Formats pris en charge : Formats audio.

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

Non

Entièrement pris en charge

BackgroundImageArray

List<String>

  • Tableau d'images de fond. Une image est sélectionnée aléatoirement pour chaque vidéo. Maximum : 50. Utilisez des ID de ressources multimédias ou des URL OSS.

  • Règle de randomisation : supposons que vous fournissiez 10 images de fond et que le nombre de vidéos à produire soit fixé à 20. Un nombre aléatoire entre 1 et 10 est d'abord généré, par exemple 3. Ensuite, les images sont sélectionnées dans l'ordre suivant : 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, etc.

  • Formats pris en charge : Formats d'image.

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

Non

Tous les modes

Paramètres SceneInfo

Paramètre

Type

Description

Obligatoire

Modes pris en charge

Scene

String

Type de scénario correspondant. Définissez ce champ statique sur « MovieHighlights » pour ce scénario.

Oui

  • Mode narration globale

  • Mode storyboard

ShotInfo

ShotInfo

Configurez le storyboard.

Oui

  • Mode storyboard

FaceInfo

FaceInfo

Configurez les informations faciales.

Non

Entièrement pris en charge

Paramètres ShotInfo

Remarque

S'applique uniquement au mode storyboard.

Paramètre

Type

Description

Obligatoire

ShotScripts

List<ShotScript>

Tableau de scripts de plan.

Oui

Paramètres ShotScript

Remarque
  • S'applique uniquement au mode storyboard.

  • Deux modes de plan sont disponibles : le mode description textuelle et le mode analyse manuelle. Sélectionnez-en un lors du réglage des paramètres.

Paramètre

Type

Description

Exemple

Obligatoire

Mode de plan

ScriptText

String

Texte du script décrivant le contenu du plan. Résumez en une ou deux phrases.

Dans le wagon de métro, Lin Xia est assise dans un coin et enregistre discrètement avec son téléphone. Une vieille femme tient la main de son petit-fils en fredonnant doucement une chanson.

Non

Mode description textuelle

SpeechText

String

  • Script de narration pour un seul plan. Maximum : 100 caractères.

  • Contrôlez la synthèse vocale avec SSML.

    Important

    Actuellement, seuls <break>, <s> et <phoneme> sont pris en charge.

Le wagon de nuit est calme, mais certains voyageurs illuminent tout l'espace avec leurs chants.

Non

Tous les modes

Duration

Float

  • Durée du plan en secondes. La valeur doit être supérieure ou égale à 1.

  • Ne s'applique qu'en l'absence de narration. En présence de narration, la durée est calculée d'après la longueur de celle-ci.

5

Non

Descriptions

List<String>

Descriptions du plan. Résumez en une ou deux phrases.

["Lin Xia est assise dans un coin du wagon de métro et enregistre discrètement avec son téléphone", "Une vieille femme tient la main de son petit-fils en fredonnant doucement une chanson"]

Non

Mode analyse manuelle

Characters

List<String>

Noms des personnages (visages) pour un seul plan. Doivent correspondre à ImageInfo.Name dans FaceInfo.ImageInfoList.

["Lin Xia", "Vieille femme", "Petit-fils"]

Non

Settings

List<String>

Description de la scène pour un seul plan.

["Wagon de métro nocturne"]

Non

Volume

Float

0,5

Non

Entièrement pris en charge

Paramètres FaceInfo

Paramètre

Type

Description

Obligatoire

ImageInfoList

List<ImageInfo>

Liste de photos de personnages (visages). Maximum : 200.

Non

Paramètres ImageInfo

Paramètre

Type

Description

Exemple

Obligatoire

Name

String

Nom du personnage (visage).

Daniel

Oui

ImageURL

String

URL de la photo du personnage (visage). Elle doit être accessible publiquement. L'image ne doit contenir qu'un seul visage, clairement visible sans obstruction ni partie manquante.

http://[votre-domaine-cdn]/[chemin-de-votre-fichier]/face1.png

Oui. Vous devez spécifier l'un des deux paramètres.

ImageId

String

ID de ressource multimédia de l'image.

****9d46c886b45481030f6e****

Exemple de paramètre : Mode narration globale

{
  "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 for movie highlights 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": [
    "Hema Fresh in Huilongguan is now open!",
    "Hema Fresh is now open!"
  ],
  "SubHeadingArray": [
    {
      "Level": 1,
      "TitleArray": ["Subtitle 1", "Subtitle 2"]
    },
    {
      "Level": 3,
      "TitleArray": ["Level-3 Subtitle"]
    }
  ],
  "SpeechTextArray": [
    "A new Hema Fresh just opened in the nearby mall. It's the grand opening today, so I rushed over to join the fun. This Hema isn't very big, but the mall is packed. Snacks and drinks are quite cheap, and the lines are incredibly long. Come and check it out!",
    "A new Hema Fresh just opened in the nearby mall. It's the grand opening today, so I rushed over to join the fun."
  ],
  "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"
  ]
}

Exemple de paramètre : Mode Storyboard

{
  "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 for movie highlights matching
    "ShotInfo": {
      "ShotScripts": [
        // Start of text description mode example. For each shot, choose either manual parsing mode or text description mode.
        {
          "ScriptText": "In the subway car, Lin Xia sits in a corner, quietly recording with her phone. An old woman is holding her grandson's hand, humming a song softly.",
          "SpeechText": "The late-night car is quiet, but some people light up the whole car with their songs."
        },
        {
           "ScriptText": "The old woman's white hair glows under the car lights. She strokes her grandson's head and whispers, 'Do you remember this song?'",
           "SpeechText": "Her world may be blurry, but in front of him, she is still the most gentle mother."
        },
        {
           "ScriptText": "Lin Xia stops filming and looks at the billboards flashing by outside the window, her expression softening.",
           "SpeechText": "I thought I was recording someone else's story, but I was quietly healed."
        },
        {
           "ScriptText": "At home, Lin Xia takes out her camera and writes her first diary entry: 'Today, I saw what happiness looks like.'",
           "SpeechText": "Sometimes, happiness isn't about big things, but the small moments we overlook."
        },
        {
           "ScriptText": "A few days later, a series of heartwarming photos on Lin Xia's social media resonates with netizens.",
           "SpeechText": "She starts telling stories with her lens, and every story holds a piece of love."
        },
        {
           "ScriptText": "At night, Lin Xia enters the subway station again, this time with a smile and a new goal.",
           "SpeechText": "This city is big, but there's always someone waiting for you, and someone worth discovering."
        }
        // End of text description mode example
        
        // Start of manual parsing mode example. For each shot, choose either manual parsing mode or text description mode.
        {
            "Descriptions": ["Lin Xia sits in a corner of the subway car, quietly recording with her phone", "An old woman holds her grandson's hand, humming a song softly"],
            "Characters": ["Lin Xia", "Old woman", "Grandson"],
            "Settings": ["Late-night subway car"],
            "SpeechText": "The late-night car is quiet, but some people light up the whole car with their songs."
        },
        {
            "Descriptions": ["The old woman's white hair glows under the car lights", "She strokes her grandson's head and speaks softly"],
            "Characters": ["Old woman", "Grandson"],
            "Settings": ["Subway car"],
            "SpeechText": "Her world may be blurry, but in front of him, she is still the most gentle mother."
        },
        {
            "Descriptions": ["Lin Xia stops filming", "Looks at the billboards flashing by outside the window, her expression softening"],
            "Characters": ["Lin Xia"],
            "Settings": ["Moving subway car"],
            "SpeechText": "I thought I was recording someone else's story, but I was quietly healed."
        },
        {
            "Descriptions": ["Lin Xia takes out her camera at home", "Writes her first diary entry: 'Today, I saw what happiness looks like'"],
            "Characters": ["Lin Xia"],
            "Settings": ["Modern apartment / Room"],
            "SpeechText": "Sometimes, happiness isn't about big things, but the small moments we overlook."
        },
        {
            "Descriptions": ["Heartwarming photos are posted on Lin Xia's social media page", "Netizens like and comment one after another"],
            "Characters": ["Lin Xia"],
            "Settings": ["Phone screen / Social media interface"],
            "SpeechText": "She starts telling stories with her lens, and every story holds a piece of love."
        },
        {
            "Descriptions": ["At night, Lin Xia enters the subway station", "She has a smile and a new goal"],
            "Characters": ["Lin Xia"],
            "Settings": ["City subway station"],
            "SpeechText": "This city is big, but there's always someone waiting for you, and someone worth discovering."
        }
        // End of manual parsing mode example

        // You can choose not to configure narration. Configure only the shot script and duration to play the original video sound.
       {
            "ScripText": "In the subway car, Lin Xia sits in a corner, quietly recording with her phone. An old woman is holding her grandson's hand, humming a song softly.",
            "Duration": 8.0, // Can be set when there is no narration script 
            "Volume": 1.0 // Set the volume of the original video asset
       }
      ]
    },
    "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": [
    "Hema Fresh in Huilongguan is now open!",
    "Hema Fresh is now open!"
  ],
  "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"
  ]
}

Paramètres EditingConfig

Remarque
  • EditingConfig définit le volume, la position et d'autres paramètres de composition pour les ressources vidéo en sortie. Laissez ce champ vide pour utiliser les valeurs par défaut.

  • Ces paramètres s'appliquent à la fois au mode narration globale et au mode storyboard.

Paramètre

Type

Description

Exemple

Obligatoire

MediaConfig

JSON

Configurations des ressources vidéo en entrée.

Exemple de paramètre.

Non

TitleConfig

JSON

Configurations du titre. Les paramètres de sous-titrage sont décrits dans Texte de bannière.

Exemple de paramètre.

Non

SubHeadingConfig

JSON

Configurations des sous-titres multiniveaux. Vous pouvez définir des paramètres de sous-titrage.

Description des champs JSON :

Exemple de paramètre.

Non

SpeechConfig

JSON

Configurations du script de narration.

Exemple de paramètre.

Non

BackgroundMusicConfig

JSON

Configurations de la musique de fond.

{"Volume":0.2}

Non

BackgroundImageConfig

JSON

Configurations de l'image d'arrière-plan.

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

Non

ProcessConfig

Configurations de traitement Remix.

Exemple de paramètre.

Non

FECanvas

JSON

Configurations du canevas pour les aperçus de page frontend.

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

Non

ProduceConfig

JSON

Configurations standard de montage et de composition vidéo. Détails des champs : EditingProduceConfig.

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

Non

Paramètres ProcessConfig

Paramètre

Type

Description

Exemple

Obligatoire

AllowVfxEffect

Boolean

Indique s'il faut ajouter des effets spéciaux.

true

Non. Valeur par défaut : false.

VfxEffectProbability

Float

Probabilité d'appliquer des effets spéciaux par clip. Plage : de 0,0 à 1,0. Jusqu'à deux décimales.

0,6

Non. Valeur par défaut : 0,5.

VfxFirstClipEffectList

List<String>

  • Si VfxFirstClipEffectList n'est pas vide, l'effet du premier clip vidéo est sélectionné dans cette liste.

  • Si VfxFirstClipEffectList est vide, l'effet du premier clip est choisi aléatoirement parmi les suivants : « slightshow », « starfieldshinee », « starfieldshinee2 », « starsparkle », « colorfulripples » et « starfield ».

  • Pour des exemples d'effets, consultez Exemples d'effets spéciaux.

["slightshow","starfieldshinee"]

Non

VfxNotFirstClipEffectList

List<String>

  • Si VfxNotFirstClipEffectList n'est pas vide, les effets des clips autres que le premier sont sélectionnés dans cette liste.

  • Si VfxNotFirstClipEffectList est vide, les effets des clips autres que le premier sont choisis parmi les suivants : « zoomslight », « zoom », « zoominout » et « slightshake ».

  • Pour des exemples d'effets, consultez Exemples d'effets spéciaux.

["zoomslight","zoom"]

Non

AllowTransition

Boolean

Indique s'il faut ajouter des transitions.

true

Non. Valeur par défaut : false.

TransitionDuration

Float

Durée de la transition en secondes. Si elle dépasse la durée du clip moins 1, la transition est ignorée pour ce clip.

0,5

Non. Valeur par défaut : 0,5 s.

TransitionList

List<String>

Liste de transitions personnalisées. Lorsque AllowTransition est true, une transition aléatoire de cette liste est utilisée. Transitions disponibles : Bibliothèque de transitions. Si la liste est vide, les valeurs par défaut sont : « linearblur », « colordistance », « crosshatch », « dreamyzoom » et « doomscreentransition_up ».

["directional", "linearblur"]

Non

UseUniformTransition

Boolean

Indique s'il faut utiliser la même transition pour l'ensemble d'une vidéo.

true

Non. Valeur par défaut : true.

AllowFilter

Boolean

Indique s'il faut ajouter des filtres personnalisés.

false

Non. Valeur par défaut : false.

FilterList

List<String>

Liste de filtres personnalisés. Lorsque AllowFilter est true, un filtre aléatoire de cette liste est utilisé. Filtres disponibles : Exemples d'effets de filtre. Si la liste est vide, aucun filtre n'est ajouté.

["m1", "m2"]

Non

AllowDuplicateMatch

Boolean

Indique si les clips correspondants peuvent être réutilisés.

false

Non. Valeur par défaut : false.

EnableClipDetection:

Boolean

Active la détection de plans sur le matériau source. Ce paramètre est configurable uniquement pour le scénario de temps forts de film. Il permet la division automatique des plans et identifie leurs types. Les génériques de début et de fin, les publicités et les écrans noirs sont exclus de la vidéo finale.

true

Non. Valeur par défaut : true.

EnableTemporalOpt

Boolean

Active l'optimisation temporelle des résultats de correspondance. Ce paramètre est configurable uniquement pour le scénario de temps forts de film. Nous recommandons de le définir sur true lorsque les informations de plan en entrée ou le script de narration correspondent globalement à l'ordre du contenu de la vidéo source.

true

Non. Valeur par défaut : false.

EnableSubtitleMatch

Boolean

Optimise la correspondance entre le script de narration et les images vidéo en s'appuyant sur les résultats de la reconnaissance optique de caractères (OCR) et de la reconnaissance automatique de la parole (ASR).

  • Ce paramètre est actuellement pris en charge uniquement en mode narration globale. Nous recommandons de l'activer lorsque le script ressemble aux sous-titres d'origine.

  • Ce paramètre prend effet uniquement lorsque EnableTemporalOpt est défini sur true.

true

Non. Valeur par défaut : false.

Exemple de paramètre EditingConfig

Tous les paramètres d'EditingConfig sont facultatifs. Le code suivant présente les configurations par défaut.

{
  "MediaConfig": {
    "Volume": 0 // Mute the source video by default
  },
  "TitleConfig": {
    "Alignment": "TopCenter",
    "AdaptMode": "AutoWrap",
    "Font": "Alibaba PuHuiTi 2.0 95 ExtraBold",
    "SizeRequestType": "Nominal",
    "Y": 0.1, // Y-coordinate of the title for a vertical video
    "Y": 0.05, // Y-coordinate of the title for a horizontal video
    "Y": 0.08 // Y-coordinate of the title for a square video
  },
  "SpeechConfig": {
    "Volume": 1,  // Use the original volume for the narration audio by default
    "SpeechRate": 0,
    "Voice": null,
    "Style": null,
    "CustomizedVoice": null, // Voice clone voiceId. If this field is specified, Voice and Style become invalid.
    "AsrConfig": {
      "Alignment": "TopCenter",
      "AdaptMode": "AutoWrap",
      "Font": "Alibaba PuHuiTi 2.0 65 Medium",
      "SizeRequestType": "Nominal",
      "Spacing": -1,
      "Y": 0.8, // Y-coordinate of the captions for a vertical video
      "Y": 0.9, // Y-coordinate of the captions for a horizontal video
      "Y": 0.85 // Y-coordinate of the captions for a square video
    }
  },
  "SubHeadingConfig": {
    "1": {
      "Y": 0.3,
      "FontSize": 40
    },
    "3": {
      "Y": 0.5,
      "FontSize": 30
    }
  },
  "BackgroundMusicConfig": {
    "Volume": 0.2,   // Use 20% volume for the background music by default
    "Style": null
  },
  "ProcessConfig": {
    "AllowVfxEffect": false,	  // Whether to add special effects
    "AllowTransition": false,	  // Whether to add transitions
    "AllowDuplicateMatch": false, // In smart content matching mode, specifies whether matched clips can be reused
    "EnableClipDetection": true, // Whether to perform shot detection
    "EnableTemporalOpt": true // Whether to perform temporal optimization
  }
}

Paramètres TemplateConfig

TemplateConfig définit un modèle pour la génération de vidéo en un clic. Paramètres et exemples : Paramètres TemplateConfig.

Paramètres OutputConfig

Remarque

OutputConfig définit l'adresse de sortie, les règles de nommage, les dimensions ainsi que le nombre de vidéos à produire.

Paramètre

Type

Description

Exemple

Obligatoire

MediaURL

String

Adresse de la vidéo de sortie. Elle doit contenir l'espace réservé {index}.

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

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

Obligatoire si GeneratePreviewOnly est défini sur false et que la vidéo de sortie est envoyée vers OSS.

StorageLocation

String

Emplacement de stockage du fichier média destiné à VOD.

Règle : [your-vod-bucket].oss-[your-region-id].aliyuncs.com

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

Obligatoire si GeneratePreviewOnly est défini sur false et que la vidéo de sortie est envoyée vers VOD.

FileName

String

Nom du fichier de sortie. Il doit inclure l'espace réservé {index}.

Règle : [your-file-name]__{index}.mp4

Exemple : example_{index}.mp4

Obligatoire si GeneratePreviewOnly est défini sur false et que la vidéo de sortie est envoyée vers VOD.

GeneratePreviewOnly

Boolean

  • Si GeneratePreviewOnly est défini sur true, la tâche en cours génère uniquement une timeline de prévisualisation sans effectuer de composition réelle. Dans ce cas, il n'est pas nécessaire de spécifier l'adresse de la vidéo de sortie.

  • Une fois la tâche de génération vidéo en un clic terminée, appelez GetBatchMediaProducingJob pour interroger le résultat. La liste des sous-tâches retournée contiendra l'ID du projet de montage. Appelez ensuite GetEditingProject pour obtenir la timeline de prévisualisation.

false

Non. Valeur par défaut : false.

Count

Integer

Nombre de vidéos de sortie.

  • Mode narration globale : la valeur maximale ne peut pas dépasser la longueur de InputConfig.SpeechTextArray.

  • Mode storyboard : seule la valeur Count=1 est prise en charge actuellement. La prise en charge de plusieurs vidéos de sortie pourrait être ajoutée ultérieurement.

1

Non. Valeur par défaut : 1.

Width

Integer

Largeur de la vidéo de sortie, exprimée en pixels.

1080

Oui

Height

Integer

Hauteur de la vidéo de sortie, exprimée en pixels.

1920

Oui

Video

JSONObject

Configuration du flux vidéo de sortie, telle que Crf et Codec.

{"Crf": 27}

Non

Exemple de paramètre

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

Exemple d'appel SDK

Prérequis

SDK côté serveur IMS installé. Préparatifs.

Exemple de code

L'exemple suivant illustre l'utilisation du mode narration globale.

Développer pour voir l'exemple de code

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.*;

/**
 *  You need to add the following Maven dependencies:
 *   <dependency>
 *      <groupId>com.aliyun</groupId>
 *      <artifactId>ice20201109</artifactId>
 *      <version>2.3.0</version>
 *  </dependency>
 *  <dependency>
 *      <groupId>com.alibaba</groupId>
 *      <artifactId>fastjson</artifactId>
 *      <version>1.2.9</version>
 *  </dependency>
 */

public class SmartMixBatchEditingService {

    static final String regionId = "[your-region-id]"; // Smart content matching is supported in cn-shanghai, cn-beijing, and cn-hangzhou.
    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 {
        // An Alibaba Cloud account AccessKey has full access to all APIs. We recommend that you use a RAM user for API calls and routine O&M.
        // This example shows how to store the AccessKey ID and AccessKey secret in environment variables. For configuration methods, 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);

        // To hard-code the AccessKey ID and AccessKey secret, use the following code. However, we strongly recommend that you do not store your AccessKey ID and AccessKey secret in your project code. This can lead to an AccessKey leak and compromise the security of all resources in your account.
        // config.accessKeyId = <The AccessKey ID you created in Step 2>;
        // config.accessKeySecret = <The AccessKey secret you created in Step 2>;
        config.endpoint = "ice." + regionId + ".aliyuncs.com";
        config.regionId = regionId;
        iceClient = new Client(config);
    }

    public void runExample() throws Exception {

        // Video assets
        List<String> mediaArray = Arrays.asList(
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-1.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-2.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-3.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-4.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-5.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-6.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-7.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-8.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-9.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-10.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-11.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-12.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-13.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-14.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-15.mp4",
            "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-16.mp4"
        );

        // Narration script
        String speechText = "In the vast, boundless blue depths, a vibrant picture is slowly unfolding. In the clear, azure water, coral reefs are like an underwater forest, colorful and magnificent. They are an important cornerstone of marine biodiversity, providing shelter for countless small fish, shellfish, and algae. Lazy and adorable sea lions bask in the warm sunlight on the rocks, enjoying the sun in harmony with nature. Dolphins swim together in the blue water, chasing and playing with each other, showing the agility and wisdom endowed by nature. However, the beautiful marine environment is facing unprecedented challenges. Various types of garbage pollution are like scars on the ocean's skin, ruthlessly eroding the once pristine ecosystem. Many species face food shortages, increased diseases, and even population decline. We must act to protect this beautiful and fragile blue home, so that the future ocean can once again restore its purity and vitality.";

        // Video title
        String title = "Protecting Our Blue Home";
        // Scenario 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;

        // Width and height of the output video. A vertical video is generated.
        int outputWidth = 1080;
        int outputHeight = 1920;

        //// Width and height of the output video. A horizontal video is generated.
        //int outputWidth = 1920;
        //int outputHeight = 1080;

        // OSS address of the output video. It must contain the {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 the one-click video generation 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 the task status until it is complete
        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("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;
            }
        }
    }
}

Détails des paramètres de requête API

Développer pour voir InputConfig

{
  "MediaArray": [
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-1.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-2.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-3.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-4.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-5.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-6.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-7.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-8.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-9.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-10.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-11.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-12.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-13.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-14.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-15.mp4",
    "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/sea/sea-16.mp4"
  ],
  "SpeechText": "In the vast, boundless blue depths, a vibrant picture is slowly unfolding. In the clear, azure water, coral reefs are like an underwater forest, colorful and magnificent. They are an important cornerstone of marine biodiversity, providing shelter for countless small fish, shellfish, and algae. Lazy and adorable sea lions bask in the warm sunlight on the rocks, enjoying the sun in harmony with nature. Dolphins swim together in the blue water, chasing and playing with each other, showing the agility and wisdom endowed by nature. However, the beautiful marine environment is facing unprecedented challenges. Various types of garbage pollution are like scars on the ocean's skin, ruthlessly eroding the once pristine ecosystem. Many species face food shortages, increased diseases, and even population decline. We must act to protect this beautiful and fragile blue home, so that the future ocean can once again restore its purity and vitality.",
  "Title":"Protecting Our Blue Home",
  "SceneInfo": {
    "Scene": "MovieHighlights", // MovieHighlights for movie highlights 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"
        }
      ]
    }
  }
}

Développer pour voir OutputConfig

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

Configurations avancées

Configurations avancées : Logique Remix et configurations avancées pour la génération de vidéos par lot en un clic.

FAQ

Pour obtenir des réponses aux questions fréquemment posées sur la génération automatisée de vidéos par script, consultez la rubrique FAQ sur les temps forts de films :

Références