タイムラインデータを使用して本番ジョブを送信する場合は、timelineパラメーターを設定する必要があります。 このトピックでは、ビデオ編集、字幕作成、およびアルバム作成用のTimelineパラメーターを設定する方法について説明します。
説明
次の例のパラメーターの詳細については、「タイムライン: オンライン編集プロジェクトのタイムラインに関する情報」をご参照ください。
ビデオ編集
中央に字幕を追加する
ビデオ上部の中央に字幕を追加するには、"Alignment": "TopCenter" を指定し、字幕テキストと画面上部の距離をYに設定します。
{
"VideoTracks": [
{
"VideoTrackClips": [
{
"MediaId": "4bcf9b4d7cf14dc7b83b0e801cbe****",
"Effects": [
{
"Type": "Text",
"X": 20,
"Y": 34,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Top Center - A timeline is created when you add materials and configure special effects to create a video. ",
"Alignment": "TopCenter",
"FontSize": 26,
"FontColorOpacity": 1,
"FontColor": "#ff0000",
"FontFace": {
"Bold": true,
"Italic": false,
"Underline": false
}
},
{
"Type": "Text",
"X": 100,
"Y": 200,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Center Center - A timeline consists of tracks, materials, and effects.",
"Alignment": "CenterCenter",
"FontSize": 26,
"FontColorOpacity": 0.8,
"FontColor": "#ff0000"
},
{
"Type": "Text",
"X": 0.10,
"Y": 0.1,
"TimelineIn": 2,
"TimelineOut": 15,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Bottom Center - A timeline is created when you add materials and configure special effects to create a video. A timeline consists of tracks, materials, and effects.",
"Alignment": "BottomCenter",
"FontSize": 26,
"FontColor": "#000000"
}
]
}
]
}
]
}アライメントの有効な値: BottomLeft、BottomCenter、BottomRight、CenterLeft、CenterCenter、CenterRight、TopLeft、TopCenter、TopRight。
AlignmentがEffectsパラメータに含まれている場合、Xは字幕テキストと画面の左側との間の距離を示し、Yは字幕テキストと画面の上部との間の距離を示します。
透かしを追加し、場所、開始時間、終了時間を指定します
{
"VideoTracks":[
{
"VideoTrackClips":[
{
"MediaId":"756620ed48c9af022c66ee1cbe2e****",
"Type":"Video",
"TimelineIn":0,
"TimelineOut":140,
"Duration":140
}
]
},
{
"VideoTrackClips":[
{
"Effects":[
{
"Type":"Scale",
"TimelineIn":0,
"TimelineOut":100,
"Width":0.416,
"Height":0.2347
}
],
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****",
"Type":"Image",
"TimelineIn":0,
"TimelineOut":100,
"Duration":100,
"X":0.584,
"Y":0
}
]
}
]
}期間を指定せずに透かしを追加する
ImageTracksを使用して透かしを設定します。 この方法では、期間を指定する必要はありません。 ウォーターマークはビデオ全体に表示されます。
{
"VideoTracks":[
{
"Count":3,
"VideoTrackClips":[
{
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****",
"Type":"Image",
"Duration":5
},
{
"MediaId":"756620ed48c9af022c66ee1cbe2e****",
"Type":"Image",
"Duration":5
},
{
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****",
"Type":"Image",
"Duration":5
}
]
}
],
"ImageTracks": [
{
"ImageTrackClips": [
{
"ImageId": "756620ed48c9af022c66ee1cbe2e****",
"Width" : 200,
"Height" : 100,
"X" : 100,
"Y" : 100
}
]
}
]
}picture-in-pictureの設定
{
"VideoTracks":[
{
"VideoTrackClips":[
{
"MediaId":"756620ed48c9af022c66ee1cbe2e****",
"Type":"Video"
}
]
},
{
"VideoTrackClips":[
{
"Effects":[
{
"Type":"Scale",
"TimelineIn":0,
"TimelineOut":100,
"Width":0.3,
"Height":0.4
}
],
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****",
"Type":"Video",
"Duration":100,
"X":0.5,
"Y":0
}
]
}
]
}複数のビデオを組み合わせて、トランジション効果とBGMを追加する
{
"VideoTracks":[
{
"VideoTrackClips":[
{
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****",
"Effects":[
{
"Type":"Transition",
"SubType":"directional",
"Duration":2
}
]
},
{
"MediaId":"756620ed48c9af022c66ee1cbe2e****",
"Effects":[
{
"Type":"Transition",
"SubType":"waterdrop",
"Duration":1
}
]
},
{
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****"
}
]
}
],
"AudioTracks":[
{
"AudioTrackClips":[
{
"MediaId":"756620ed48c9af022c66ee1cbe2e****"
}
]
}
]
}画像アルバムに2つのオーディオファイルを追加し、同時に再生するようにオーディオファイルを設定する
{
"VideoTracks":[
{
"VideoTrackClips":[
{
"Type":"Image",
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****",
"Duration":10
},
{
"Type":"Image",
"MediaId":"756620ed48c9af022c66ee1cbe2e****",
"Duration":10
},
{
"Type":"Image",
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****",
"Duration":10
},
{
"Type":"Image",
"MediaId":"756620ed48c9af022c66ee1cbe2e****",
"Duration":10
}
]
}
],
"AudioTracks":[
{
"AudioTrackClips":[
{
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****"
}
]
},
{
"AudioTrackClips":[
{
"MediaId":"756620ed48c9af022c66ee1cbe2e****",
}
]
}
]
}オーディオループ再生の設定
{
"VideoTracks": [
{
"VideoTrackClips": [
{
"MediaId":"756620ed48c9af022c66ee1cbe2e****",
}
]
}
],
"AudioTracks": [
{
"AudioTrackClips": [
{
"MediaId":"756620ed48c9af022c66ee1cbe2e****",
"LoopMode": true,
"In": 42,
"Out": 58,
"TimelineIn": 5,
"TimelineOut": 30,
"Comment": "Play the audio from the 42nd to 58th second in a loop from the 5th to 30th second in the timeline."
}
]
}
]
}黒いバーを取り除く
次のサンプルコードは、1920 × 1080のビデオの上部と下部から黒いバーを削除し、ビデオに字幕を追加する方法の例を示しています。 黒いバーの高さは130ピクセルです。
{
"VideoTracks":[
{
"VideoTrackClips":[
{
"MediaId":"756620ed48c9af022c66ee1cbe2e****",
"X":0,
"Y":0,
"Effects":[
{
"Type":"Crop",
"X":0,
"Width":1920,
"Height":820,
"Y":130
}
]
}
]
}
],
"SubtitleTracks":[
{
"SubtitleTrackClips":[
{
"Type":"Subtitle",
"SubType":"srt",
"FileURL":"https://your-bucket.oss-cn-shanghai.aliyuncs.com/object.srt"
}
]
}
]
}次のサンプルコードでは、OutputConfigの設定方法の例を示します。OutputConfigは、出力ビデオのサイズを指定します。
{
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****",
"Width":1920,
"Height":820
}GIFステッカーを使用する
GIFステッカーを使用するには、DyncFramesを設定する必要があります。 DyncFramesは、ステッカーのフレームレートを指定します。
{
"VideoTracks": [{
"VideoTrackClips": [{
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****"
}]
}, {
"VideoTrackClips": [{
"MediaId":"756620ed48c9af022c66ee1cbe2e****",
"Type": "Image",
"DyncFrames": 8,
"TimelIneIn": 0.0,
"TimelIneOut": 50.0,
"X": 50,
"Y": 50,
"Effects": [{
"Type": "Scale",
"Height": 100,
"Width": 100
}]
}]
}レンダリングフィルターの使用
{
"VideoTracks": [{
"VideoTrackClips": [{
"TimelineIn": 0,
"Type": "Video",
"Out": 10,
"MediaId": "MediaId1",
"Effects": [{
"SubType": "color",
"ExtParams": "effect=color,brightness=80,contrast=0,saturation=0,kelvin_temperature=6000,temperature_ratio=0,tint=0,dark_corner_ratio=0",
"Type": "Filter",
"TimelineIn": 0,
"TimelineOut": 10
}]
}]
}]
}速度ランピングの設定
クリップの再生速度を変更するには、speedプロパティを設定します。 速度ランピングを設定すると、クリップの期間が変更されます。 たとえば、クリップのOutが10秒に設定され、Speedが2に設定されている場合、タイムラインでのクリップの継続時間は5秒になります。 この場合、TimelineOutを5に設定します。 TimelineInとTimelineOutが空のままである場合、タイムライン内のクリップの位置は、in、Out、およびSpeedの値に基づいて、制作中に自動的に計算されます。
{
"VideoTracks": [{
"VideoTrackClips": [{
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****",
"Speed": 2,
"Out": 10,
"TimelineIn": 0,
"TimelineOut": 5
}, {
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****",
"Speed": 0.5,
"In": 10,
"Out": 20
}]
}],
"AudioTracks": [{
"AudioTrackClips": [{
"MediaId":"756620ed48c9af022c66ee1cbe2e****",
"Speed": 2
}]
}]
}マテリアル回転の設定
マテリアルを回転させるには、"Type": "rotate" を設定します。 マテリアルを90度、180度、270度回転させることができます。
素材をビデオトラック
{ "VideoTracks": [ { "VideoTrackClips": [ { "MediaId":"8f5cdf044b059b3adc7967ba1cbe****", "In": 0, "Out": 5, "Effects": [ { "Type": "Rotate", "Degree": 90 } ] } ] } ] }イメージトラック
{ "VideoTracks": [ { "VideoTrackClips": [ { "MediaId":"8f5cdf044b059b3adc7967ba1cbe****", "In": 0, "Out": 15 } ] } ], "ImageTracks": [ { "ImageTrackClips": [ { "ImageId": "70dc95c0e31b71edbfe76fa3691c****", "Width": 0.9, "Height": 0.9, "X": 0.15, "Y": 0.15, "Effects": [ { "Type": "Rotate", "Degree": 90 } ] } ] } ] }
ビデオ全体に画像を追加する
ビデオ全体に画像を追加するには、GlobalImageを指定します。 期間を指定する必要はありません。 デフォルトでは、マージ後のすべてのビデオトラックの合計時間の画像が表示されます。 これにより、グローバル背景とグローバル透かしを設定できます。
グローバル透かし
{ "VideoTracks": [ { "VideoTrackClips": [ { "MediaId":"8f5cdf044b059b3adc7967ba1cbe****" } ] }, { "VideoTrackClips": [ { "MediaId":"756620ed48c9af022c66ee1cbe2e****", "Type": "GlobalImage", "X": 0.1, "Y": 0.1, "Width": 247, "Height": 74 } ] } ] }グローバルバックグラウンド
{ "VideoTracks": [ { "VideoTrackClips": [ { "MediaId":"756620ed48c9af022c66ee1cbe2e****", "Type": "GlobalImage" } ] }, { "VideoTrackClips": [ { "MediaId":"8f5cdf044b059b3adc7967ba1cbe****", "Effects": [ { "Type": "Volume", "Gain": 0 } ] } ] } ] }
ビデオトラックのMaxOutの設定
ビデオトラックからビデオセグメントをクリップするには、MaxOutを設定します。 ビデオをクリップするときは、次のルールが適用されます。
MaxOutの値が元の素材の持続時間よりも小さい場合、MaxOutは素材が元の素材から切り取られた時間を示します。MaxOutの値が元の素材の持続時間よりも大きい場合、素材は元の素材の端からカットされます。
{
"VideoTracks": [
{
"VideoTrackClips": [
{
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****",
"MaxOut": 10
},{
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****",
"Effects": [{
"Type": "Scale",
"Width": 0.8,
"Height": 0.8
}]
}]
}]
}ビデオセグメントをカットするように
Outを設定し、Outの値が元のマテリアルの長さより大きい場合、静止画像が表示されます。MaxOutとOutを設定すると、Outが有効になり、MaxOutが無効になります。
ランダム効果を使用する
ApsaraVideo VODはランダム効果をサポートしています。 ランダムなクリップをカットし、タイムラインでランダムなフィルター、ランダムな特殊効果、およびランダムなトランジション効果を使用できます。
ランダムクリップ: 元の素材から指定した期間のクリップをランダムに選択し、そのクリップをタイムラインに追加します。
ランダムフィルター: 指定した範囲またはすべてのフィルターからランダムにフィルターを選択します。
ランダム特殊効果: 指定された範囲またはすべての特殊効果から特殊効果をランダムに選択します。
ランダムトランジション効果: 指定した範囲またはすべてのトランジション効果からランダムに選択します。
{
"VideoTracks": [
{
"VideoTrackClips": [
{
"MediaId": "8f5cdf044b059b3adc7967ba1cbe****",
"TimelineIn": 0,
"Effects": [
{
"Comment": "Randomly select a transition effect from all transition effects",
"Type": "Transition",
"SubType": "random",
"Duration": 1
},
{
"Comment": "Randomly cut a clip of 5 seconds from the material.",
"Type": "Clip",
"SubType": "RandomClip",
"ClipDuration": 5
}
]
},
{
"MediaId": "8f5cdf044b059b3adc7967ba1cbe****",
"TimelineIn": 5,
"Effects": [
{
"Comment": "Randomly select a special effect among open, zoom, and disappear.",
"Type": "VFX",
"SubType": "open,zoom,disappear"
}
]
},
{
"MediaId": "8f5cdf044b059b3adc7967ba1cbe****",
"TimelineIn": 10,
"Effects": [
{
"Comment": "Randomly select a filter among pl4, colorfulstarry, and flyfire.",
"Type": "Filter",
"SubType": "pl4,colorfulstarry,flyfire"
}
]
}
]
}
]
}字幕制作
改行と配置の設定
改行を設定するには、字幕テキストに \nまたは \\nを追加します。 字幕テキストの配置を設定するには、[配置] を指定します。
{
"VideoTracks": [
{
"VideoTrackClips": [
{
"MediaId": "8f5cdf044b059b3adc7967ba1cbe****",
"Effects": [
{
"Type": "Text",
"X": 20,
"Y": 34,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Add \n to configure a line breaking and set Alignment to TopCenter to center the subtitle text in each line.",
"Alignment": "TopCenter",
"FontSize": 26,
"FontColorOpacity": 1,
"FontColor": "#ff0000",
"FontFace": {
"Bold": true,
"Italic": false,
"Underline": false
}
},
{
"Type": "Text",
"X": 100,
"Y": 200,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Add \n to configure a line breaking and set Alignment to TopLeft to align the subtitle text to the left.",
"Alignment": "TopLeft",
"FontSize": 26,
"FontColorOpacity": 0.8,
"FontColor": "#ff0000"
},
{
"Type": "Text",
"X": 0.10,
"Y": 0.1,
"TimelineIn": 2,
"TimelineOut": 15,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Add \n to configure a line breaking and set Alignment to TopRight to align the subtitle text to the right.",
"Alignment": "TopRight",
"FontSize": 26,
"FontColor": "#000000"
}
]
}
]
}
]
}テキストの特殊効果とワードアート効果を設定する
ワードアート効果を設定するには、EffectColorStyleとストローク幅とシャドウの色を指定します。 ワードアートの例については、「Word art effect examples」をご参照ください。
{
"VideoTracks": [{
"VideoTrackClips": [{
"MediaId": "756620ed48c9af022c66ee1cbe2e****",
"Effects": [{
"Type": "Text",
"X": 33,
"Y": 34,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Word art: brushed_aluminium, entrance effect: rotateflip_in, exit effect: slide_down_out",
"OutlineColour": "#4effcf",
"BackColour": "#2effc6",
"Outline": 2,
"Shadow": 2,
"EffectColorStyle": "brushed_aluminium",
"FontSize": 42,
"AaiMotionInEffect": "rotateflip_in",
"AaiMotionIn": 1,
"AaiMotionOutEffect": "slide_down_out",
"AaiMotionOut": 1,
"FontFace": {
"Bold": true,
"Italic": false,
"Underline": false
}
},
{
"Type": "Text",
"X": 66,
"Y": 256,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Word art: deep_sea, loop effect: rainbrush_display, quick loop",
"EffectColorStyle": "deep_sea",
"OutlineColour": "#e9e9e9",
"BackColour": "#30335c",
"Outline": 2,
"Shadow": 2,
"AaiMotionLoopEffect": "rainbrush_display",
"Ratio": 2,
"FontSize": 38,
"FontColorOpacity": 0.8,
"FontColor": "#d60e0e"
}
]
}]
}]
}ループ効果は、テキストの入口または出口効果と一緒には機能しません。 テキストのループ効果と入口効果または出口効果を設定した場合、入口効果と出口効果のみが有効になります。
ビデオ編集で字幕ファイルを使用する
{
"VideoTracks": [
{
"VideoTrackClips": [
{
"MediaId": "756620ed48c9af022c66ee1cbe2e****"
},
{
"MediaId": "8f5cdf044b059b3adc7967ba1cbe****"
}
]
}
],
"SubtitleTracks": [
{
"SubtitleTrackClips": [
{
"Type": "Subtitle",
"SubType": "srt",
"FileUrl": "http://your-bucket.oss-cn-shanghai.aliyuncs.com/your-subtitle.srt"
}
]
}
]
}テキストの背景を設定する
テキストの背景を設定するには、"BorderStyle": 3、背景幅アウトライン、背景色OutlineColourを指定します。
{
"VideoTracks": [{
"VideoTrackClips": [{
"MediaId":"8f5cdf044b059b3adc7967ba1cbe****",
"Effects": [{
"Type": "Text",
"X": 33,
"Y": 34,
"Content": "Configure a text background.",
"FontSize": 42,
"BorderStyle": 3,
"FontColor": "#4B0082",
"Outline": 3,
"OutlineColour": "#FFDEAD"
}]
}]
}]
}写真アルバム
字幕なしで画像アルバムを作成する
画像からコンパイルされたスライドに基づいてビデオを作成し、画像シーケンスと期間を設定します。
{
"VideoTracks": [
{
"VideoTrackClips": [
{
"Type": "image",
"MediaId": "756620ed48c9af022c66ee1cbe2e****",
"Duration": 3
},
{
"Type": "image",
"MediaId": "8f5cdf044b059b3adc7967ba1cbe****",
"Duration": 3
},
{
"Type": "image",
"MediaId": "70dc95c0e31b71edbfe76fa3691c****",
"Duration": 3
}
]
}
]
}字幕付きの画像アルバムを作成する
画像からコンパイルされたスライドに基づいてビデオを作成し、画像シーケンスと期間を設定します。 [効果] を設定して、字幕テキストの形式を指定します。
{
"VideoTracks": [{
"VideoTrackClips": [{
"Type": "image",
"MediaId": "756620ed48c9af022c66ee1cbe2e****",
"Effects": [
{
"Type": "Text",
"X": 33,
"Y": 34,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Test text",
"FontSize": 26,
"FontColorOpacity": 1,
"FontColor": "#000000",
"FontFace": {
"Bold": true,
"Italic": false,
"Underline": false
}
}
],
"Duration": 5
}, {
"Type": "image",
"MediaId": "8f5cdf044b059b3adc7967ba1cbe****",
"Duration": 5
}, {
"Type": "image",
"MediaId": "70dc95c0e31b71edbfe76fa3691c****",
"Effects": [
{
"Type": "Text",
"X": 0.7123,
"Y": 0.7896,
"TimelineIn": 11,
"TimelineOut": 13,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Test text",
"FontSize": 26,
"FontColor": "#000000"
}
],
"Duration": 5
}]
}]
}