日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

字幕及字幕模板

本文為您介紹如何修改SubmitMediaProducingJobTimeline參數(shù)完成字幕及字幕模板處理。

使用說明

  • 智能生產(chǎn)制作支持直播流、點播和OSS素材文件的剪輯合成、特效渲染、模板生產(chǎn)等功能,更多詳情請參見智能生產(chǎn)制作概述

  • 將一個或多個視頻、音頻、圖片、字幕素材合成為成品,可以通過不同的Timeline參數(shù)配置提交剪輯,然后調(diào)用SubmitMediaProducingJob - 提交剪輯合成作業(yè)來完成合成。

  • 時間線是將素材按照視頻創(chuàng)意進行編排和特效設計的產(chǎn)物,時間線主要包含軌道、素材、效果3種對象,詳情請參見Timeline配置說明。

  • 如果您想通過調(diào)用SDK進行音視頻剪輯,請參見安裝IMS服務端SDK的準備工作

視頻添加字幕

說明
  1. 字幕可以放在單獨的字幕軌道SubtitleTracks中,也可以在視頻Effects下設置字幕。

  2. 字幕的出場和入場時間可以通過TimelineIn和TimelineOut進行設置。如果不設置這兩個參數(shù),字幕軌道中的字幕將默認按照整個成片視頻的時長生成。而在Effects下的字幕,則會默認按照當前Effects歸屬的視頻素材的時間來生成。

  3. 字幕中可以使用\N或\n來實現(xiàn)字幕換行效果。

成片效果

Timeline示例

{
	"VideoTracks": [{
		"VideoTrackClips": [{
			"MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
			"Effects": [{
				"Type": "Background",
				"SubType": "Blur",
				"Radius": 0.1
			}]
		}]
	}],
	"SubtitleTracks": [{
		"SubtitleTrackClips": [{
			"Type": "Text",
			"X": 0,
			"Y": 200,
			"Content": "這里是標題",
			"Alignment": "TopCenter",
			"FontSize": 80,
			"FontColorOpacity": 1,
			"EffectColorStyle": "CS0003-000011",
			"FontFace": {
				"Bold": true
			}
		}, {
			"Type": "Text",
			"X": 0,
			"Y": 320,
			"Font": "KaiTi",
			"Content": "這里是副標題",
			"Alignment": "TopCenter",
			"FontSize": 45,
			"FontColor": "#ffffff",
			"FontFace": {
				"Italic": true,
				"Underline": true
			}
		}, {
			"Type": "Text",
			"X": 50,
			"Y": 740,
			"Font": "AlibabaPuHuiTi",
			"Content": "角度旋轉(zhuǎn)",
			"FontColor": "#FFD700",
			"Outline": 4,
			"Angle": 350,
			"OutlineColour": "#000000",
			"FontSize": 60,
			"FontFace": {
				"Bold": true
			}
		}, {
			"Type": "Text",
			"X": 0,
			"Y": 900,
			"Font": "AlibabaPuHuiTi",
			"Content": "這里是橫幅字幕\n可以加換行符進行多行展示",
			"Outline": 1,
			"OutlineColour": "000000",
			"Alignment": "TopCenter",
			"FontSize": 40,
			"FontColor": "#ffffff",
			"FontFace": {
				"Bold": true,
				"Italic": false,
				"Underline": false
			}
		}, {
			"Type": "Text",
			"X": 0,
			"Y": 1000,
			"Font": "KaiTi",
			"Content": "設置字幕出入場時間",
			"Alignment": "TopCenter",
			"FontSize": 40,
			"FontColor": "#ffffff",
			"TimelineIn": 5,
			"TimelineOut": 25,
			"FontFace": {
				"Bold": false,
				"Italic": true,
				"Underline": false
			}
		}]
	}]
}

設置字號、字體、自定義字體、描邊、陰影、字幕旋轉(zhuǎn)角度

說明
  1. FontSize表示字幕的字號。如果使用Effects下的字幕,建議使用FixedFontSize來設置字號,這樣字幕不會隨著視頻尺寸的變化而發(fā)生變化。

  2. 使用Font來指定系統(tǒng)字體,使用FontURL來指定自定義字體OSS文件路徑。當兩者同時設置時,系統(tǒng)將優(yōu)先按照FontURL來渲染字幕。

  3. 可以利用Outline、OutlineColour、Shadow、BackColour等參數(shù)來生成簡單的單層描邊陰影效果。如果需要實現(xiàn)復雜的多層描邊效果,可以參考示例3中有關(guān)自定義花字的示例。

  4. 設置Angle來調(diào)整字幕逆時針旋轉(zhuǎn)角度。

成片效果

Timeline示例

