All Products
Search
Document Center

Intelligent Media Services:Produce a video after intelligent data processing

Last Updated:Dec 10, 2024

This topic describes how to configure the Timeline parameters in the SubmitMediaProducingJob operation to produce a video after intelligent data processing.

Usage notes

  • Intelligent production supports editing and compositing, effect rendering, and templates for live streams, VOD files, and material files from Object Storage Service (OSS). For more information, see Intelligent production overview.

  • You can produce a video from one or more videos, audio files, images, and subtitle materials by configuring Timeline parameters and calling the SubmitMediaProducingJob operation.

  • A timeline is created when you add materials and configure effects to create a video. A timeline consists of tracks, materials, and effects. For more information, see Timeline configurations.

  • For more information about how to use the IMS SDK to edit audio and video files, see Preparations.

Use AI_ASR to convert speech to text and add the text to a video

You can add the "Type": "AI_ASR" setting to convert speech to text. You can also set the subtitle style, such as the font and color.

Note

The feature of converting speech to text is available in the China (Shanghai), China (Beijing), China (Hangzhou), and China (Shenzhen) regions.

Effect

Timeline example

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h5.mp4",
      "Effects": [{
        "Type": "AI_ASR",
        "Font": "AlibabaPuHuiTi",
        "Alignment": "TopCenter",
        "Y": 910,
        "Outline": 10,
        "OutlineColour": "#ffffff",
        "FontSize": 60,
        "FontColor": "#000079",
        "FontFace": {
          "Bold": true,
          "Italic": false,
          "Underline": false
        }
      }]
    }]
  }]
}

Use AI_TTS to convert text to speech and add the speech to a video

You can add the "Type": "AI_TTS" setting to convert text to speech. This setting can be used together with "Type": "AI_ASR". Content indicates the text that you want to convert. You can also set speech properties, such as Voice, SpeechRate, PitchRate, and Format.

Note
  • The feature of converting text to speech is available in the China (Shanghai), China (Beijing), and China (Hangzhou) regions.

  • By default, AI_TTS splits sentences based on punctuation marks such as commas (,) and periods (.). You can define the subtitle style and line break mode for each split sentence.

Effect

Timeline example

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
      "Effects": [{
        "Type":"Volume",
        "Gain":0
      }]
    }]
  }],
  "AudioTracks": [{
    "AudioTrackClips": [{
      "Type": "AI_TTS",
      "Content": "Do you not see the Yellow River come from the sky, rushing into the sea and never come back? Do you not see the mirrors bright in chambers high, grieve over your snow-white hair though once it was silk-black?",
      "Voice": "sicheng",
      "Effects": [{
        "Type": "AI_ASR",
        "Font": "AlibabaPuHuiTi",
        "Alignment": "TopCenter",
        "Y": 900,
        "FontSize": 80,
        "FontColor": "#ffffff",
        "FontFace": {
          "Bold": true,
          "Italic": false,
          "Underline": false
        }
      },{
        "Type":"Volume",
        "Gain":2
      }]
    }]
  }]
}

Use AI_TTS to convert text to speech and use SSML to control the rhythm or pronunciation

The Content field in AI_TTS supports the Speech Synthesis Markup Language (SSML) markup language. It can be used to correct the pronunciation of specialized words, add pauses, and add different emotions and styles to the speech.

Effect

