智能处理后参与视频合成

本文为您介绍如何修改SubmitMediaProducingJobTimeline参数完成智能处理后参与视频合成。

使用说明

  • 智能生产制作支持直播流、点播和OSS素材文件的剪辑合成、特效渲染、模板生产等功能,更多详情请参见智能生产制作概述

  • 将一个或多个视频、音频、图片、字幕素材合成为成品,可以通过不同的Timeline参数配置提交剪辑,然后调用SubmitMediaProducingJob - 提交剪辑合成作业来完成合成。

  • 时间线是将素材按照视频创意进行编排和特效设计的产物,时间线主要包含轨道、素材、效果3种对象,详情请参见Timeline配置说明

  • 如果您想通过调用SDK进行音视频剪辑,请参见安装IMS服务端SDK的准备工作

AI_ASR语音转文字并将字幕合并到视频中

通过设置"Type": "AI_ASR",可以将音视频中的语音转换成文字。同时,还可以设置字幕样式,例如字体、颜色等。

说明

语音转文字服务只支持华东2(上海)、华北2(北京)、华东1(杭州)和华南1(深圳)地域。

成片效果

Timeline示例

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

AI_TTS 文字转语音并将语音合并到视频中

设置"Type": "AI_TTS"可以将文字转换成语音,可以与"Type": "AI_ASR"共用。其中,Content为要转换的文字,同时可以设置语音属性,例如:Voice、SpeechRate、PitchRate、Format等。

说明
  • 文字转语音和语音转文字服务都只支持华东2(上海)、华北2(北京)和华东1(杭州)地域。

  • AI_TTS默认根据中文逗号、句号等标点符号进行断句,开发者可以控制每个断句的字幕样式,以及换行模式。

成片效果

Timeline示例

{
  "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": "君不见黄河之水天上来,奔流到海不复回。君不见高堂明镜悲白发,朝如青丝暮成雪。",
      "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
      }]
    }]
  }]
}

AI_TTS 文字转语音并通过SSML控制节奏或读音

AI_TTS中的Content字段支持SSML标记语言,可用于修正专业词汇读音、添加停顿、多情感音效,详情请参见SSML标记语言介绍

成片效果

Timeline示例

{
  "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": "PU线,全名Polyurethane线条,是用PU合成原料制作的线条,中文名为聚氨基甲酸酯,简称聚氨酯,以硬质PU泡棉制成",
      "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": "<speak><sub alias=\"批优\">PU</sub>线,全名Polyurethane线条, 是用<sub alias=\"批优\">PU</sub>合成原料制作的线条,中文名为聚氨基甲酸酯, 简称聚氨酯,以硬质<sub alias=\"批优\">PU</sub>泡棉制成</speak>",
      "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": "普通AI_TTS,专业词汇\"PU\"读音不准确",
      "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": "AI_TTS使用了SSML标记,专业词汇\"PU\"读音被修正",
      "Alignment": "TopCenter",
      "FontSize": 70,
      "FontColorOpacity": 1,
      "FontColor": "#006633",
      "Outline": 1,
      "OutlineColour": "#ffffff",
      "TimelineIn": 13,
      "AdaptMode": "AutoWrap",
      "FontFace": {
        "Bold": true,
        "Italic": false,
        "Underline": false
      }
    }]
  }]
}

AI_Matting 绿幕抠图

设置"Type": "AI_Matting"可以将被摄物体从绿幕背景色中抠出,叠加到指定的背景视频或图片上。

说明

绿幕抠图服务只支持华东1(杭州)、华东2(上海)和华北2(北京)地域。

成片效果

Timeline示例

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

AI_RealMatting 实景抠图

设置"Type": "AI_RealMatting"可以将人像从任意实景中抠出,叠加到指定的背景视频或图片上。

说明

实景抠图服务只支持华东1(杭州)、华东2(上海)和华北2(北京)地域。

成片效果

Timeline示例

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

相关文档