{
  "VideoTracks": [
    {
      "VideoTrackClips": [
        {
          "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
          "Effects": [
            {
              "Type": "Background",
              "SubType": "Blur",
              "Radius": 0.1
            }
          ]
        }
      ]
    }
  ],
  "SubtitleTracks": [
    {
      "SubtitleTrackClips": [
        {
          "Type": "Text",
          "X": 0,
          "Y": 200,
          "Content": "主標題80號字",
          "Alignment": "TopCenter",
          "FontSize": 80,
          "FontColorOpacity": 1,
          "EffectColorStyle": "CS0003-000023",
          "FontFace": {
            "Bold": true
          }
        },
        {
          "Type": "Text",
          "X": 0,
          "Y": 320,
          "Font": "KaiTi",
          "Content": "副標題楷體",
          "Alignment": "TopCenter",
          "FontSize": 45,
          "FontColor": "#ffffff",
          "FontFace": {
            "Italic": true,
            "Underline": true
          }
        },
        {
          "Type": "Text",
          "X": 50,
          "Y": 740,
          "Font": "AlibabaPuHuiTi",
          "Content": "角度旋轉(zhuǎn)",
          "FontColor": "#FFD700",
          "Outline": 4,
          "Angle": 350,
          "OutlineColour": "#000000",
          "FontSize": 60,
          "FontFace": {
            "Bold": true
          }
        },
        {
          "Type": "Text",
          "X": 0,
          "Y": 900,
          "Content": "這里是橫幅字幕,使用自定義字體\n設置寬度為1的黑色描邊",
          "FontUrl": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/font/fangzhengfangsong.ttf",
          "Outline": 1,
          "OutlineColour": "000000",
          "Alignment": "TopCenter",
          "FontSize": 40,
          "FontColor": "#ffffff",
          "FontFace": {
            "Bold": true,
            "Italic": false,
            "Underline": false
          }
        },
        {
          "Type": "Text",
          "X": 20,
          "Y": 20,
          "Font": "KaiTi",
          "Content": "設\n置\n字\n幕\n陰\n影",
          "Alignment": "BottomRight",
          "FontSize": 40,
          "FontColor": "#ffffff",
          "Shadow": 3,
          "BackColour": "#000000",
          "FontFace": {
            "Bold": false,
            "Italic": true,
            "Underline": false
          }
        }
      ]
    }
  ]
}

設置花字、自定義花字

說明
  1. 使用EffectColorStyleId字段來一鍵式設置花字,關(guān)于花字效果,請參考:花字效果示例

  2. 如果需要自定義字體效果,可以使用SubtitleEffects設置多層描邊和陰影效果。有關(guān)詳細字段說明,請參考SubtitleEffect部分。

成片效果

Timeline示例

{
  "VideoTracks": [
    {
      "VideoTrackClips": [
        {
          "MediaUrl": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
          "In": 0,
          "Out": 8
        }
      ]
    }
  ],
  "SubtitleTracks": [
    {
      "SubtitleTrackClips": [
        {
          "TimelineIn": 0,
          "TimelineOut": 2,
          "Type": "Text",
          "Y": 0.2,
          "Font": "WenQuanYi Zen Hei Mono",
          "Content": "云端智能剪輯",
          "Alignment": "TopCenter",
          "FontSize": 200,
          "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
            }
          ]
        },
        {
          "TimelineIn": 0,
          "TimelineOut": 2,
          "Type": "Text",
          "Y": 0.6,
          "Content": "高級花字",
          "Alignment": "TopCenter",
          "FontSize": 150,
          "EffectColorStyle": "CS0001-000011"
        },
        {
          "TimelineIn": 2,
          "TimelineOut": 5,
          "Type": "Text",
          "X": 0.1,
          "Y": 0.1,
          "Content": "系統(tǒng)花字",
          "FontSize": 150,
          "EffectColorStyle": "CS0001-000004"
        },
        {
          "TimelineIn": 2,
          "TimelineOut": 5,
          "Type": "Text",
          "X": 0.1,
          "Y": 0.3,
          "Content": "系統(tǒng)花字",
          "FontSize": 150,
          "EffectColorStyle": "CS0001-000005"
        },
        {
          "TimelineIn": 2,
          "TimelineOut": 5,
          "Type": "Text",
          "X": 0.1,
          "Y": 0.5,
          "Content": "系統(tǒng)花字",
          "FontSize": 150,
          "EffectColorStyle": "CS0001-000014"
        },
        {
          "TimelineIn": 2,
          "TimelineOut": 5,
          "Type": "Text",
          "X": 0.1,
          "Y": 0.7,
          "Content": "系統(tǒng)花字",
          "FontSize": 150,
          "EffectColorStyle": "CS0001-000007"
        },
        {
          "TimelineIn": 2,
          "TimelineOut": 5,
          "Type": "Text",
          "X": 0.6,
          "Y": 0.1,
          "Content": "系統(tǒng)花字",
          "FontSize": 150,
          "EffectColorStyle": "CS0002-000002"
        },
        {
          "TimelineIn": 2,
          "TimelineOut": 5,
          "Type": "Text",
          "X": 0.6,
          "Y": 0.3,
          "Content": "系統(tǒng)花字",
          "FontSize": 150,
          "EffectColorStyle": "CS0002-000004"
        },
        {
          "TimelineIn": 2,
          "TimelineOut": 5,
          "Type": "Text",
          "X": 0.6,
          "Y": 0.5,
          "Content": "系統(tǒng)花字",
          "FontSize": 150,
          "EffectColorStyle": "CS0002-000009"
        },
        {
          "TimelineIn": 2,
          "TimelineOut": 5,
          "Type": "Text",
          "X": 0.6,
          "Y": 0.7,
          "Content": "系統(tǒng)花字",
          "FontSize": 150,
          "EffectColorStyle": "CS0002-000016"
        },
        {
          "Comment": "增加左偏移陰影",
          "TimelineIn": 5,
          "TimelineOut": 8,
          "Type": "Text",
          "FontSize": 150,
          "Content": "自定義花字",
          "Y": 0.1,
          "Alignment": "TopCenter",
          "Font": "HappyZcool-2016",
          "FontColor": "#F688AA",
          "SubtitleEffects": [
            {
              "Color": "#F5D2CC",
              "Type": "Shadow",
              "XBord": 0,
              "YBord": 0,
              "XShift": -0.04,
              "Opacity": 1
            }
          ]
        },
        {
          "Comment": "增加右偏移陰影",
          "TimelineIn": 5,
          "TimelineOut": 8,
          "Type": "Text",
          "FontSize": 150,
          "Content": "自定義花字",
          "Y": 0.3,
          "Alignment": "TopCenter",
          "Font": "HappyZcool-2016",
          "FontColor": "#F688AA",
          "SubtitleEffects": [
            {
              "Color": "#A33952",
              "Type": "Shadow",
              "XBord": 0,
              "YBord": 0,
              "XShift": 0.04,
              "Opacity": 1
            },
            {
              "Color": "#F5D2CC",
              "Type": "Shadow",
              "XBord": 0,
              "YBord": 0,
              "XShift": -0.04,
              "Opacity": 1
            }
          ]
        },
        {
          "Comment": "增加第一層發(fā)光",
          "TimelineIn": 5,
          "TimelineOut": 8,
          "Type": "Text",
          "FontSize": 150,
          "Content": "自定義花字",
          "Y": 0.5,
          "Alignment": "TopCenter",
          "Font": "HappyZcool-2016",
          "FontColor": "#F688AA",
          "SubtitleEffects": [
            {
              "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
            },
            {
              "Color": "#F5D2CC",
              "Type": "Shadow",
              "XBord": 0,
              "YBord": 0,
              "XShift": -0.04,
              "Opacity": 1
            }
          ]
        },
        {
          "Comment": "增加第二層發(fā)光",
          "TimelineIn": 5,
          "TimelineOut": 8,
          "Type": "Text",
          "FontSize": 150,
          "Content": "自定義花字",
          "Y": 0.7,
          "Alignment": "TopCenter",
          "Font": "HappyZcool-2016",
          "FontColor": "#F688AA",
          "SubtitleEffects": [
            {
              "Color": "#F688AA",
              "Type": "Shadow",
              "Blur": 0.3,
              "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
            },
            {
              "Color": "#F5D2CC",
              "Type": "Shadow",
              "XBord": 0,
              "YBord": 0,
              "XShift": -0.04,
              "Opacity": 1
            }
          ]
        }
      ]
    }
  ]
}