Timeline example

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "Type": "Image",
      "MediaURL": "https://your-bucket***.oss-cn-shanghai.aliyuncs.com/your-image1.jpg",
      "Duration": 3,
      "Effects": [{
          "Radius": 0.1,
          "Type": "Background",
          "SubType": "Blur"
        },
        {
          "Type": "Transition",
          "SubType": "windowslice",
          "Duration": 0.3
        }
      ]
    }, {
      "Type": "Image",
      "MediaURL": "https://your-bucket***.oss-cn-shanghai.aliyuncs.com/your-image2.jpg",
      "Duration": 3,
      "Effects": [{
          "Radius": 0.1,
          "Type": "Background",
          "SubType": "Blur"
        },
        {
          "Type": "Transition",
          "SubType": "windowslice",
          "Duration": 0.3
        }
      ]
    }, {
      "Type": "Image",
      "MediaURL": "https://your-bucket***.oss-cn-shanghai.aliyuncs.com/your-image3.jpg",
      "Duration": 3,
      "Effects": [{
          "Radius": 0.1,
          "Type": "Background",
          "SubType": "Blur"
        },
        {
          "Type": "Transition",
          "SubType": "windowslice",
          "Duration": 0.3
        }
      ]
    }]
  }],
  "AudioTracks": [{
    "MainTrack": true,
    "AudioTrackClips": [{
      "Type": "AI_TTS",
      "Voice": "zhichu",
      "Content": "Polyurethane (PU) molding is a process that involves using a liquid polyurethane material, also known as polyurethane resin, to create parts and components.",
      "Effects": [{
        "Type": "AI_ASR",
        "Font": "AlibabaPuHuiTi",
        "Alignment": "TopCenter",
        "Y": 1000,
        "FontSize": 50,
        "FontColor": "#ffffff",
        "AdaptMode": "AutoWrap",
        "Outline": 1,
        "OutlineColour": "#0e0100",
        "FontFace": {
          "Bold": true,
          "Italic": false,
          "Underline": false
        }
      }, {
        "Type": "Volume",
        "Gain": 1
      }]
    }, {
      "Type": "AI_TTS",
      "Voice": "zhichu",
      "Content": "Polyurethane (<sub alias=\"P U \">PU</sub>) molding is a process that involves using a liquid polyurethane material, also known as polyurethane resin, to create parts and components.",
      "Effects": [{
        "Type": "AI_ASR",
        "Font": "AlibabaPuHuiTi",
        "Alignment": "TopCenter",
        "Y": 1000,
        "FontSize": 50,
        "FontColor": "#ffffff",
        "AdaptMode": "AutoWrap",
        "Outline": 1,
        "OutlineColour": "#0e0100",
        "FontFace": {
          "Bold": true,
          "Italic": false,
          "Underline": false
        }
      }, {
        "Type": "Volume",
        "Gain": 1
      }]
    }]
  }],
  "SubtitleTracks": [{
    "SubtitleTrackClips": [{
      "Type": "Text",
      "X": 0,
      "Y": 200,
      "Font": "AlibabaPuHuiTi",
      "Content": "With common AI_TTS, the pronunciation of \"PU\" is inaccurate.",
      "Alignment": "TopCenter",
      "FontSize": 70,
      "FontColorOpacity": 1,
      "FontColor": "#990000",
      "AaiMotionLoopEffect1": "slingshot_in",
      "Outline": 1,
      "OutlineColour": "#ffffff",
      "TimelineIn": 0,
      "TimelineOut": 13,
      "AdaptMode": "AutoWrap",
      "FontFace": {
        "Bold": true,
        "Italic": false,
        "Underline": false
      }
    }, {
      "Type": "Text",
      "X": 0,
      "Y": 200,
      "Font": "AlibabaPuHuiTi",
      "Content": "With SSML markups used in AI_TTS, the pronunciation of the word \"PU\"is corrected.",
      "Alignment": "TopCenter",
      "FontSize": 70,
      "FontColorOpacity": 1,
      "FontColor": "#006633",
      "Outline": 1,
      "OutlineColour": "#ffffff",
      "TimelineIn": 13,
      "AdaptMode": "AutoWrap",
      "FontFace": {
        "Bold": true,
        "Italic": false,
        "Underline": false
      }
    }]
  }]
}

Use AI_Matting to configure green screen matting

You can configure the "Type": "AI_Matting" setting to extract an object from a green screen and seamlessly superimpose it onto a specified background video or image.

Note

The feature of green screen matting is available in the China (Hangzhou), China (Shanghai), and China (Beijing) regions.

Effect

Timeline example

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/background_v2.jpg",
      "Type": "GlobalImage",
      "Width": 1,
      "Height": 1,
      "AdaptMode": "Cover"
    }]
  }, {
    "VideoTrackClips": [{
      "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/green-matting-1.mp4",
      "Effects": [{
        "Type": "AI_Matting",
        "Color": "green",
        "Auto": 1,
        "Thres": 10
      }]
    }]
  }]
}

Use AI_RealMatting to configure background replacement

You can configure the "Type": "AI_RealMatting" setting to extract an object from any background and seamlessly superimpose it onto a specified background video or image.

Note

The feature of background replacement is available in the China (Hangzhou), China (Shanghai), and China (Beijing) regions.

Effect

Timeline example

{
  "VideoTracks": [
    {
      "VideoTrackClips": [
        {
          "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/03.jpg",
          "Type": "GlobalImage",
          "Width": 0.5,
          "Height": 1,
          "X": 0.5,
          "Y": 0,
          "AdaptMode": "Cover"
        }
      ]
    },
    {
      "VideoTrackClips": [
        {
          "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h6.mov",
          "In": 0,
          "Out": 10,
          "Width": 0.5,
          "Height": 1,
          "AdaptMode": "Cover",
          "X": 0.5,
          "Effects": [
            {
              "Type": "AI_RealMatting",
              "Thres": 8
            },
            {
              "Type": "Crop",
              "X": 0.25,
              "Height": 1,
              "Width": 0.5
            },
            {
              "Type": "Text"
            }
          ]
        }
      ]
    },
    {
      "VideoTrackClips": [
        {
          "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h6.mov",
          "In": 0,
          "Out": 10,
          "Width": 0.5,
          "Height": 1,
          "AdaptMode": "Cover",
          "Effects": [
            {
              "Type": "Crop",
              "X": 0.25,
              "Height": 1,
              "Width": 0.5
            },
            {
              "Type": "Volume",
              "Gain": 0
            }
          ]
        }
      ]
    }
  ]
}

References