图文转视频

本文为您介绍如何修改SubmitMediaProducingJobTimeline参数来完成图文转视频。

使用说明

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

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

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

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

图片+口播文案+自动对齐(网页转视频、文档转视频场景)

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "ReferenceClipId": "speech1",
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/a1.png",
      "Type": "Image",
      "Effects": [{
        "Type": "Text",
        "Content": "子曰:“学而时习之,不亦说乎?有朋自远方来,不亦乐乎?人不知而不愠,不亦君子乎?”",
        "Alignment": "CenterCenter",
        "FontSize": 55,
        "AdaptMode": "AutoWrap",
        "TextWidth": 0.7,
        "Font": "FZKai-Z03S",
        "FontColor": "#ffffe0",
        "Outline": 2,
        "OutlineColour": "#000000",
        "FontFace": {
          "Bold": true,
          "Italic": false,
          "Underline": false
        }
      }]
    },{
      "ReferenceClipId": "speech2",
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/a2.png",
      "Type": "Image",
      "Effects": [{
        "Type": "Text",
        "Content": "孔子说:“学到的东西按时去温习和练习,不也很高兴吗?有朋友从很远的地方来,不也很快乐吗?别人不了解自己,自己却不生气,不也是一位有修养的君子吗?”",
        "Alignment": "CenterCenter",
        "FontSize": 55,
        "AdaptMode": "AutoWrap",
        "TextWidth": 0.7,
        "Font": "FZKai-Z03S",
        "FontColor": "#ffffe0",
        "Outline": 2,
        "OutlineColour": "#000000",
        "FontFace": {
          "Bold": true,
          "Italic": false,
          "Underline": false
        }
      }]
    },{
      "ReferenceClipId": "speech3",
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/a3.png",
      "Type": "Image",
      "Effects": [{
        "Type": "Text",
        "Content": "子曰:“温故而知新,可以为师矣。”",
        "Alignment": "CenterCenter",
        "FontSize": 55,
        "AdaptMode": "AutoWrap",
        "TextWidth": 0.7,
        "Font": "FZKai-Z03S",
        "FontColor": "#ffffe0",
        "Outline": 2,
        "OutlineColour": "#000000",
        "FontFace": {
          "Bold": true,
          "Italic": false,
          "Underline": false
        }
      }]
    },{
      "ReferenceClipId": "speech4",
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/a4.png",
      "Type": "Image",
      "Effects": [{
        "Type": "Text",
        "Content": "孔子说:“在温习旧的知识时,能有新的收获,就可以当老师了。”",
        "Alignment": "CenterCenter",
        "FontSize": 55,
        "AdaptMode": "AutoWrap",
        "TextWidth": 0.7,
        "Font": "FZKai-Z03S",
        "FontColor": "#ffffe0",
        "Outline": 2,
        "OutlineColour": "#000000",
        "FontFace": {
          "Bold": true,
          "Italic": false,
          "Underline": false
        }
      }]
    }]
  }],
  "AudioTracks": [{
    "MainTrack": true,
    "AudioTrackClips": [{
      "ClipId": "speech1",
      "Type": "AI_TTS",
      "Voice": "zhichu",
      "Content": "《论语》十二章。子曰:“学而时习之,不亦悦乎?有朋自远方来,不亦乐乎?人不知而不愠,不亦君子乎?“",
      "SpeechRate": -200
    },{
      "ClipId": "speech2",
      "Type": "AI_TTS",
      "Voice": "zhichu",
      "Content": "翻译。孔子说:“学到的东西按时去温习和练习,不也很高兴吗?有朋友从很远的地方来,不也很快乐吗?别人不了解自己,自己却不生气,不也是一位有修养的君子吗?”",
      "SpeechRate": -200
    },{
      "ClipId": "speech3",
      "Type": "AI_TTS",
      "Voice": "zhichu",
      "Content": "子曰:“温故而知新,可以为师矣。”",
      "SpeechRate": -200
    },{
      "ClipId": "speech4",
      "Type": "AI_TTS",
      "Voice": "zhichu",
      "Content": "翻译。孔子说:“在温习旧的知识时,能有新的收获,就可以当老师了。”",
      "SpeechRate": -200
    }]
  },{
    "AudioTrackClips": [{
      "MediaUrl": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/music/m1.wav",
      "LoopMode": true
    }]
  }],
  "SubtitleTracks":[
    {
      "SubtitleTrackClips": [
        {
          "Type": "Text",
          "Y": 150,
          "Content": "《论语》十二章",
          "Font": "HappyZcool-2016",
          "Alignment": "TopCenter",
          "EffectColorStyle": "CS0004-000005",
          "AdaptMode": "AutoWrap",
          "FontSize": 70,
          "TextWidth": 900,
          "FontFace": {
            "Bold": false,
            "Italic": false,
            "Underline": false
          }
        }
      ]
    }
  ]
}

图片+音频(音乐相册场景)

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "Type": "Image",
      "MediaUrl": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/01.jpg",
      "Duration": 3,
      "Effects": [{
        "Type": "Background",
        "SubType": "Blur",
        "Radius": 0.1
      }, {
        "Type": "Transition",
        "SubType": "random",
        "Duration": 0.5
      }]
    },{
      "Type": "Image",
      "MediaUrl": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/02.jpg",
      "Duration": 3,
      "Effects": [{
        "Type": "Background",
        "SubType": "Blur",
        "Radius": 0.1
      }, {
        "Type": "Transition",
        "SubType": "random",
        "Duration": 0.5
      }]
    },{
      "Type": "Image",
      "MediaUrl": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/03.jpg",
      "Duration": 3,
      "Effects": [{
        "Type": "Background",
        "SubType": "Blur",
        "Radius": 0.1
      }, {
        "Type": "Transition",
        "SubType": "random",
        "Duration": 0.5
      }]
    },{
      "Type": "Image",
      "MediaUrl": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/04.jpg",
      "Duration": 3,
      "Effects": [{
        "Type": "Background",
        "SubType": "Blur",
        "Radius": 0.1
      }, {
        "Type": "Transition",
        "SubType": "random",
        "Duration": 0.5
      }]
    },{
      "Type": "Image",
      "MediaUrl": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/05.jpg",
      "Duration": 3,
      "Effects": [{
        "Type": "Background",
        "SubType": "Blur",
        "Radius": 0.1
      }, {
        "Type": "Transition",
        "SubType": "random",
        "Duration": 0.5
      }]
    },{
      "Type": "Image",
      "MediaUrl": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/06.jpg",
      "Duration": 3,
      "Effects": [{
        "Type": "Background",
        "SubType": "Blur",
        "Radius": 0.1
      }, {
        "Type": "Transition",
        "SubType": "random",
        "Duration": 0.5
      }]
    },{
      "Type": "Image",
      "MediaUrl": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/07.jpg",
      "Duration": 3,
      "Effects": [{
        "Type": "Background",
        "SubType": "Blur",
        "Radius": 0.1
      }, {
        "Type": "Transition",
        "SubType": "random",
        "Duration": 0.5
      }]
    }]
  }],
  "AudioTracks": [{
    "AudioTrackClips": [{
      "MediaUrl": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/music/m1.wav",
      "LoopMode": true
    }]
  }]
}

相关文档