字幕局部效果

說明

通過在Content字段中添加覆寫代碼,可以實現(xiàn)字幕的局部效果。下面是覆寫代碼的說明:

  • 所有覆寫代碼均以兩個反斜杠(\\)開頭。

  • 所有局部參數(shù)覆寫代碼必須在{}中,且一個{}可以包含多個覆寫代碼。

  • 覆寫代碼會作用于其后的字幕上,如果想要結(jié)束該覆寫代碼,需要加一個與之對應的結(jié)束覆寫代碼來取消該效果。

覆寫參數(shù)詳細說明:

覆寫參數(shù)

描述

Content參數(shù)示例

  • \\1c&[BBGGRR]&

  • \\2c&[BBGGRR]&

  • \\3c&[BBGGRR]&

  • 1c、2c、3c分別為字體、邊框、陰影對應的顏色。

  • [BBGGRR]表示的是十六進制顏色的BGR值,其顏色順序與一般的RGB相反。

"這里設置{\\1c&00FF7F&}綠{\\1c}色"

  • \\bord[寬度]

  • \\xbord[寬度]

  • \\ybord[寬度]

bord、xbord、ybord分別表示邊框、沿X軸邊框和沿Y軸邊框的寬度,單位為像素。

"這里設置{\\bord3\\3c&EBCE87&}描邊寬度{\\bord\\3c}顏色和大小"

\\b1 \\b0

b1為加粗,b0為取消加粗。

"這里設置{\\b1}加粗{\\b0}效果",

\\i1 \\i0

i1為斜體,i0為取消斜體。

"這里設置{\\i1}斜體{\\i0}效果"

\\u1 \\u0

u1為加下劃線,u0為取消下劃線。

"這里設置{\\u1}下劃線{\\u0}效果"

\\s1 \\s0

s1為添加文本刪除線,s0為取消刪除線。

"這里設置{\\s1}刪除線{\\s0}效果"

\\fs[字體尺寸]

字幕大小,單位為像素。

"這里設置{\\fs100}100號{\\fs}文字"

\\fn[字體名稱]

字幕名稱,暫不支持設置自定義字體。

"這里設置{\\fnKaiTi}黑體{\\fn}字體"

成片效果

Timeline示例

