视频剪辑中生成花字特效的代码案例详述

视频剪辑,生成,特效,代码,案例,详述 · 浏览次数 : 17

小编点评

#轨道对齐示例文档 **说明:** 该产品可广泛应用于互联网、文化传媒、广告营销、教育金融等行业,满足企业进行规模、高效、便捷、智能的视频内容生产需求。 **具体文档:** *智能媒体服务IMS「云端智能剪辑」是基于云计算和人工智能技术的视频剪辑生产服务,能为用户提供直播剪辑、视频剪辑、模版工厂、数字人制作等核心功能,并可使用 AI 辅助剪辑生产。 *该产品可广泛应用于互联网、文化传媒、广告营销、教育金融等行业,满足企业进行规模、高效、便捷、智能的视频内容生产需求。 *该产品可使用 AI 辅助剪辑生产,可减少人工剪辑的成本,提高效率。 *该产品可使用多种技术手段,可让用户对视频进行个性化剪辑。 *该产品可使用多种技术手段,可让用户对视频进行个性化剪辑。

正文

本文为阿里云智能媒体服务IMS「云端智能剪辑」实践指南第四期,通过运用官方提供的花字模版或自定义设计花字,完成丰富、精美的花字特效视频剪辑。

昱尘|作者

在视频后期剪辑中,“花字”是一种特别的存在。

通过使用适合视频的花字,不仅可以丰富视频内容,还可以让视频传达的信息更加容易让用户接受,加深观众对于视频内容的印象。

对于做短视频营销场景的客户来说,花字更是起着至关重要的作用,不仅可以增强视频传达信息的能力,还可以增加视频的效果精美度。

视频中常用的花字,一般会包含几个要素:文字颜色、纹理、字体、多层描边、多层阴影以及背景及发光效果等。

本文主要介绍如何通过使用智能媒体服务IMS「云端智能剪辑」增加花字,将从「如何使用官方花字」以及「如何自定义设计花字」两方面来介绍强大的花字能力。本文效果实现较为简单,将视频地址换成您自己的oss地址,即可以实现示例效果。

01 原始字幕

我们参考市面上比较主流的营销类短视频剪辑模式,以下面这个流程作为demo展示的模版。

  • 使用一张图片作为视频封面,增加主标题、副标题以及描述文字;

  • 使用三个横屏拍摄的视频作为主体内容,输出为竖屏视频(方便手机观看),上下增加背景模糊效果;

  • 每一个视频或者图片,对应一段TTS口播,让视频或者图片与口播对齐,保证视频的流畅性;

  • TTS口播同时搭配ASR字幕。

按照上面这个模版,我们先看一个不使用任何复杂字幕效果剪辑成的视频效果:

https://v.qq.com/x/page/p3502q8vcef.html

通过观看视频发现,该视频中的字幕存在一些问题:

l 视频背景比较复杂,在字幕颜色和视频底色比较接近时,会导致字幕不够清晰;

l 字幕比较单调乏味,视频内容不够精致,容易让用户产生视觉疲劳,降低传播力;

l 字幕效果不够突出亮眼,无法一眼就让用户把握视频关键信息。

原始字幕Timeline:

