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


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

    昱尘|作者

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

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

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

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

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

    01 原始字幕

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

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

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

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

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

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

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

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

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

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

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

    原始字幕Timeline:

    1. {
    2. "VideoTracks": [{
    3. "VideoTrackClips": [{
    4. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/cover.jpg",
    5. "Width": 1,
    6. "Height": 1,
    7. "Type": "Image",
    8. "AdaptMode": "Cover",
    9. "ReferenceClipId": "speech_1",
    10. "Effects": [{
    11. "Type": "Text",
    12. "Font": "HappyZcool-2016",
    13. "Content": "朋友聚餐",
    14. "Y": 0.5,
    15. "FontSize": 80,
    16. "Angle": "30",
    17. "Alignment": "TopCenter",
    18. "FontColor": "#ffffff"
    19. },
    20. {
    21. "Type": "Text",
    22. "Font": "HappyZcool-2016",
    23. "Content": "同学聚会",
    24. "Y": 0.6,
    25. "FontSize": 80,
    26. "Angle": "30",
    27. "Alignment": "TopCenter",
    28. "FontColor": "#ffffff"
    29. },
    30. {
    31. "Type": "Text",
    32. "Font": "HappyZcool-2016",
    33. "Content": "家人团聚",
    34. "Y": 0.7,
    35. "FontSize": 80,
    36. "Angle": "30",
    37. "Alignment": "TopCenter",
    38. "FontColor": "#ffffff"
    39. },
    40. {
    41. "Type": "Text",
    42. "Font": "HappyZcool-2016",
    43. "Content": "同事团建",
    44. "Y": 0.8,
    45. "FontSize": 80,
    46. "Angle": "30",
    47. "Alignment": "TopCenter",
    48. "FontColor": "#ffffff"
    49. }
    50. ]
    51. },
    52. {
    53. "Comment": "火锅",
    54. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%81%AB%E9%94%85.mp4",
    55. "Y": 0.3,
    56. "Width": 1080,
    57. "Height": 608,
    58. "AdaptMode": "Cover",
    59. "Effects": [{
    60. "Type": "Background",
    61. "SubType": "Blur",
    62. "Radius": 0.1
    63. }],
    64. "ReferenceClipId": "speech_2"
    65. },
    66. {
    67. "Comment": "烤羊肉串",
    68. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%83%A4%E7%BE%8A%E8%82%89%E4%B8%B2.mp4",
    69. "Y": 0.3,
    70. "Width": 1080,
    71. "Height": 608,
    72. "AdaptMode": "Cover",
    73. "Effects": [{
    74. "Type": "Background",
    75. "SubType": "Blur",
    76. "Radius": 0.1
    77. }],
    78. "ReferenceClipId": "speech_3"
    79. },
    80. {
    81. "Comment": "大鱿鱼",
    82. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%83%A4%E9%B1%BF%E9%B1%BC.mp4",
    83. "Y": 0.3,
    84. "Width": 1080,
    85. "Height": 608,
    86. "AdaptMode": "Cover",
    87. "Effects": [{
    88. "Type": "Background",
    89. "SubType": "Blur",
    90. "Radius": 0.1
    91. }],
    92. "ReferenceClipId": "speech_4"
    93. },
    94. {
    95. "Comment": "新鲜蔬菜",
    96. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E8%94%AC%E8%8F%9C.mp4",
    97. "Y": 0.3,
    98. "Width": 1080,
    99. "Height": 608,
    100. "AdaptMode": "Cover",
    101. "Effects": [{
    102. "Type": "Background",
    103. "SubType": "Blur",
    104. "Radius": 0.1
    105. }],
    106. "ReferenceClipId": "speech_5"
    107. }
    108. ]
    109. }],
    110. "AudioTracks": [{
    111. "AudioTrackClips": [{
    112. "Type": "AI_TTS",
    113. "Content": "周末就来阿云美食城吧",
    114. "Voice": "zhimi_emo",
    115. "ClipId": "speech_1"
    116. },
    117. {
    118. "Type": "AI_TTS",
    119. "Content": "这里有入口醇香的老北京火锅!",
    120. "Voice": "zhimi_emo",
    121. "Effects": [{
    122. "Type": "AI_ASR",
    123. "Font": "HappyZcool-2016",
    124. "Alignment": "TopCenter",
    125. "Y": 0.65,
    126. "FontSize": 80,
    127. "FontColor": "#ffffff"
    128. }],
    129. "ClipId": "speech_2"
    130. },
    131. {
    132. "Type": "AI_TTS",
    133. "Content": "这里有香喷喷的烤羊肉串!",
    134. "Voice": "zhimi_emo",
    135. "Effects": [{
    136. "Type": "AI_ASR",
    137. "Font": "HappyZcool-2016",
    138. "Alignment": "TopCenter",
    139. "Y": 0.65,
    140. "FontSize": 80,
    141. "FontColor": "#ffffff"
    142. }],
    143. "ClipId": "speech_3"
    144. },
    145. {
    146. "Type": "AI_TTS",
    147. "Content": "这里有无比鲜嫩的大鱿鱼!",
    148. "Voice": "zhimi_emo",
    149. "Effects": [{
    150. "Type": "AI_ASR",
    151. "Font": "HappyZcool-2016",
    152. "Alignment": "TopCenter",
    153. "Y": 0.65,
    154. "FontSize": 80,
    155. "FontColor": "#ffffff"
    156. }],
    157. "ClipId": "speech_4"
    158. },
    159. {
    160. "Type": "AI_TTS",
    161. "Content": "还有各种新鲜蔬菜等你来品尝~",
    162. "Voice": "zhimi_emo",
    163. "Effects": [{
    164. "Type": "AI_ASR",
    165. "Font": "HappyZcool-2016",
    166. "Alignment": "TopCenter",
    167. "Y": 0.65,
    168. "FontSize": 80,
    169. "FontColor": "#ffffff"
    170. }],
    171. "ClipId": "speech_5"
    172. }
    173. ]
    174. }],
    175. "SubtitleTracks": [{
    176. "SubtitleTrackClips": [{
    177. "Comment": "主标题",
    178. "Type": "Text",
    179. "Font": "HappyZcool-2016",
    180. "Y": 0.05,
    181. "FontSize": 200,
    182. "Content": "阿云美食城",
    183. "FontColor": "#CFFAFF",
    184. "SizeRequestType": "Nominal",
    185. "AdaptMode": "AutoScale",
    186. "Spacing": 3,
    187. "Alignment": "TopCenter"
    188. },
    189. {
    190. "Comment": "副标题",
    191. "Type": "Text",
    192. "Font": "HappyZcool-2016",
    193. "Y": 0.2,
    194. "FontSize": 100,
    195. "Content": "味蕾盛宴",
    196. "FontColor": "#CFFAFF",
    197. "SizeRequestType": "Nominal",
    198. "AdaptMode": "AutoScale",
    199. "Spacing": 3,
    200. "Alignment": "TopCenter"
    201. }
    202. ]
    203. }]
    204. }

    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:

    1. {
    2. "VideoTracks": [{
    3. "VideoTrackClips": [{
    4. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/cover.jpg",
    5. "Width": 1,
    6. "Height": 1,
    7. "Type": "Image",
    8. "AdaptMode": "Cover",
    9. "ReferenceClipId": "speech_1",
    10. "Effects": [{
    11. "Type": "Text",
    12. "Content": "朋友聚餐",
    13. "Y": 0.5,
    14. "FontSize": 80,
    15. "Angle": "30",
    16. "Alignment": "TopCenter",
    17. "EffectColorStyle": "CS0001-000015"
    18. },
    19. {
    20. "Type": "Text",
    21. "Content": "同学聚会",
    22. "Y": 0.6,
    23. "FontSize": 80,
    24. "Angle": "30",
    25. "Alignment": "TopCenter",
    26. "EffectColorStyle": "CS0001-000015"
    27. },
    28. {
    29. "Type": "Text",
    30. "Content": "家人团聚",
    31. "Y": 0.7,
    32. "FontSize": 80,
    33. "Angle": "30",
    34. "Alignment": "TopCenter",
    35. "EffectColorStyle": "CS0001-000015"
    36. },
    37. {
    38. "Type": "Text",
    39. "Content": "同事团建",
    40. "Y": 0.8,
    41. "FontSize": 80,
    42. "Angle": "30",
    43. "Alignment": "TopCenter",
    44. "EffectColorStyle": "CS0001-000015"
    45. }
    46. ]
    47. },
    48. {
    49. "Comment": "火锅",
    50. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%81%AB%E9%94%85.mp4",
    51. "Y": 0.3,
    52. "Width": 1080,
    53. "Height": 608,
    54. "AdaptMode": "Cover",
    55. "Effects": [{
    56. "Type": "Background",
    57. "SubType": "Blur",
    58. "Radius": 0.1
    59. }],
    60. "ReferenceClipId": "speech_2"
    61. },
    62. {
    63. "Comment": "烤羊肉串",
    64. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%83%A4%E7%BE%8A%E8%82%89%E4%B8%B2.mp4",
    65. "Y": 0.3,
    66. "Width": 1080,
    67. "Height": 608,
    68. "AdaptMode": "Cover",
    69. "Effects": [{
    70. "Type": "Background",
    71. "SubType": "Blur",
    72. "Radius": 0.1
    73. }],
    74. "ReferenceClipId": "speech_3"
    75. },
    76. {
    77. "Comment": "大鱿鱼",
    78. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%83%A4%E9%B1%BF%E9%B1%BC.mp4",
    79. "Y": 0.3,
    80. "Width": 1080,
    81. "Height": 608,
    82. "AdaptMode": "Cover",
    83. "Effects": [{
    84. "Type": "Background",
    85. "SubType": "Blur",
    86. "Radius": 0.1
    87. }],
    88. "ReferenceClipId": "speech_4"
    89. },
    90. {
    91. "Comment": "新鲜蔬菜",
    92. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E8%94%AC%E8%8F%9C.mp4",
    93. "Y": 0.3,
    94. "Width": 1080,
    95. "Height": 608,
    96. "AdaptMode": "Cover",
    97. "Effects": [{
    98. "Type": "Background",
    99. "SubType": "Blur",
    100. "Radius": 0.1
    101. }],
    102. "ReferenceClipId": "speech_5"
    103. }
    104. ]
    105. }],
    106. "AudioTracks": [{
    107. "AudioTrackClips": [{
    108. "Type": "AI_TTS",
    109. "Content": "周末就来阿云美食城吧",
    110. "Voice": "zhimi_emo",
    111. "ClipId": "speech_1"
    112. },
    113. {
    114. "Type": "AI_TTS",
    115. "Content": "这里有入口醇香的老北京火锅!",
    116. "Voice": "zhimi_emo",
    117. "Effects": [{
    118. "Type": "AI_ASR",
    119. "Font": "KaiTi",
    120. "Spacing": 2,
    121. "Alignment": "TopCenter",
    122. "Y": 0.65,
    123. "FontSize": 70,
    124. "AdaptMode": "AutoWrap",
    125. "EffectColorStyle": "CS0001-000014"
    126. }],
    127. "ClipId": "speech_2"
    128. },
    129. {
    130. "Type": "AI_TTS",
    131. "Content": "这里有香喷喷的烤羊肉串!",
    132. "Voice": "zhimi_emo",
    133. "Effects": [{
    134. "Type": "AI_ASR",
    135. "Font": "KaiTi",
    136. "Spacing": 2,
    137. "Alignment": "TopCenter",
    138. "Y": 0.65,
    139. "FontSize": 70,
    140. "AdaptMode": "AutoWrap",
    141. "EffectColorStyle": "CS0001-000014"
    142. }],
    143. "ClipId": "speech_3"
    144. },
    145. {
    146. "Type": "AI_TTS",
    147. "Content": "这里有无比鲜嫩的大鱿鱼!",
    148. "Voice": "zhimi_emo",
    149. "Effects": [{
    150. "Type": "AI_ASR",
    151. "Font": "KaiTi",
    152. "Spacing": 2,
    153. "Alignment": "TopCenter",
    154. "Y": 0.65,
    155. "FontSize": 70,
    156. "AdaptMode": "AutoWrap",
    157. "EffectColorStyle": "CS0001-000014"
    158. }],
    159. "ClipId": "speech_4"
    160. },
    161. {
    162. "Type": "AI_TTS",
    163. "Content": "还有各种新鲜蔬菜等你来品尝~",
    164. "Voice": "zhimi_emo",
    165. "Effects": [{
    166. "Type": "AI_ASR",
    167. "Font": "KaiTi",
    168. "Spacing": 2,
    169. "Alignment": "TopCenter",
    170. "Y": 0.65,
    171. "FontSize": 70,
    172. "AdaptMode": "AutoWrap",
    173. "EffectColorStyle": "CS0001-000014"
    174. }],
    175. "ClipId": "speech_5"
    176. }
    177. ]
    178. }],
    179. "SubtitleTracks": [{
    180. "SubtitleTrackClips": [{
    181. "Comment": "主标题",
    182. "Type": "Text",
    183. "Y": 0.05,
    184. "FontSize": 200,
    185. "Content": "阿云美食城",
    186. "FontColor": "#CFFAFF",
    187. "SizeRequestType": "Nominal",
    188. "AdaptMode": "AutoScale",
    189. "Spacing": 2,
    190. "Alignment": "TopCenter",
    191. "EffectColorStyle": "CS0002-000003"
    192. },
    193. {
    194. "Comment": "副标题",
    195. "Type": "Text",
    196. "Y": 0.2,
    197. "FontSize": 100,
    198. "Content": "味蕾盛宴",
    199. "FontColor": "#CFFAFF",
    200. "SizeRequestType": "Nominal",
    201. "AdaptMode": "AutoScale",
    202. "Spacing": 2,
    203. "Alignment": "TopCenter",
    204. "EffectColorStyle": "CS0002-000011"
    205. }
    206. ]
    207. }]
    208. }

    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参数解析:

    1. {
    2. "Type": "Text",
    3. "FontSize": 130,
    4. "Content": "阿里云剪辑",
    5. "Spacing": 2,
    6. "Alignment": "TopCenter",
    7. "Font": "HappyZcool-2016",
    8. "FontColor": "#ffffff",
    9. "SubtitleEffects": [{
    10. "Color": "#c6f295",
    11. "Type": "Outline",
    12. "Blur": 0.0,
    13. "XBord": 0.16,
    14. "YBord": 0.16,
    15. "XShift": 0.0,
    16. "YShift": 0.0,
    17. "Opacity": 1.0
    18. }, {
    19. "Color": "#99dda3",
    20. "Type": "Outline",
    21. "Blur": 0.0,
    22. "XBord": 0.12,
    23. "YBord": 0.12,
    24. "XShift": 0.0,
    25. "YShift": 0.0,
    26. "Opacity": 1.0
    27. }, {
    28. "Color": "#66c19c",
    29. "Type": "Outline",
    30. "Blur": 0.0,
    31. "XBord": 0.08,
    32. "YBord": 0.08,
    33. "XShift": 0.0,
    34. "YShift": 0.0,
    35. "Opacity": 1.0
    36. }, {
    37. "Color": "#138b8a",
    38. "Type": "Outline",
    39. "Blur": 0.0,
    40. "XBord": 0.04,
    41. "YBord": 0.04,
    42. "XShift": 0.0,
    43. "YShift": 0.0,
    44. "Opacity": 1.0
    45. }]
    46. }

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

    CS0002-000015花字

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

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

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

    CS0002-000015花字SubtitleTrackClips参数解析:

    1. {
    2. "Type": "Text",
    3. "FontSize": 130,
    4. "Content": "阿里云剪辑",
    5. "Y": 0.3,
    6. "Spacing": 2,
    7. "SizeRequestType": "Nominal",
    8. "Alignment": "TopCenter",
    9. "Font": "HappyZcool-2016",
    10. "FontColor": "#00e6ff",
    11. "FontColorOpacity": 0.5607843137254902,
    12. "SubtitleEffects": [{
    13. "Color": "#1be6ff",
    14. "Type": "Shadow",
    15. "Blur": 0.14,
    16. "XBord": 0.02,
    17. "YBord": 0.02,
    18. "XShift": 0.04,
    19. "YShift": 0.04,
    20. "Opacity": 1.0
    21. },
    22. {
    23. "Color": "#008c9e",
    24. "Type": "Shadow",
    25. "Blur": 0.0,
    26. "XBord": 0.04,
    27. "YBord": 0.04,
    28. "XShift": 0.04,
    29. "YShift": 0.04,
    30. "Opacity": 1.0
    31. },
    32. {
    33. "Color": "#29e6ff",
    34. "Type": "Outline",
    35. "Blur": 0.0,
    36. "XBord": 0.02,
    37. "YBord": 0.02,
    38. "XShift": 0.04,
    39. "YShift": 0.04,
    40. "Opacity": 1.0
    41. },
    42. {
    43. "Color": "#ffffff",
    44. "Type": "Outline",
    45. "Blur": 0.0,
    46. "XBord": 0.02,
    47. "YBord": 0.02,
    48. "XShift": 0.0,
    49. "YShift": 0.0,
    50. "Opacity": 1.0
    51. }
    52. ]
    53. }

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

    自定义花字营销视频Timeline:

    1. {
    2. "VideoTracks": [{
    3. "VideoTrackClips": [{
    4. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/cover.jpg",
    5. "Width": 1,
    6. "Height": 1,
    7. "Type": "Image",
    8. "AdaptMode": "Cover",
    9. "ReferenceClipId": "speech_1",
    10. "Effects": [{
    11. "Type": "Text",
    12. "Content": "朋友聚餐",
    13. "Y": 0.5,
    14. "FontSize": 100,
    15. "Angle": "30",
    16. "Alignment": "TopCenter",
    17. "FontColor": "#FDC219",
    18. "FontURL": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/AliHYAiHei.ttf",
    19. "SubtitleEffects": [{
    20. "Type": "Outline",
    21. "Bord": 0.06,
    22. "Color": "#FDFDFD"
    23. },
    24. {
    25. "Type": "Outline",
    26. "Bord": 0.02,
    27. "Color": "#040404"
    28. }
    29. ]
    30. },
    31. {
    32. "Type": "Text",
    33. "Content": "同学聚会",
    34. "Y": 0.6,
    35. "FontSize": 100,
    36. "Angle": "30",
    37. "Alignment": "TopCenter",
    38. "FontColor": "#FDC219",
    39. "FontURL": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/AliHYAiHei.ttf",
    40. "SubtitleEffects": [{
    41. "Type": "Outline",
    42. "Bord": 0.06,
    43. "Color": "#FDFDFD"
    44. },
    45. {
    46. "Type": "Outline",
    47. "Bord": 0.02,
    48. "Color": "#040404"
    49. }
    50. ]
    51. },
    52. {
    53. "Type": "Text",
    54. "Content": "家人团聚",
    55. "Y": 0.7,
    56. "FontSize": 100,
    57. "Angle": "30",
    58. "Alignment": "TopCenter",
    59. "FontColor": "#FDC219",
    60. "FontURL": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/AliHYAiHei.ttf",
    61. "SubtitleEffects": [{
    62. "Type": "Outline",
    63. "Bord": 0.06,
    64. "Color": "#FDFDFD"
    65. },
    66. {
    67. "Type": "Outline",
    68. "Bord": 0.02,
    69. "Color": "#040404"
    70. }
    71. ]
    72. },
    73. {
    74. "Type": "Text",
    75. "Content": "同事团建",
    76. "Y": 0.8,
    77. "FontSize": 100,
    78. "Angle": "30",
    79. "Alignment": "TopCenter",
    80. "FontColor": "#FDC219",
    81. "FontURL": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/AliHYAiHei.ttf",
    82. "SubtitleEffects": [{
    83. "Type": "Outline",
    84. "Bord": 0.06,
    85. "Color": "#FDFDFD"
    86. },
    87. {
    88. "Type": "Outline",
    89. "Bord": 0.02,
    90. "Color": "#040404"
    91. }
    92. ]
    93. }
    94. ]
    95. },
    96. {
    97. "Comment": "火锅",
    98. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%81%AB%E9%94%85.mp4",
    99. "Y": 0.3,
    100. "Width": 1080,
    101. "Height": 608,
    102. "AdaptMode": "Cover",
    103. "Effects": [{
    104. "Type": "Background",
    105. "SubType": "Blur",
    106. "Radius": 0.1
    107. }],
    108. "ReferenceClipId": "speech_2"
    109. },
    110. {
    111. "Comment": "烤羊肉串",
    112. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%83%A4%E7%BE%8A%E8%82%89%E4%B8%B2.mp4",
    113. "Y": 0.3,
    114. "Width": 1080,
    115. "Height": 608,
    116. "AdaptMode": "Cover",
    117. "Effects": [{
    118. "Type": "Background",
    119. "SubType": "Blur",
    120. "Radius": 0.1
    121. }],
    122. "ReferenceClipId": "speech_3"
    123. },
    124. {
    125. "Comment": "大鱿鱼",
    126. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E7%83%A4%E9%B1%BF%E9%B1%BC.mp4",
    127. "Y": 0.3,
    128. "Width": 1080,
    129. "Height": 608,
    130. "AdaptMode": "Cover",
    131. "Effects": [{
    132. "Type": "Background",
    133. "SubType": "Blur",
    134. "Radius": 0.1
    135. }],
    136. "ReferenceClipId": "speech_4"
    137. },
    138. {
    139. "Comment": "新鲜蔬菜",
    140. "MediaUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/%E8%94%AC%E8%8F%9C.mp4",
    141. "Y": 0.3,
    142. "Width": 1080,
    143. "Height": 608,
    144. "AdaptMode": "Cover",
    145. "Effects": [{
    146. "Type": "Background",
    147. "SubType": "Blur",
    148. "Radius": 0.1
    149. }],
    150. "ReferenceClipId": "speech_5"
    151. }
    152. ]
    153. }],
    154. "AudioTracks": [{
    155. "AudioTrackClips": [{
    156. "Type": "AI_TTS",
    157. "Content": "周末就来阿云美食城吧",
    158. "Voice": "zhimi_emo",
    159. "ClipId": "speech_1"
    160. },
    161. {
    162. "Type": "AI_TTS",
    163. "Content": "这里有入口醇香的老北京火锅!",
    164. "Voice": "zhimi_emo",
    165. "Effects": [{
    166. "Type": "AI_ASR",
    167. "Font": "KaiTi",
    168. "Spacing": 2,
    169. "Alignment": "TopCenter",
    170. "Y": 0.65,
    171. "FontSize": 70,
    172. "AdaptMode": "AutoWrap",
    173. "FontColor": "#FFFFFF",
    174. "SubtitleEffects": [{
    175. "Color": "#0420B6",
    176. "Type": "Shadow",
    177. "XBord": 0.07,
    178. "YBord": 0.07,
    179. "YShift": 0.06
    180. },
    181. {
    182. "Color": "#F2213F",
    183. "Type": "Shadow",
    184. "XBord": 0.07,
    185. "YBord": 0.07,
    186. "YShift": 0.03
    187. },
    188. {
    189. "Color": "#000000",
    190. "Type": "Shadow",
    191. "XShift": 0.01,
    192. "YShift": 0.01
    193. },
    194. {
    195. "Color": "#000000",
    196. "Type": "Outline",
    197. "XBord": 0.01,
    198. "YBord": 0.01
    199. }
    200. ]
    201. }],
    202. "ClipId": "speech_2"
    203. },
    204. {
    205. "Type": "AI_TTS",
    206. "Content": "这里有香喷喷的烤羊肉串!",
    207. "Voice": "zhimi_emo",
    208. "Effects": [{
    209. "Type": "AI_ASR",
    210. "Font": "KaiTi",
    211. "Spacing": 2,
    212. "Alignment": "TopCenter",
    213. "Y": 0.65,
    214. "FontSize": 70,
    215. "AdaptMode": "AutoWrap",
    216. "FontColor": "#FFFFFF",
    217. "SubtitleEffects": [{
    218. "Color": "#0420B6",
    219. "Type": "Shadow",
    220. "XBord": 0.07,
    221. "YBord": 0.07,
    222. "YShift": 0.06
    223. },
    224. {
    225. "Color": "#F2213F",
    226. "Type": "Shadow",
    227. "XBord": 0.07,
    228. "YBord": 0.07,
    229. "YShift": 0.03
    230. },
    231. {
    232. "Color": "#000000",
    233. "Type": "Shadow",
    234. "XShift": 0.01,
    235. "YShift": 0.01
    236. },
    237. {
    238. "Color": "#000000",
    239. "Type": "Outline",
    240. "XBord": 0.01,
    241. "YBord": 0.01
    242. }
    243. ]
    244. }],
    245. "ClipId": "speech_3"
    246. },
    247. {
    248. "Type": "AI_TTS",
    249. "Content": "这里有无比鲜嫩的大鱿鱼!",
    250. "Voice": "zhimi_emo",
    251. "Effects": [{
    252. "Type": "AI_ASR",
    253. "Font": "KaiTi",
    254. "Spacing": 2,
    255. "Alignment": "TopCenter",
    256. "Y": 0.65,
    257. "FontSize": 70,
    258. "AdaptMode": "AutoWrap",
    259. "FontColor": "#FFFFFF",
    260. "SubtitleEffects": [{
    261. "Color": "#0420B6",
    262. "Type": "Shadow",
    263. "XBord": 0.07,
    264. "YBord": 0.07,
    265. "YShift": 0.06
    266. },
    267. {
    268. "Color": "#F2213F",
    269. "Type": "Shadow",
    270. "XBord": 0.07,
    271. "YBord": 0.07,
    272. "YShift": 0.03
    273. },
    274. {
    275. "Color": "#000000",
    276. "Type": "Shadow",
    277. "XShift": 0.01,
    278. "YShift": 0.01
    279. },
    280. {
    281. "Color": "#000000",
    282. "Type": "Outline",
    283. "XBord": 0.01,
    284. "YBord": 0.01
    285. }
    286. ]
    287. }],
    288. "ClipId": "speech_4"
    289. },
    290. {
    291. "Type": "AI_TTS",
    292. "Content": "还有各种新鲜蔬菜等你来品尝~",
    293. "Voice": "zhimi_emo",
    294. "Effects": [{
    295. "Type": "AI_ASR",
    296. "Font": "KaiTi",
    297. "Spacing": 2,
    298. "Alignment": "TopCenter",
    299. "Y": 0.65,
    300. "FontSize": 70,
    301. "AdaptMode": "AutoWrap",
    302. "FontColor": "#FFFFFF",
    303. "SubtitleEffects": [{
    304. "Color": "#0420B6",
    305. "Type": "Shadow",
    306. "XBord": 0.07,
    307. "YBord": 0.07,
    308. "YShift": 0.06
    309. },
    310. {
    311. "Color": "#F2213F",
    312. "Type": "Shadow",
    313. "XBord": 0.07,
    314. "YBord": 0.07,
    315. "YShift": 0.03
    316. },
    317. {
    318. "Color": "#000000",
    319. "Type": "Shadow",
    320. "XShift": 0.01,
    321. "YShift": 0.01
    322. },
    323. {
    324. "Color": "#000000",
    325. "Type": "Outline",
    326. "XBord": 0.01,
    327. "YBord": 0.01
    328. }
    329. ]
    330. }],
    331. "ClipId": "speech_5"
    332. }
    333. ]
    334. }],
    335. "SubtitleTracks": [{
    336. "SubtitleTrackClips": [{
    337. "Comment": "主标题",
    338. "Type": "Text",
    339. "Y": 0.05,
    340. "FontSize": 200,
    341. "Content": "阿云美食城",
    342. "Spacing": 2,
    343. "SizeRequestType": "Nominal",
    344. "Alignment": "TopCenter",
    345. "Font": "HappyZcool-2016",
    346. "FontColor": "#F688AA",
    347. "SubtitleEffects": [{
    348. "Color": "#F688AA",
    349. "Type": "Shadow",
    350. "Blur": 0.30,
    351. "XBord": 0.15,
    352. "YBord": 0.15
    353. },
    354. {
    355. "Color": "#FFFFA0",
    356. "Type": "Shadow",
    357. "Blur": 0.08,
    358. "XBord": 0.08,
    359. "YBord": 0.08
    360. },
    361. {
    362. "Color": "#A33952",
    363. "Type": "Shadow",
    364. "XBord": 0,
    365. "YBord": 0,
    366. "XShift": 0.04,
    367. "Opacity": 1.0
    368. },
    369. {
    370. "Color": "#F5D2CC",
    371. "Type": "Shadow",
    372. "XBord": 0,
    373. "YBord": 0,
    374. "XShift": -0.04,
    375. "Opacity": 1.0
    376. }
    377. ]
    378. },
    379. {
    380. "Comment": "副标题",
    381. "Type": "Text",
    382. "Y": 0.2,
    383. "FontSize": 100,
    384. "Content": "味蕾盛宴",
    385. "SizeRequestType": "Nominal",
    386. "Spacing": 2,
    387. "Alignment": "TopCenter",
    388. "Font": "HappyZcool-2016",
    389. "FontColor": "#F9FAFA",
    390. "SubtitleEffects": [{
    391. "Color": "#F4DF50",
    392. "Type": "Shadow",
    393. "Blur": 15,
    394. "XBord": 7,
    395. "YBord": 7
    396. },
    397. {
    398. "Color": "#464120",
    399. "Type": "Outline",
    400. "XBord": 2,
    401. "YBord": 2
    402. }
    403. ]
    404. }
    405. ]
    406. }]
    407. }

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

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

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

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

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

  • 相关阅读:
    【计算思维题】少儿编程 蓝桥杯青少组计算思维 数学逻辑思维真题详细解析第8套
    js面试题,传入的数字倒序输出,倒序后是正常的数字(前面是0 的去除),求两个反转后数字的和的反转值
    小 A 的卡牌游戏(Gym - 103186B)
    高考真的有那么重要吗?
    c++ 高阶函数 numeric库
    [附源码]计算机毕业设计JAVAjsp-线上摄影平台系统
    小小一款代码编辑器竟然也可以有程序运行之功能——Sublime Text3运行各种语言程序的总结
    【逆向】(c++)分析pe结构,拉伸pe结构,缩小pe结构
    在NestJS应用程序中使用 Unleash 实现功能切换的指南
    矿区安全检查VR模拟仿真培训系统更全面、生动有效
  • 原文地址:https://blog.csdn.net/VideoCloudTech/article/details/133298607