{
  "VideoTracks": [
    {
      "VideoTrackClips": [
        {
          "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4"
        }
      ]
    }
  ],
  "SubtitleTracks": [
    {
      "SubtitleTrackClips": [
        {
          "Type": "Text",
          "X": 0,
          "Y": 150,
          "Font": "FZKai-Z03S",
          "Content": "這里設置{\\1c&0801ea&\\3c&f7fcff&}深紅色{\\1c\\3c}",
          "Alignment": "TopCenter",
          "FontSize": 65,
          "FontColor": "#F5FFFA",
          "TimelineIn": 0,
          "TimelineOut": 10,
          "Outline": 2,
          "OutlineColour": "#0e0100"
        },
        {
          "Type": "Text",
          "X": 0,
          "Y": 300,
          "Font": "FZKai-Z03S",
          "Content": "這里設置{\\fs100}100號{\\fs}字體",
          "Alignment": "TopCenter",
          "FontColor": "#F5FFFA",
          "FontSize": 65,
          "TimelineIn": 0,
          "TimelineOut": 10,
          "Outline": 2,
          "OutlineColour": "#0e0100"
        },
        {
          "Type": "Text",
          "Y": 450,
          "Font": "FZKai-Z03S",
          "Content": "這里設置{\\bord3\\3c&CD0000&}描邊{\\bord\\3c}顏色和大小",
          "Alignment": "TopCenter",
          "FontSize": 65,
          "FontColor": "#F5FFFA",
          "TimelineIn": 0,
          "TimelineOut": 10,
          "Outline": 2,
          "OutlineColour": "#0e0100"
        },
        {
          "Type": "Text",
          "Y": 600,
          "Content": "這里設置{\\bord3\\3c&701919&}不透明背景{\\bord\\3c}顏色和大小",
          "Comment": "不透明背景必須設置 BoderStyle = 3 "
          "Font": "FZKai-Z03S",
          "FontSize": 65,
          "TimelineIn": 0,
          "TimelineOut": 10,
          "Alignment": "TopCenter",
          "FontColor": "#F5FFFA",
          "BorderStyle": 3,
          "Outline": 0,
          "OutlineColour": "#0000CD"
        },
        {
          "Type": "Text",
          "Y": 750,
          "Font": "FZKai-Z03S",
          "Content": "這里設置{\\fnKaiTi}楷體{\\fn}字體",
          "FontSize": 65,
          "TimelineIn": 0,
          "TimelineOut": 10,
          "FontColor": "#F5FFFA",
          "Alignment": "TopCenter",
          "Outline": 2,
          "OutlineColour": "#0e0100"
        },
        {
          "Type": "Text",
          "Y": 900,
          "Font": "FZKai-Z03S",
          "Content": "這里設置{\\b1}加粗{\\b0}效果",
          "FontSize": 65,
          "TimelineIn": 0,
          "TimelineOut": 10,
          "FontColor": "#F5FFFA",
          "Alignment": "TopCenter",
          "Outline": 2,
          "OutlineColour": "#0e0100"
        },
        {
          "Type": "Text",
          "Y": 1050,
          "Font": "FZKai-Z03S",
          "Content": "這里設置{\\i1}斜體{\\i0}效果",
          "FontSize": 65,
          "TimelineIn": 0,
          "TimelineOut": 10,
          "FontColor": "#F5FFFA",
          "Alignment": "TopCenter",
          "Outline": 2,
          "OutlineColour": "#0e0100"
        },
        {
          "Type": "Text",
          "Y": 1200,
          "Font": "FZKai-Z03S",
          "Content": "這里設置{\\u1}下劃線{\\u0}效果",
          "FontColor": "#F5FFFA",
          "FontSize": 65,
          "TimelineIn": 0,
          "TimelineOut": 10,
          "Alignment": "TopCenter",
          "Outline": 2,
          "OutlineColour": "#0e0100"
        },
        {
          "Type": "Text",
          "Y": 1350,
          "Font": "FZKai-Z03S",
          "Content": "這里設置{\\s1}刪除線{\\s0}效果",
          "FontColor": "#F5FFFA",
          "FontSize": 65,
          "TimelineIn": 0,
          "TimelineOut": 10,
          "Alignment": "TopCenter",
          "Outline": 2,
          "OutlineColour": "#0e0100"
        },
        {
          "Type": "Text",
          "Y": 1500,
          "Font": "FZKai-Z03S",
          "Content": "這里設置{\\1c&00FF00&\\b1\\fs100\\i1}組合{\\1c\\b0\\fs\\i0}效果",
          "FontColor": "#F5FFFA",
          "FontSize": 65,
          "TimelineIn": 0,
          "TimelineOut": 10,
          "Alignment": "TopCenter",
          "Outline": 2,
          "OutlineColour": "#0e0100"
        }
      ]
    }
  ]
}

字幕自動換行

說明
  1. 設置字幕的"AdaptMode"為"AutoWrap",可以實現(xiàn)在字幕超出畫布范圍時自動換行,以保證字幕內(nèi)容完全顯示出來。同時可以通過設置TextWidth,支持絕對像素和按照畫布百分比來換行,以確保文字在指定寬度范圍內(nèi)進行換行。

  2. 在英文等場景下,只允許在空格位置換行時,可以設置"AdaptMode": "AutoWrapAtSpaces",以確保字幕換行不會出現(xiàn)在英文單詞的中間位置。

成片效果

Timeline示例

{
  "VideoTracks": [
    {
      "VideoTrackClips": [
        {
          "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4"
        }
      ]
    }
  ],
  "SubtitleTracks": [
    {
      "SubtitleTrackClips": [
        {
          "Type": "Text",
          "X": 0,
          "Y": 200,
          "Font": "FZKai-Z03S",
          "Content": "當不設置字幕自動換行時,字幕過長會超出視頻畫布",
          "Alignment": "TopCenter",
          "FontSize": 70,
          "FontColor": "#F5FFFA",
          "Outline": 2,
          "OutlineColour": "#0e0100"
        },
        {
          "Type": "Text",
          "X": 0,
          "Y": 600,
          "Font": "FZKai-Z03S",
          "Content": "當字幕超出視頻畫布寬度時觸發(fā)自動換行",
          "AdaptMode": "AutoWrap",
          "Alignment": "TopCenter",
          "FontSize": 70,
          "FontColor": "#F5FFFA",
          "Outline": 2,
          "OutlineColour": "#0e0100"
        },
        {
          "Type": "Text",
          "X": 0,
          "Y": 1000,
          "Font": "FZKai-Z03S",
          "Content": "設置TextWidth在指定區(qū)間內(nèi)自動換行",
          "TextWidth": 0.7,
          "AdaptMode": "AutoWrap",
          "Alignment": "TopCenter",
          "FontSize": 70,
          "FontColor": "#F5FFFA",
          "Outline": 2,
          "OutlineColour": "#0e0100"
        },
        {
          "Type": "Text",
          "X": 0,
          "Y": 1400,
          "Content": "Subtitles only automatically wrap at spaces.",
          "AdaptMode": "AutoWrapAtSpaces",
          "Alignment": "TopCenter",
          "FontSize": 70,
          "FontColor": "#F5FFFA",
          "Outline": 2,
          "OutlineColour": "#0e0100"
        }
      ]
    }
  ]
}