{
  "VideoTracks": [{
    "VideoTrackClips": [{
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/cover.jpg",
        "Width": 1,
        "Height": 1,
        "Type": "Image",
        "AdaptMode": "Cover",
        "ReferenceClipId": "speech_1",
        "Effects": [{
            "Type": "Text",
            "Font": "HappyZcool-2016",
            "Content": "朋友聚餐",
            "Y": 0.5,
            "FontSize": 80,
            "Angle": "30",
            "Alignment": "TopCenter",
            "FontColor": "#ffffff"
          },
          {
            "Type": "Text",
            "Font": "HappyZcool-2016",
            "Content": "同学聚会",
            "Y": 0.6,
            "FontSize": 80,
            "Angle": "30",
            "Alignment": "TopCenter",
            "FontColor": "#ffffff"
          },
          {
            "Type": "Text",
            "Font": "HappyZcool-2016",
            "Content": "家人团聚",
            "Y": 0.7,
            "FontSize": 80,
            "Angle": "30",
            "Alignment": "TopCenter",
            "FontColor": "#ffffff"
          },
          {
            "Type": "Text",
            "Font": "HappyZcool-2016",
            "Content": "同事团建",
            "Y": 0.8,
            "FontSize": 80,
            "Angle": "30",
            "Alignment": "TopCenter",
            "FontColor": "#ffffff"
          }
        ]
      },
      {
        "Comment": "火锅",
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%81%AB%E9%94%85.mp4",
        "Y": 0.3,
        "Width": 1080,
        "Height": 608,
        "AdaptMode": "Cover",
        "Effects": [{
          "Type": "Background",
          "SubType": "Blur",
          "Radius": 0.1
        }],
        "ReferenceClipId": "speech_2"
      },
      {
        "Comment": "烤羊肉串",
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%83%A4%E7%BE%8A%E8%82%89%E4%B8%B2.mp4",
        "Y": 0.3,
        "Width": 1080,
        "Height": 608,
        "AdaptMode": "Cover",
        "Effects": [{
          "Type": "Background",
          "SubType": "Blur",
          "Radius": 0.1
        }],
        "ReferenceClipId": "speech_3"
      },
      {
        "Comment": "大鱿鱼",
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%83%A4%E9%B1%BF%E9%B1%BC.mp4",
        "Y": 0.3,
        "Width": 1080,
        "Height": 608,
        "AdaptMode": "Cover",
        "Effects": [{
          "Type": "Background",
          "SubType": "Blur",
          "Radius": 0.1
        }],
        "ReferenceClipId": "speech_4"
      },
      {
        "Comment": "新鲜蔬菜",
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E8%94%AC%E8%8F%9C.mp4",
        "Y": 0.3,
        "Width": 1080,
        "Height": 608,
        "AdaptMode": "Cover",
        "Effects": [{
          "Type": "Background",
          "SubType": "Blur",
          "Radius": 0.1
        }],
        "ReferenceClipId": "speech_5"
      }
    ]
  }],
  "AudioTracks": [{
    "AudioTrackClips": [{
        "Type": "AI_TTS",
        "Content": "周末就来阿云美食城吧",
        "Voice": "zhimi_emo",
        "ClipId": "speech_1"
      },
      {
        "Type": "AI_TTS",
        "Content": "这里有入口醇香的老北京火锅!",
        "Voice": "zhimi_emo",
        "Effects": [{
          "Type": "AI_ASR",
          "Font": "HappyZcool-2016",
          "Alignment": "TopCenter",
          "Y": 0.65,
          "FontSize": 80,
          "FontColor": "#ffffff"
        }],
        "ClipId": "speech_2"
      },
      {
        "Type": "AI_TTS",
        "Content": "这里有香喷喷的烤羊肉串!",
        "Voice": "zhimi_emo",
        "Effects": [{
          "Type": "AI_ASR",
          "Font": "HappyZcool-2016",
          "Alignment": "TopCenter",
          "Y": 0.65,
          "FontSize": 80,
          "FontColor": "#ffffff"
        }],
        "ClipId": "speech_3"
      },
      {
        "Type": "AI_TTS",
        "Content": "这里有无比鲜嫩的大鱿鱼!",
        "Voice": "zhimi_emo",
        "Effects": [{
          "Type": "AI_ASR",
          "Font": "HappyZcool-2016",
          "Alignment": "TopCenter",
          "Y": 0.65,
          "FontSize": 80,
          "FontColor": "#ffffff"
        }],
        "ClipId": "speech_4"
      },
      {
        "Type": "AI_TTS",
        "Content": "还有各种新鲜蔬菜等你来品尝~",
        "Voice": "zhimi_emo",
        "Effects": [{
          "Type": "AI_ASR",
          "Font": "HappyZcool-2016",
          "Alignment": "TopCenter",
          "Y": 0.65,
          "FontSize": 80,
          "FontColor": "#ffffff"
        }],
        "ClipId": "speech_5"
      }
    ]
  }],
  "SubtitleTracks": [{
    "SubtitleTrackClips": [{
        "Comment": "主标题",
        "Type": "Text",
        "Font": "HappyZcool-2016",
        "Y": 0.05,
        "FontSize": 200,
        "Content": "阿云美食城",
        "FontColor": "#CFFAFF",
        "SizeRequestType": "Nominal",
        "AdaptMode": "AutoScale",
        "Spacing": 3,
        "Alignment": "TopCenter"
      },
      {
        "Comment": "副标题",
        "Type": "Text",
        "Font": "HappyZcool-2016",
        "Y": 0.2,
        "FontSize": 100,
        "Content": "味蕾盛宴",
        "FontColor": "#CFFAFF",
        "SizeRequestType": "Nominal",
        "AdaptMode": "AutoScale",
        "Spacing": 3,
        "Alignment": "TopCenter"
      }
    ]
  }]
}

02 32套官方花字

为了解决上述原始字幕文字不明显以及效果比较差等一些问题,我们可以用IMS中已集成的官方花字来丰富视频内容。阿里云智能媒体服务新增32套高级花字。

花字效果示例:

