影片剪輯中生成花字特效的程式碼案例詳述

發表於2023-09-27
本文為阿里雲智慧媒體服務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=517...

歡迎加入官方答疑釘釘群諮詢交流:31783668

相關文章