字幕對齊

  • 在不同的字幕對齊方式下,定位方式也會有所不同。在設置Alignment時,對齊方式和默認的定點位置如下:

    Alignment

    對齊方式

    默認位置

    TopLeft

    左對齊

    視頻左上角

    TopCenter

    居中對齊

    視頻豎直中軸線上側(cè)

    TopRight

    右對齊

    視頻右上角

    CenterLeft

    左對齊

    視頻水平中軸線左側(cè)

    CenterCenter

    居中對齊

    視頻中心位置視頻水平中軸線右側(cè)

    CenterRight

    右對齊

    視頻水平中軸線右側(cè)

    BottomLeft

    左對齊

    視頻左下角

    BottomCenter

    居中對齊

    視頻豎直中軸線下側(cè)

    BottomRight

    右對齊

    視頻右下角

  • 如果需要進行簡單的對齊和定位,可以按照以上方式進行設置。若需要在三種不同對齊方式下依然能夠精確定位字幕位置,可以設置Alignment為Left、Center、Right。字幕的定位基準點分別為:

    Alignment

    對齊方式

    定位基準點

    Left

    左對齊

    字幕文本框左上角頂點

    Center

    居中對齊

    字幕文本框上邊界中點

    Right

    右對齊

    字幕文本框右上角頂點

  • 不同Alignment時的不同定位基準點如下圖所示:

    image

成片效果

Timeline示例

{
    "VideoTracks": [
        {
            "VideoTrackClips": [
                {
                    "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4"
                }
            ]
        }
    ],
    "SubtitleTracks": [
        {
            "SubtitleTrackClips": [
                {
                    "Type": "Text",
                    "Font": "FZKai-Z03S",
                    "Content": "Alignment\nTopLeft",
                    "Alignment": "TopLeft",
                    "FontSize": 70,
                    "FontColor": "#F5FFFA",
                    "Outline": 2,
                    "OutlineColour": "#0e0100",
                    "TimelineIn": 0,
                    "TimelineOut": 4
                },
                {
                    "Type": "Text",
                    "Font": "FZKai-Z03S",
                    "Content": "Alignment\nTopCenter",
                    "Alignment": "TopCenter",
                    "FontSize": 70,
                    "FontColor": "#F5FFFA",
                    "Outline": 2,
                    "OutlineColour": "#0e0100",
                    "TimelineIn": 0,
                    "TimelineOut": 4
                },
                {
                    "Type": "Text",
                    "Font": "FZKai-Z03S",
                    "Content": "Alignment\nTopRight",
                    "Alignment": "TopRight",
                    "FontSize": 70,
                    "FontColor": "#F5FFFA",
                    "Outline": 2,
                    "OutlineColour": "#0e0100",
                    "TimelineIn": 0,
                    "TimelineOut": 4
                },
                {
                    "Type": "Text",
                    "Font": "FZKai-Z03S",
                    "Content": "Alignment\nCenterLeft",
                    "Alignment": "CenterLeft",
                    "FontSize": 70,
                    "FontColor": "#F5FFFA",
                    "Outline": 2,
                    "OutlineColour": "#0e0100",
                    "TimelineIn": 0,
                    "TimelineOut": 4
                },
                {
                    "Type": "Text",
                    "Font": "FZKai-Z03S",
                    "Content": "Alignment\nCenterCenter",
                    "Alignment": "CenterCenter",
                    "FontSize": 70,
                    "FontColor": "#F5FFFA",
                    "Outline": 2,
                    "OutlineColour": "#0e0100",
                    "TimelineIn": 0,
                    "TimelineOut": 4
                },
                {
                    "Type": "Text",
                    "Font": "FZKai-Z03S",
                    "Content": "Alignment\nCenterRight",
                    "Alignment": "CenterRight",
                    "FontSize": 70,
                    "FontColor": "#F5FFFA",
                    "Outline": 2,
                    "OutlineColour": "#0e0100",
                    "TimelineIn": 0,
                    "TimelineOut": 4
                },
                {
                    "Type": "Text",
                    "Font": "FZKai-Z03S",
                    "Content": "Alignment\nBottomLeft",
                    "Alignment": "BottomLeft",
                    "FontSize": 70,
                    "FontColor": "#F5FFFA",
                    "Outline": 2,
                    "OutlineColour": "#0e0100",
                    "TimelineIn": 0,
                    "TimelineOut": 4
                },
                {
                    "Type": "Text",
                    "Font": "FZKai-Z03S",
                    "Content": "Alignment\nBottomCenter",
                    "Alignment": "BottomCenter",
                    "FontSize": 70,
                    "FontColor": "#F5FFFA",
                    "Outline": 2,
                    "OutlineColour": "#0e0100",
                    "TimelineIn": 0,
                    "TimelineOut": 4
                },
                {
                    "Type": "Text",
                    "Font": "FZKai-Z03S",
                    "Content": "Alignment\nBottomRight",
                    "Alignment": "BottomRight",
                    "FontSize": 70,
                    "FontColor": "#F5FFFA",
                    "Outline": 2,
                    "OutlineColour": "#0e0100",
                    "TimelineIn": 0,
                    "TimelineOut": 4
                }
            ]
        },
        {
            "SubtitleTrackClips": [
                {
                    "Type": "Text",
                    "Font": "FZKai-Z03S",
                    "Content": "Alignment\nLeft",
                    "X": 100,
                    "Y": 500,
                    "Alignment": "TopLeft",
                    "FontSize": 70,
                    "FontColor": "#F5FFFA",
                    "Outline": 2,
                    "OutlineColour": "#0e0100",
                    "TimelineIn": 4,
                    "TimelineOut": 8
                },
                {
                    "Type": "Text",
                    "Font": "FZKai-Z03S",
                    "Content": "Alignment\nCenter",
                    "X": 950,
                    "Y": 500,
                    "Alignment": "Center",
                    "FontSize": 70,
                    "FontColor": "#F5FFFA",
                    "Outline": 2,
                    "OutlineColour": "#0e0100",
                    "TimelineIn": 4,
                    "TimelineOut": 8
                },
                {
                    "Type": "Text",
                    "Font": "FZKai-Z03S",
                    "X": 1820,
                    "Y": 500,
                    "Content": "Alignment\nRight",
                    "Alignment": "Right",
                    "FontSize": 70,
                    "FontColor": "#F5FFFA",
                    "Outline": 2,
                    "OutlineColour": "#0e0100",
                    "TimelineIn": 4,
                    "TimelineOut": 8
                }
            ]
        }
    ]
}