https://help.aliyun.com/document_detail/449561.html

可以简单设置花字Id来一键式实现多种花字效果。使用官方花字对视频内容进行丰富的效果如下:

https://v.qq.com/x/page/r3502mwbj8h.html

对比没有配置花字的原始字幕版本的效果,可以发现:使用官方花字制作的营销短视频,不再会由于视频底色变化而让人看不清字幕,从而更加能抓住观众的注意力,加深印象。

设置花字的方式也十分简便,直接设置一个花字Id即可,比如"EffectColorStyle": "CS0002-000011",如果需要修改文字字体,可以使用自定义字体功能或者使用我们的官方内置字体库

官方花字Timeline:

{
  "VideoTracks": [{
    "VideoTrackClips": [{
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/cover.jpg",
        "Width": 1,
        "Height": 1,
        "Type": "Image",
        "AdaptMode": "Cover",
        "ReferenceClipId": "speech_1",
        "Effects": [{
            "Type": "Text",
            "Content": "朋友聚餐",
            "Y": 0.5,
            "FontSize": 80,
            "Angle": "30",
            "Alignment": "TopCenter",
            "EffectColorStyle": "CS0001-000015"
          },
          {
            "Type": "Text",
            "Content": "同学聚会",
            "Y": 0.6,
            "FontSize": 80,
            "Angle": "30",
            "Alignment": "TopCenter",
            "EffectColorStyle": "CS0001-000015"
          },
          {
            "Type": "Text",
            "Content": "家人团聚",
            "Y": 0.7,
            "FontSize": 80,
            "Angle": "30",
            "Alignment": "TopCenter",
            "EffectColorStyle": "CS0001-000015"
          },
          {
            "Type": "Text",
            "Content": "同事团建",
            "Y": 0.8,
            "FontSize": 80,
            "Angle": "30",
            "Alignment": "TopCenter",
            "EffectColorStyle": "CS0001-000015"
          }
        ]
      },
      {
        "Comment": "火锅",
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%81%AB%E9%94%85.mp4",
        "Y": 0.3,
        "Width": 1080,
        "Height": 608,
        "AdaptMode": "Cover",
        "Effects": [{
          "Type": "Background",
          "SubType": "Blur",
          "Radius": 0.1
        }],
        "ReferenceClipId": "speech_2"
      },
      {
        "Comment": "烤羊肉串",
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%83%A4%E7%BE%8A%E8%82%89%E4%B8%B2.mp4",
        "Y": 0.3,
        "Width": 1080,
        "Height": 608,
        "AdaptMode": "Cover",
        "Effects": [{
          "Type": "Background",
          "SubType": "Blur",
          "Radius": 0.1
        }],
        "ReferenceClipId": "speech_3"
      },
      {
        "Comment": "大鱿鱼",
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%83%A4%E9%B1%BF%E9%B1%BC.mp4",
        "Y": 0.3,
        "Width": 1080,
        "Height": 608,
        "AdaptMode": "Cover",
        "Effects": [{
          "Type": "Background",
          "SubType": "Blur",
          "Radius": 0.1
        }],
        "ReferenceClipId": "speech_4"
      },
      {
        "Comment": "新鲜蔬菜",
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E8%94%AC%E8%8F%9C.mp4",
        "Y": 0.3,
        "Width": 1080,
        "Height": 608,
        "AdaptMode": "Cover",
        "Effects": [{
          "Type": "Background",
          "SubType": "Blur",
          "Radius": 0.1
        }],
        "ReferenceClipId": "speech_5"
      }
    ]
  }],
  "AudioTracks": [{
    "AudioTrackClips": [{
        "Type": "AI_TTS",
        "Content": "周末就来阿云美食城吧",
        "Voice": "zhimi_emo",
        "ClipId": "speech_1"
      },
      {
        "Type": "AI_TTS",
        "Content": "这里有入口醇香的老北京火锅!",
        "Voice": "zhimi_emo",
        "Effects": [{
          "Type": "AI_ASR",
          "Font": "KaiTi",
          "Spacing": 2,
          "Alignment": "TopCenter",
          "Y": 0.65,
          "FontSize": 70,
          "AdaptMode": "AutoWrap",
          "EffectColorStyle": "CS0001-000014"
        }],
        "ClipId": "speech_2"
      },
      {
        "Type": "AI_TTS",
        "Content": "这里有香喷喷的烤羊肉串!",
        "Voice": "zhimi_emo",
        "Effects": [{
          "Type": "AI_ASR",
          "Font": "KaiTi",
          "Spacing": 2,
          "Alignment": "TopCenter",
          "Y": 0.65,
          "FontSize": 70,
          "AdaptMode": "AutoWrap",
          "EffectColorStyle": "CS0001-000014"
        }],
        "ClipId": "speech_3"
      },
      {
        "Type": "AI_TTS",
        "Content": "这里有无比鲜嫩的大鱿鱼!",
        "Voice": "zhimi_emo",
        "Effects": [{
          "Type": "AI_ASR",
          "Font": "KaiTi",
          "Spacing": 2,
          "Alignment": "TopCenter",
          "Y": 0.65,
          "FontSize": 70,
          "AdaptMode": "AutoWrap",
          "EffectColorStyle": "CS0001-000014"
        }],
        "ClipId": "speech_4"
      },
      {
        "Type": "AI_TTS",
        "Content": "还有各种新鲜蔬菜等你来品尝~",
        "Voice": "zhimi_emo",
        "Effects": [{
          "Type": "AI_ASR",
          "Font": "KaiTi",
          "Spacing": 2,
          "Alignment": "TopCenter",
          "Y": 0.65,
          "FontSize": 70,
          "AdaptMode": "AutoWrap",
          "EffectColorStyle": "CS0001-000014"
        }],
        "ClipId": "speech_5"
      }
    ]
  }],
  "SubtitleTracks": [{
    "SubtitleTrackClips": [{
        "Comment": "主标题",
        "Type": "Text",
        "Y": 0.05,
        "FontSize": 200,
        "Content": "阿云美食城",
        "FontColor": "#CFFAFF",
        "SizeRequestType": "Nominal",
        "AdaptMode": "AutoScale",
        "Spacing": 2,
        "Alignment": "TopCenter",
        "EffectColorStyle": "CS0002-000003"
      },
      {
        "Comment": "副标题",
        "Type": "Text",
        "Y": 0.2,
        "FontSize": 100,
        "Content": "味蕾盛宴",
        "FontColor": "#CFFAFF",
        "SizeRequestType": "Nominal",
        "AdaptMode": "AutoScale",
        "Spacing": 2,
        "Alignment": "TopCenter",
        "EffectColorStyle": "CS0002-000011"
      }
    ]
  }]
}