字幕特效

說明
  1. 出場入場特效可以指定出場和入場時間,而循環(huán)特效則可以設置循環(huán)速度。

  2. 出場入場特效和循環(huán)特效不可同時使用。

成片效果

Timeline示例

{
  "VideoTracks": [
    {
      "VideoTrackClips": [
        {
          "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4"
        }
      ]
    }
  ],
  "SubtitleTracks": [
    {
      "SubtitleTrackClips": [
        {
          "Type": "Text",
          "X": 0,
          "Y": 200,
          "Font": "HappyZcool-2016",
          "Content": "入場特效,入場時間2s",
          "Alignment": "TopCenter",
          "FontSize": 70,
          "FontColor": "#F5FFFA",
          "Outline": 2,
          "OutlineColour": "#0e0100",
          "AaiMotionInEffect": "rotateflip_in",
          "AaiMotionIn": 2
        },
        {
          "Type": "Text",
          "X": 0,
          "Y": 600,
          "Font": "HappyZcool-2016",
          "Content": "出場特效,出場時間2s",
          "AdaptMode": "AutoWrap",
          "Alignment": "TopCenter",
          "FontSize": 70,
          "FontColor": "#F5FFFA",
          "Outline": 2,
          "OutlineColour": "#0e0100",
          "AaiMotionOutEffect": "slide_down_out",
          "AaiMotionOut": 2
        },
        {
          "Type": "Text",
          "X": 0,
          "Y": 1000,
          "Font": "HappyZcool-2016",
          "Content": "循環(huán)特效,循環(huán)速度2倍速",
          "TextWidth": 0.7,
          "AdaptMode": "AutoWrap",
          "Alignment": "TopCenter",
          "FontSize": 70,
          "FontColor": "#F5FFFA",
          "Outline": 2,
          "OutlineColour": "#0e0100",
          "AaiMotionLoopEffect": "rainbrush_display",
          "Ratio": 2
        },
        {
          "Type": "Text",
          "X": 0,
          "Y": 1400,
          "Font": "HappyZcool-2016",
          "Content": "同時疊加出場、入場特效",
          "AdaptMode": "AutoWrapAtSpaces",
          "Alignment": "TopCenter",
          "FontSize": 70,
          "FontColor": "#F5FFFA",
          "Outline": 2,
          "OutlineColour": "#0e0100",
          "AaiMotionInEffect": "zoomin_i",
          "AaiMotionIn": 2,
          "AaiMotionOutEffect": "dissolve_out",
          "AaiMotionOut": 2
        }
      ]
    }
  ]
}

字幕背景

說明

可以利用SubtitleEffects中的Box字段來實現(xiàn)字幕純色背景效果,同時支持設置花字、換行等樣式。

成片效果

Timeline示例

{
    "VideoTracks": [
      {
        "VideoTrackClips": [
          {
            "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4"
          }
        ]
      }
    ],
    "SubtitleTracks": [
      {
        "SubtitleTrackClips": [
          {
            "Type": "Text",
            "X": 0,
            "Y": 150,
            "Font": "HappyZcool-2016",
            "Content": "設置字幕純色背景偏移量寬高\n以及圓角",
            "AdaptMode": "AutoWrap",
            "Alignment": "TopCenter",
            "FontSize": 70,
            "FontColor": "#F5FFFA",
            "SubtitleEffects": [
              {
                "Type": "Box",
                "Color": "1E90FF",
                "XShift": 20,
                "YShift": -20,
                "Bord": 20,
                "Radius": 20
              }
            ]
          }
        ]
      },
      {
        "SubtitleTrackClips": [
          {
            "Type": "Text",
            "X": 0,
            "Y": 500,
            "Font": "HappyZcool-2016",
            "Content": "設置字幕背景不透明度",
            "AdaptMode": "AutoWrap",
            "Alignment": "TopCenter",
            "FontSize": 70,
            "FontColor": "#F5FFFA",
            "SubtitleEffects": [
              {
                "Type": "Box",
                "Color": "1E90FF",
                "Opacity": "0.5",
                "Bord": 20
              }
            ]
          }
        ]
      },
      {
        "SubtitleTrackClips": [
          {
            "Type": "Text",
            "X": 0,
            "Y": 850,
            "Font": "HappyZcool-2016",
            "Content": "設置字幕換行場景下的字幕純色背景效果",
            "AdaptMode": "AutoWrap",
            "TextWidth": 0.6,
            "Alignment": "TopCenter",
            "FontSize": 70,
            "FontColor": "#F5FFFA",
            "SubtitleEffects": [
              {
                "Type": "Box",
                "Color": "1E90FF",
                "Bord": 20
              }
            ]
          }
        ]
      },
      {
        "SubtitleTrackClips": [
          {
            "Type": "Text",
            "X": 0,
            "Y": 1200,
            "Font": "HappyZcool-2016",
            "Content": "字幕純色背景同時設置花字、特效",
            "AdaptMode": "AutoWrapAtSpaces",
            "Alignment": "TopCenter",
            "FontSize": 70,
            "EffectColorStyle": "CS0003-000006",
            "AaiMotionInEffect": "zoomin_i",
            "AaiMotionIn": 2,
            "AaiMotionOutEffect": "dissolve_out",
            "AaiMotionOut": 2,
            "SubtitleEffects": [
              {
                "Type": "Box",
                "Color": "1E90FF",
                "Bord": 20
              }
            ]
          }
        ]
      },
      {
        "SubtitleTrackClips": [
          {
            "Type": "Text",
            "X": 0,
            "Y": 1550,
            "Font": "HappyZcool-2016",
            "Content": "字幕背景指定貼圖紋理\n以及圓角效果",
            "AdaptMode": "AutoWrapAtSpaces",
            "Alignment": "TopCenter",
            "FontSize": 70,
            "EffectColorStyle": "CS0003-000006",
            "AaiMotionInEffect": "zoomin_i",
            "AaiMotionIn": 2,
            "AaiMotionOutEffect": "dissolve_out",
            "AaiMotionOut": 2,
            "SubtitleEffects": [
              {
                "Type": "Box",
                "Color": "1E90FF",
                "Bord": 20,
                "Radius": 20,
                "ImageURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/subtitle_background.png"
              }
            ]
          }
        ]
      }
    ]
  }