03 自定义设计花字

当官方花字仍无法满足视频制作效果的需求,我们也支持自定义花字功能。您可以灵活组织多层描边效果,多层阴影效果,我们也支持设置高斯模糊,实现字幕发光效果。

在具体Timeline设置前,我们先来看一下自定义设计花字的成片效果。

https://v.qq.com/x/page/h3502f25vuk.html

自定义花字的API协议:

https://help.aliyun.com/document_detail/198823.html

首先,我们来看一个多层描边的花字示例。我们以官方花字CS0001-000016这个效果为例。

CS0001-000016花字

仔细观察,可以知道这个花字是通过从外到内叠加颜色逐渐变深的多层描边来实现的,通过在SubtitleEffects中设置多层颜色逐渐变深的描边效果即可实现这个花字。

Color字段为RGB颜色值,Type设置为Outline表示描边,Bord、Shift设置成0-1的小数时,表示相对字体大小的值,实际渲染时会乘以FontSize值,这样即可实现不同字体大小下,花字效果基本保持一致。

SubtitleEffects是一个JSON数组,越靠前的在渲染时会越在底层,所以底层描边Bord需要比上层描边Bord设置的稍大一些,否则底层的描边会被上层的描边遮住,从而失去效果。

该花字的文字颜色为白色,设置字体为站酷快乐体,据此可以设置字幕轨道参数为如下。

CS0001-000016花字SubtitleTrackClips参数解析:

{
  "Type": "Text",
  "FontSize": 130,
  "Content": "阿里云剪辑",
  "Spacing": 2,
  "Alignment": "TopCenter",
  "Font": "HappyZcool-2016",
  "FontColor": "#ffffff",
  "SubtitleEffects": [{
    "Color": "#c6f295",
    "Type": "Outline",
    "Blur": 0.0,
    "XBord": 0.16,
    "YBord": 0.16,
    "XShift": 0.0,
    "YShift": 0.0,
    "Opacity": 1.0
  }, {
    "Color": "#99dda3",
    "Type": "Outline",
    "Blur": 0.0,
    "XBord": 0.12,
    "YBord": 0.12,
    "XShift": 0.0,
    "YShift": 0.0,
    "Opacity": 1.0
  }, {
    "Color": "#66c19c",
    "Type": "Outline",
    "Blur": 0.0,
    "XBord": 0.08,
    "YBord": 0.08,
    "XShift": 0.0,
    "YShift": 0.0,
    "Opacity": 1.0
  }, {
    "Color": "#138b8a",
    "Type": "Outline",
    "Blur": 0.0,
    "XBord": 0.04,
    "YBord": 0.04,
    "XShift": 0.0,
    "YShift": 0.0,
    "Opacity": 1.0
  }]
}