官方氣泡字、自定義氣泡字

說明
  1. 可以使用BubbleStyleId一鍵設置氣泡的樣式Id,氣泡樣式請參見:氣泡字示例。

  2. 在氣泡字模式下,支持設置BubbleWidth和BubbleHeight來調(diào)整氣泡的寬度和高度。此外,X和Y分別表示氣泡圖片左上角相對于視頻左上角的坐標。

  3. 在SubtitleEffects中的Box樣式下,支持設置圖片來實現(xiàn)自定義氣泡字效果。需要傳入Width和Height,分別表示氣泡原始圖片的寬和高,以及TextArea文本框相對于氣泡的位置和大小。其中四個字段分別表示字幕文本框左上角坐標相對于氣泡的位置,以及字幕文本框相對于氣泡的寬高。

  4. 在使用氣泡字功能時,文字會在氣泡內(nèi)部自動換行,并自動進行縮放處理。

成片效果

Timeline示例

{
  "VideoTracks": [
    {
      "VideoTrackClips": [
        {
          "MediaUrl": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4"
        }
      ]
    }
  ],
  "SubtitleTracks": [
    {
      "SubtitleTrackClips": [
        {
          "TimelineIn": 0,
          "TimelineOut": 4,
          "Type": "Text",
          "X": 0.1,
          "Y": 0,
          "FontSize": 150,
          "BubbleHeight": 0.18,
          "Alignment": "TopCenter",
          "BubbleStyleId": "BS0001-000001"
        },
        {
          "TimelineIn": 0,
          "TimelineOut": 4,
          "Type": "Text",
          "X": 0.1,
          "Y": 0.2,
          "FontSize": 150,
          "BubbleHeight": 0.18,
          "Alignment": "TopCenter",
          "BubbleStyleId": "BS0001-000002"
        },
        {
          "TimelineIn": 0,
          "TimelineOut": 4,
          "Type": "Text",
          "X": 0.1,
          "Y": 0.4,
          "FontSize": 150,
          "BubbleHeight": 0.18,
          "Alignment": "TopCenter",
          "BubbleStyleId": "BS0001-000003"
        },
        {
          "TimelineIn": 0,
          "TimelineOut": 4,
          "Type": "Text",
          "X": 0.1,
          "Y": 0.6,
          "FontSize": 150,
          "BubbleHeight": 0.18,
          "Alignment": "TopCenter",
          "BubbleStyleId": "BS0001-000004"
        },
        {
          "TimelineIn": 0,
          "TimelineOut": 4,
          "Type": "Text",
          "X": 0.1,
          "Y": 0.8,
          "FontSize": 150,
          "BubbleHeight": 0.18,
          "Alignment": "TopCenter",
          "BubbleStyleId": "BS0001-000005"
        },
        {
          "TimelineIn": 0,
          "TimelineOut": 4,
          "Type": "Text",
          "X": 0.6,
          "Y": 0,
          "FontSize": 150,
          "BubbleHeight": 0.18,
          "Alignment": "TopCenter",
          "BubbleStyleId": "BS0002-000001"
        },
        {
          "TimelineIn": 0,
          "TimelineOut": 4,
          "Type": "Text",
          "X": 0.6,
          "Y": 0.2,
          "FontSize": 150,
          "BubbleHeight": 0.18,
          "Alignment": "TopCenter",
          "BubbleStyleId": "BS0002-000002"
        },
        {
          "TimelineIn": 0,
          "TimelineOut": 4,
          "Type": "Text",
          "X": 0.6,
          "Y": 0.4,
          "FontSize": 150,
          "BubbleHeight": 0.18,
          "Alignment": "TopCenter",
          "BubbleStyleId": "BS0002-000003"
        },
        {
          "TimelineIn": 0,
          "TimelineOut": 4,
          "Type": "Text",
          "X": 0.6,
          "Y": 0.6,
          "FontSize": 150,
          "BubbleHeight": 0.18,
          "Alignment": "TopCenter",
          "BubbleStyleId": "BS0002-000004"
        },
        {
          "TimelineIn": 0,
          "TimelineOut": 4,
          "Type": "Text",
          "X": 0.6,
          "Y": 0.8,
          "FontSize": 150,
          "BubbleHeight": 0.18,
          "Alignment": "TopCenter",
          "BubbleStyleId": "BS0002-000005"
        },
        {
          "TimelineIn": 4,
          "TimelineOut": 8,
          "Type": "Text",
          "Content": "自定義氣泡字",
          "FontColor": "#000000",
          "X": 0.1,
          "Y": 0.3,
          "BubbleWidth": 0.8,
          "Alignment": "TopCenter",
          "SubtitleEffects": [
            {
              "Type": "Box",
              "Width": 1050,
              "Height": 250,
              "TextArea": "0.1,0.2,0.8,0.6",
              "ImageURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/round_rectangle.png"
            }
          ]
        }
      ]
    }
  ]
}