我们再来看如何自定义实现字幕发光效果

CS0002-000015花字

我们以CS0002-000015这个花字效果为例。仔细看,这个花字整体是由两部分组成的,一部分为底部的文字投影,一部分为上层的文字主体。

再细细观察,可以发现,文字投影部分最外是由一层淡蓝色发光效果构成,中间是一层描边,描边中间包含深蓝色的文字实体。发光的效果我们是通过给阴影增加模糊效果来实现。

上层文字主体部分,是由一个层描边包含文字主体的轮廓构成,文字主体部分有半透明效果,所以该花字效果解析的字幕轨道参数如下:

CS0002-000015花字SubtitleTrackClips参数解析:

{
  "Type": "Text",
  "FontSize": 130,
  "Content": "阿里云剪辑",
  "Y": 0.3,
  "Spacing": 2,
  "SizeRequestType": "Nominal",
  "Alignment": "TopCenter",
  "Font": "HappyZcool-2016",
  "FontColor": "#00e6ff",
  "FontColorOpacity": 0.5607843137254902,
  "SubtitleEffects": [{
      "Color": "#1be6ff",
      "Type": "Shadow",
      "Blur": 0.14,
      "XBord": 0.02,
      "YBord": 0.02,
      "XShift": 0.04,
      "YShift": 0.04,
      "Opacity": 1.0
    },
    {
      "Color": "#008c9e",
      "Type": "Shadow",
      "Blur": 0.0,
      "XBord": 0.04,
      "YBord": 0.04,
      "XShift": 0.04,
      "YShift": 0.04,
      "Opacity": 1.0
    },
    {
      "Color": "#29e6ff",
      "Type": "Outline",
      "Blur": 0.0,
      "XBord": 0.02,
      "YBord": 0.02,
      "XShift": 0.04,
      "YShift": 0.04,
      "Opacity": 1.0
    },
    {
      "Color": "#ffffff",
      "Type": "Outline",
      "Blur": 0.0,
      "XBord": 0.02,
      "YBord": 0.02,
      "XShift": 0.0,
      "YShift": 0.0,
      "Opacity": 1.0
    }
  ]
}

按照上面这个自定义花字的方法,我们可以实现任意想实现的花字效果。上面这个探店营销短视频的timeline就这样实现出来了。

自定义花字营销视频Timeline:

{
  "VideoTracks": [{
    "VideoTrackClips": [{
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/cover.jpg",
        "Width": 1,
        "Height": 1,
        "Type": "Image",
        "AdaptMode": "Cover",
        "ReferenceClipId": "speech_1",
        "Effects": [{
            "Type": "Text",
            "Content": "朋友聚餐",
            "Y": 0.5,
            "FontSize": 100,
            "Angle": "30",
            "Alignment": "TopCenter",
            "FontColor": "#FDC219",
            "FontURL": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/AliHYAiHei.ttf",
            "SubtitleEffects": [{
                "Type": "Outline",
                "Bord": 0.06,
                "Color": "#FDFDFD"
              },
              {
                "Type": "Outline",
                "Bord": 0.02,
                "Color": "#040404"
              }
            ]
          },
          {
            "Type": "Text",
            "Content": "同学聚会",
            "Y": 0.6,
            "FontSize": 100,
            "Angle": "30",
            "Alignment": "TopCenter",
            "FontColor": "#FDC219",
            "FontURL": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/AliHYAiHei.ttf",
            "SubtitleEffects": [{
                "Type": "Outline",
                "Bord": 0.06,
                "Color": "#FDFDFD"
              },
              {
                "Type": "Outline",
                "Bord": 0.02,
                "Color": "#040404"
              }
            ]
          },
          {
            "Type": "Text",
            "Content": "家人团聚",
            "Y": 0.7,
            "FontSize": 100,
            "Angle": "30",
            "Alignment": "TopCenter",
            "FontColor": "#FDC219",
            "FontURL": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/AliHYAiHei.ttf",
            "SubtitleEffects": [{
                "Type": "Outline",
                "Bord": 0.06,
                "Color": "#FDFDFD"
              },
              {
                "Type": "Outline",
                "Bord": 0.02,
                "Color": "#040404"
              }
            ]
          },
          {
            "Type": "Text",
            "Content": "同事团建",
            "Y": 0.8,
            "FontSize": 100,
            "Angle": "30",
            "Alignment": "TopCenter",
            "FontColor": "#FDC219",
            "FontURL": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/AliHYAiHei.ttf",
            "SubtitleEffects": [{
                "Type": "Outline",
                "Bord": 0.06,
                "Color": "#FDFDFD"
              },
              {
                "Type": "Outline",
                "Bord": 0.02,
                "Color": "#040404"
              }
            ]
          }
        ]
      },
      {
        "Comment": "火锅",
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%81%AB%E9%94%85.mp4",
        "Y": 0.3,
        "Width": 1080,
        "Height": 608,
        "AdaptMode": "Cover",
        "Effects": [{
          "Type": "Background",
          "SubType": "Blur",
          "Radius": 0.1
        }],
        "ReferenceClipId": "speech_2"
      },
      {
        "Comment": "烤羊肉串",
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%83%A4%E7%BE%8A%E8%82%89%E4%B8%B2.mp4",
        "Y": 0.3,
        "Width": 1080,
        "Height": 608,
        "AdaptMode": "Cover",
        "Effects": [{
          "Type": "Background",
          "SubType": "Blur",
          "Radius": 0.1
        }],
        "ReferenceClipId": "speech_3"
      },
      {
        "Comment": "大鱿鱼",
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%83%A4%E9%B1%BF%E9%B1%BC.mp4",
        "Y": 0.3,
        "Width": 1080,
        "Height": 608,
        "AdaptMode": "Cover",
        "Effects": [{
          "Type": "Background",
          "SubType": "Blur",
          "Radius": 0.1
        }],
        "ReferenceClipId": "speech_4"
      },
      {
        "Comment": "新鲜蔬菜",
        "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E8%94%AC%E8%8F%9C.mp4",
        "Y": 0.3,
        "Width": 1080,
        "Height": 608,
        "AdaptMode": "Cover",
        "Effects": [{
          "Type": "Background",
          "SubType": "Blur",
          "Radius": 0.1
        }],
        "ReferenceClipId": "speech_5"
      }
    ]
  }],
  "AudioTracks": [{
    "AudioTrackClips": [{
        "Type": "AI_TTS",
        "Content": "周末就来阿云美食城吧",
        "Voice": "zhimi_emo",
        "ClipId": "speech_1"
      },
      {
        "Type": "AI_TTS",
        "Content": "这里有入口醇香的老北京火锅!",
        "Voice": "zhimi_emo",
        "Effects": [{
          "Type": "AI_ASR",
          "Font": "KaiTi",
          "Spacing": 2,
          "Alignment": "TopCenter",
          "Y": 0.65,
          "FontSize": 70,
          "AdaptMode": "AutoWrap",
          "FontColor": "#FFFFFF",
          "SubtitleEffects": [{
              "Color": "#0420B6",
              "Type": "Shadow",
              "XBord": 0.07,
              "YBord": 0.07,
              "YShift": 0.06
            },
            {
              "Color": "#F2213F",
              "Type": "Shadow",
              "XBord": 0.07,
              "YBord": 0.07,
              "YShift": 0.03
            },
            {
              "Color": "#000000",
              "Type": "Shadow",
              "XShift": 0.01,
              "YShift": 0.01
            },
            {
              "Color": "#000000",
              "Type": "Outline",
              "XBord": 0.01,
              "YBord": 0.01
            }
          ]
        }],
        "ClipId": "speech_2"
      },
      {
        "Type": "AI_TTS",
        "Content": "这里有香喷喷的烤羊肉串!",
        "Voice": "zhimi_emo",
        "Effects": [{
          "Type": "AI_ASR",
          "Font": "KaiTi",
          "Spacing": 2,
          "Alignment": "TopCenter",
          "Y": 0.65,
          "FontSize": 70,
          "AdaptMode": "AutoWrap",
          "FontColor": "#FFFFFF",
          "SubtitleEffects": [{
              "Color": "#0420B6",
              "Type": "Shadow",
              "XBord": 0.07,
              "YBord": 0.07,
              "YShift": 0.06
            },
            {
              "Color": "#F2213F",
              "Type": "Shadow",
              "XBord": 0.07,
              "YBord": 0.07,
              "YShift": 0.03
            },
            {
              "Color": "#000000",
              "Type": "Shadow",
              "XShift": 0.01,
              "YShift": 0.01
            },
            {
              "Color": "#000000",
              "Type": "Outline",
              "XBord": 0.01,
              "YBord": 0.01
            }
          ]
        }],
        "ClipId": "speech_3"
      },
      {
        "Type": "AI_TTS",
        "Content": "这里有无比鲜嫩的大鱿鱼!",
        "Voice": "zhimi_emo",
        "Effects": [{
          "Type": "AI_ASR",
          "Font": "KaiTi",
          "Spacing": 2,
          "Alignment": "TopCenter",
          "Y": 0.65,
          "FontSize": 70,
          "AdaptMode": "AutoWrap",
          "FontColor": "#FFFFFF",
          "SubtitleEffects": [{
              "Color": "#0420B6",
              "Type": "Shadow",
              "XBord": 0.07,
              "YBord": 0.07,
              "YShift": 0.06
            },
            {
              "Color": "#F2213F",
              "Type": "Shadow",
              "XBord": 0.07,
              "YBord": 0.07,
              "YShift": 0.03
            },
            {
              "Color": "#000000",
              "Type": "Shadow",
              "XShift": 0.01,
              "YShift": 0.01
            },
            {
              "Color": "#000000",
              "Type": "Outline",
              "XBord": 0.01,
              "YBord": 0.01
            }
          ]
        }],
        "ClipId": "speech_4"
      },
      {
        "Type": "AI_TTS",
        "Content": "还有各种新鲜蔬菜等你来品尝~",
        "Voice": "zhimi_emo",
        "Effects": [{
          "Type": "AI_ASR",
          "Font": "KaiTi",
          "Spacing": 2,
          "Alignment": "TopCenter",
          "Y": 0.65,
          "FontSize": 70,
          "AdaptMode": "AutoWrap",
          "FontColor": "#FFFFFF",
          "SubtitleEffects": [{
              "Color": "#0420B6",
              "Type": "Shadow",
              "XBord": 0.07,
              "YBord": 0.07,
              "YShift": 0.06
            },
            {
              "Color": "#F2213F",
              "Type": "Shadow",
              "XBord": 0.07,
              "YBord": 0.07,
              "YShift": 0.03
            },
            {
              "Color": "#000000",
              "Type": "Shadow",
              "XShift": 0.01,
              "YShift": 0.01
            },
            {
              "Color": "#000000",
              "Type": "Outline",
              "XBord": 0.01,
              "YBord": 0.01
            }
          ]
        }],
        "ClipId": "speech_5"
      }
    ]
  }],
  "SubtitleTracks": [{
    "SubtitleTrackClips": [{
        "Comment": "主标题",
        "Type": "Text",
        "Y": 0.05,
        "FontSize": 200,
        "Content": "阿云美食城",
        "Spacing": 2,
        "SizeRequestType": "Nominal",
        "Alignment": "TopCenter",
        "Font": "HappyZcool-2016",
        "FontColor": "#F688AA",
        "SubtitleEffects": [{
            "Color": "#F688AA",
            "Type": "Shadow",
            "Blur": 0.30,
            "XBord": 0.15,
            "YBord": 0.15
          },
          {
            "Color": "#FFFFA0",
            "Type": "Shadow",
            "Blur": 0.08,
            "XBord": 0.08,
            "YBord": 0.08
          },
          {
            "Color": "#A33952",
            "Type": "Shadow",
            "XBord": 0,
            "YBord": 0,
            "XShift": 0.04,
            "Opacity": 1.0
          },
          {
            "Color": "#F5D2CC",
            "Type": "Shadow",
            "XBord": 0,
            "YBord": 0,
            "XShift": -0.04,
            "Opacity": 1.0
          }
        ]
      },
      {
        "Comment": "副标题",
        "Type": "Text",
        "Y": 0.2,
        "FontSize": 100,
        "Content": "味蕾盛宴",
        "SizeRequestType": "Nominal",
        "Spacing": 2,
        "Alignment": "TopCenter",
        "Font": "HappyZcool-2016",
        "FontColor": "#F9FAFA",
        "SubtitleEffects": [{
            "Color": "#F4DF50",
            "Type": "Shadow",
            "Blur": 15,
            "XBord": 7,
            "YBord": 7
          },
          {
            "Color": "#464120",
            "Type": "Outline",
            "XBord": 2,
            "YBord": 2
          }
        ]
      }
    ]
  }]
}