字幕滾動示例

說明

您可以通過設置ScrollStartY和ScrollEndY來指定字幕滾動的起始和結(jié)束位置,同時使用ScrollSpeed參數(shù)來控制字幕滾動的速度,單位均為像素。

成片效果

Timeline示例

{
  "VideoTracks": [
    {
      "VideoTrackClips": [
        {
          "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4",
          "Effects": [
            {
              "Type": "Text",
              "TimelineIn": 0,
              "TimelineOut": 18,
              "Content": "阿里云智能媒體服務IMS是圍繞直播和點播場景下的媒體采集、媒資管理、內(nèi)容生產(chǎn)、制作和分發(fā)能力的一站式服務集,提供廣播級、全智能、靈活多樣的專業(yè)能力,并面向復雜業(yè)務流場景提供成熟的低代碼終端SDK集成方案。\n\n\n\n智能媒體服務特點如下所示:\n\n專業(yè)度高:具備廣播級、高性能、標準化的服務能力。\n\n靈活性強:不必重復授權(quán)即可跑通全鏈路,提供可視化編排的工作流,高效容錯。\n\n智能化:在采集、媒資、生產(chǎn)、處理、播放等場景中體系化的提供AI服務。\n\n多樣性:PaaS、PaaS+和SaaS的多重交付形式。",
              "FontSize": 70,
              "FontColorOpacity": 1,
              "Spacing": 0,
              "LineSpacing": 10,
              "AdaptMode": "AutoWrap",
              "X": 0.1,
              "TextWidth": 0.8,
              "EffectColorStyle": "CS0003-000010",
              "ScrollStartY": 1000,
              "ScrollSpeed": 75,
              "ScrollEndY": 192
            }
          ]
        },
        {
          "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4"
        }
      ]
    }
  ]
}

通過設置FECanvas實現(xiàn)相同F(xiàn)ontSize在不同分辨率成片下字幕顯示大小一致

說明

FontSize代表的是字幕文字高度在成片視頻中所占的像素數(shù)。在默認情況下,相同F(xiàn)ontSize在輸出到不同分辨率的視頻中時,占比往往是不一致的,比如FontSize:100時,輸出到480P的視頻字幕占比比較大,輸出到720P的視頻字幕占比比較小。如果期望使用合成到720P下的字幕FontSize,在合成到480P視頻時,字幕占比不變,可以在Timeline中設置FECanvas來實現(xiàn)該效果。

成片效果

Timeline示例

{
    "FECanvas": {
        "Height": 1280,
        "Width": 720
      },
    "VideoTracks": [
      {
        "VideoTrackClips": [
          {
            "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
            "Effects": [
              {
                "Type": "Background",
                "SubType": "Blur",
                "Radius": 0.1
              }
            ]
          }
        ]
      }
    ],
    "SubtitleTracks": [
      {
        "SubtitleTrackClips": [
          {
            "Type": "Text",
            "X": 0,
            "Y": 200,
            "Content": "主標題80號字",
            "Alignment": "TopCenter",
            "FontSize": 80,
            "FontColorOpacity": 1,
            "EffectColorStyle": "CS0003-000023",
            "FontFace": {
              "Bold": true
            }
          },
          {
            "Type": "Text",
            "X": 0,
            "Y": 320,
            "Font": "KaiTi",
            "Content": "副標題楷體",
            "Alignment": "TopCenter",
            "FontSize": 45,
            "FontColor": "#ffffff",
            "FontFace": {
              "Italic": true,
              "Underline": true
            }
          },
          {
            "Type": "Text",
            "X": 50,
            "Y": 740,
            "Font": "AlibabaPuHuiTi",
            "Content": "角度旋轉(zhuǎn)",
            "FontColor": "#FFD700",
            "Outline": 4,
            "Angle": 350,
            "OutlineColour": "#000000",
            "FontSize": 60,
            "FontFace": {
              "Bold": true
            }
          },
          {
            "Type": "Text",
            "X": 0,
            "Y": 900,
            "Content": "這里是橫幅字幕,使用自定義字體\n設置寬度為1的黑色描邊",
            "FontUrl": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/font/fangzhengfangsong.ttf",
            "Outline": 1,
            "OutlineColour": "000000",
            "Alignment": "TopCenter",
            "FontSize": 40,
            "FontColor": "#ffffff",
            "FontFace": {
              "Bold": true,
              "Italic": false,
              "Underline": false
            }
          },
          {
            "Type": "Text",
            "X": 20,
            "Y": 20,
            "Font": "KaiTi",
            "Content": "設\n置\n字\n幕\n陰\n影",
            "Alignment": "BottomRight",
            "FontSize": 40,
            "FontColor": "#ffffff",
            "Shadow": 3,
            "BackColour": "#000000",
            "FontFace": {
              "Bold": false,
              "Italic": true,
              "Underline": false
            }
          }
        ]
      }
    ]
  }