以上视频制作中,没有任何时间截取的参数设置,通过轨道对齐功能,实现口播和视频相对齐,完成全流程自动化剪辑。轨道对齐示例文档请参考:

https://help.aliyun.com/document_detail/2507542.html

智能媒体服务IMS「云端智能剪辑」是基于云计算和人工智能技术的视频剪辑生产服务,能为用户提供直播剪辑、视频剪辑、模版工厂、数字人制作等核心功能,并可使用 AI 辅助剪辑生产。该产品可广泛应用于互联网、文化传媒、广告营销、教育金融等行业,满足企业进行规模、高效、便捷、智能的视频内容生产需求。

了解更多产品信息,请点击阿里云云端智能剪辑:https://www.aliyun.com/product/apsaravideo/ice/editor?spm=5176.28055625

欢迎加入官方答疑钉钉群咨询交流:31783668

与视频剪辑中生成花字特效的代码案例详述相似的内容:

视频剪辑中生成花字特效的代码案例详述

本文为阿里云智能媒体服务IMS「云端智能剪辑」实践指南第四期,通过运用官方提供的花字模版或自定义设计花字,完成丰富、精美的花字特效视频剪辑。 昱尘|作者 在视频后期剪辑中,“花字”是一种特别的存在。 通过使用适合视频的花字,不仅可以丰富视频内容,还可以让视频传达的信息更加容易让用户接受,加深观众对于

word文档生成视频,自动配音、背景音乐、自动字幕,另类创作工具

简介 不同于别的视频创作工具,这个工具创作视频只需要在word文档中打字,插入图片即可。完事后就能获得一个带有配音、字幕、背景音乐、视频特效滤镜的优美作品。 这种不要门槛,没有技术难度的视频创作工具,可以让更多的专注于内容创作而不需要花过多时间在视频操作上。 软件截图 随着版本更新,功能丰富了,现看

【manim动画教程】-- 基本图形

制作数学视频时,各类几何图形是使用最频繁的。 一般来说,常用的几何图形包括:点,线,圆以及多边形。 1. 点 点是最简单图形,也是其他所有图形的基础。 绘制其他任何图形时,都是用点来定位的。 manim中生成一个点很方便,只要给定一个坐标即可。 这里的坐标包含 [x, y, z]3个维度,如果绘制二

无需搭建环境,零门槛带你体验Open-Sora文生视频应用

本文分享自华为云社区《Open-Sora 文生视频原来在AI Gallery上也能体验了》,作者:码上开花_Lancer。 体验链接:Open-Sora 文生视频案例体验 不久前,OpenAI Sora 凭借其惊人的视频生成效果迅速走红,在一堆文本转视频模型中脱颖而出,成为全球关注的焦点。之后,Co

【Azure 存储服务】MP4视频放在Azure的Blob里面,用生成URL在浏览器中打开之后,视频可以正常播放却无法拖拽视频的进度

问题描述 把MP4视频放在Azure的Blob里面,用生成URL在浏览器中打开之后,视频可以正常播放却无法拖拽视频的进度,这是什么情况呢? 问题解答 因为MP4上传到Azure Blob后,根据公开的权限,可以直接通过Storage Blob URL +/ Blob Container + / Bl

一个用Python将视频变为表情包的工具

这是一个将视频转变为表情包的工具,现实生活中当我们看到一段搞笑的视频,我们可以将这段视频喂给这段程序,生成gif表情包,这样就可以用来舍友斗图了 1、一些限制 1、这个程序不能转化超过15秒以上的视频,因为占用的内存较高,会被终端杀死(除非你的计算机性能很好,也许1分钟的短视频都可以),为了整个程序

在MoneyPrinterPlus中使用本地chatTTS语音模型

chatTTS是一个开源的优秀语音合成工具,现在你可以在MoneyPrinterPlus中轻松的使用本地chatTTS模型来为视频生成语音了。

【Azure 媒体服务】Azure Media Service上传的视频资产,如何保证在Transfer编码后音频文件和视频文件不分成两个文件?保持在一个可以直接播放的MP4文件中呢?

问题描述 Azure Media Service上传的视频资产,如何保证在Transfer编码后音频文件和视频文件不分成两个文件?保持在一个可以直接播放的MP4文件中呢? 问题解答 Azure Media Service上提供的 Build-in Transform 生成的资产中,音频与视频分别存储

川普真会说中文?连嘴型都同步,VideoReTalking AI数字人下载介绍

你能想到这种画面吗?霉霉在节目中用普通话接受采访,特朗普在老家用中文脱口秀,蔡明老师操着一口流利的英文调侃潘长江老师.. 这听起来似乎很魔幻,可如今全部由VideoReTalking实现了 你只需要传入一个视频文件和音频文件,它会生成一个新的视频,在这个视频里,不仅人物的嘴型会与音频同步,就连表情也

KubeEdge SIG AI发布首个分布式协同AI Benchmark调研

摘要:AI Benchmark旨在衡量AI模型的性能和效能。 本文分享自华为云社区《KubeEdge SIG AI发布首个分布式协同AI Benchmark调研》,作者:KubeEdge SIG AI (成员:张扬,张子阳)。 人工智能技术已经在我们生活中的方方面面为我们提供服务,尤其是在图像、视频