视频/图片混剪

本文为您介绍如何修改SubmitMediaProducingJobTimeline参数来完成视频/图片混剪。

使用说明

  • 智能生产制作支持直播流、点播和OSS素材文件的剪辑合成、特效渲染、模板生产等功能,更多详情请参见智能生产制作概述

  • 将一个或多个视频、音频、图片、字幕素材合成为成品,可以通过不同的Timeline参数配置提交剪辑,然后调用SubmitMediaProducingJob - 提交剪辑合成作业来完成合成。

  • 时间线是将素材按照视频创意进行编排和特效设计的产物,时间线主要包含轨道、素材、效果3种对象,详情请参见Timeline配置说明

  • 如果您想通过调用SDK进行音视频剪辑,请参见安装IMS服务端SDK的准备工作

设置成片视频宽高

调用接口SubmitMediaProducingJob提交剪辑合成任务时,通过设置参数OutputMediaConfig中的Width、Height字段来定义成片分辨率。

String outputMediaUrl = "https://your-bucket.oss-cn-shanghai.aliyuncs.com/target_video.mp4";
String outputMediaConfig = "{\"MediaURL\":\"" + outputMediaUrl + "\",\"Width\":720,\"Height\":1280}";
SubmitMediaProducingJobRequest request = new SubmitMediaProducingJobRequest();
request.setTimeline("<your-timeline>");
request.setOutputMediaConfig(outputMediaConfig);
SubmitMediaProducingJobResponse response = iceClient.submitMediaProducingJob(request);

视频横转竖-补充上下黑边

若Timeline中的素材为横屏视频,而提交剪辑合成任务时设置的成片分辨率为竖屏,则系统会根据素材和成片的宽高进行等比缩放,并将素材居中显示。

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4"
    },{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4"
    },{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4"
    }]
  }]
}

视频横转竖-补充上下模糊区域

Radius(模糊半径)取值范围为[0.01, 1],具体参考Effect Type:Background 背景设置

成片效果

Timeline示例

{
	"VideoTracks": [{
		"VideoTrackClips": [{
			"MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4",
			"Effects": [{
				"Type": "Background",
				"SubType": "Blur",
				"Radius": 0.1
			}]
		}, {
			"MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
			"Effects": [{
				"Type": "Background",
				"SubType": "Blur",
				"Radius": 0.1
			}]
		}, {
			"MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
			"Effects": [{
				"Type": "Background",
				"SubType": "Blur",
				"Radius": 0.1
			}]
		}]
	}]
}

视频横转竖-三分屏效果

AdaptMode=Cover参数表示素材按照其长宽比进行缩放,并填充满整个目标区域。其他值可参考VideoTrackClip

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0.3333,
      "AdaptMode": "Cover"
    },{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0.3333,
      "AdaptMode": "Cover"
    },{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0.3333,
      "AdaptMode": "Cover"
    }]
  },{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0,
      "AdaptMode": "Cover"
    },{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0,
      "AdaptMode": "Cover"
    },{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0,
      "AdaptMode": "Cover"
    }]
  },{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0.6666,
      "AdaptMode": "Cover"
    },{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0.6666,
      "AdaptMode": "Cover"
    },{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0.6666,
      "AdaptMode": "Cover"
    }]
  }],
  "SubtitleTracks":[
    {
      "SubtitleTrackClips": [
        {
          "Type": "Text",
          "X": 0,
          "Y": 200,
          "Font": "AlibabaPuHuiTi",
          "Content": "这里是标题",
          "Alignment": "TopCenter",
          "FontSize": 80,
          "FontColorOpacity": 1,
          "1FontColor": "#ffffff",
          "FontColor": "#FFDEAD",
          "FontFace": {
            "Bold": true,
            "Italic": false,
            "Underline": false
          }
        }
      ]
    },
    {
      "SubtitleTrackClips": [
        {
          "Type":"Text",
          "X": 0,
          "Y": 320,
          "Font": "KaiTi",
          "Content": "这里是副标题",
          "Alignment": "TopCenter",
          "FontSize": 45,
          "FontColor": "#ffffff",
          "FontFace": {
            "Bold": false,
            "Italic": true,
            "Underline": true
          }
        }
      ]
    },
    {
      "SubtitleTrackClips":[
        {
          "Type":"Text",
          "X": 0,
          "Y": 900,
          "Font": "AlibabaPuHuiTi",
          "Content": "视频拼接的同时可以加字幕\n可以加换行符进行多行展示",
          "Alignment": "TopCenter",
          "FontSize": 40,
          "FontColor": "#ffffff",
          "FontFace": {
            "Bold": true,
            "Italic": false,
            "Underline": false
          }
        }
      ]
    }
  ]
}

视频横转竖-设置背景颜色

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4",
      "Effects": [{
        "Type": "Background",
        "SubType": "Color",
        "Color": "#000066"
      }]
    }, {
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "Effects": [{
        "Type": "Background",
        "SubType": "Color",
        "Color": "#006400"
      }]
    }, {
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
      "Effects": [{
        "Type": "Background",
        "SubType": "Color",
        "Color": "#8B1A1A"
      }]
    }]
  }]
}

视频截取

In=3、Out=8 表示截取视频的第3秒到第8秒的区间。

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4",
      "In": 3,
      "Out": 8
    }]
  }]
}

多段视频截取合并

在Clip中,可以不设置TimelineIn和TimelineOut,系统将默认对素材进行前后拼接。

当MaxOut=5时,表示最多截取到Out为5秒的位置。具体操作为:

  • 如果素材时长超过5秒,则截取前5秒;

  • 如果素材时长不足5秒,则截取到素材结尾。

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4",
      "In": 3,
      "Out": 8
    }, {
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "MaxOut": 5
    }, {
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
      "Effects": [{
        "Type": "Clip",
        "SubType": "RandomClip",
        "ClipDuration": 5
      }]
    }]
  }]
}

视频图片混剪

Type的默认值为Video。如果要使用图片素材,则需要添加Type=Image。

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4",
      "Out": 3
    }, {
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/01.jpg",
      "Type": "Image",
      "Duration": 3
    }, {
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "Out": 3
    }, {
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/02.jpg",
      "Type": "Image",
      "Duration": 3
    }, {
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
      "Out": 3
    }]
  }]
}

添加水印/贴纸/GIF贴纸

GIF格式的图片剪辑需要传递动态帧数(DyncFrames),即为GIF素材的帧数。

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4",
      "Out": 5
    }, {
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "Out": 5
    }, {
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
      "Out": 5
    }]
  },{
    "VideoTrackClips": [{
      "Type": "Image",
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/s1.png",
      "TimelineIn": 0,
      "Duration": 5,
      "X": 40,
      "Y": 40,
      "Width": 300,
      "Height": 150
    }, {
      "Type": "Image",
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/g2.gif",
      "TimelineIn": 5,
      "Duration": 5,
      "X": 20,
      "Y": 800,
      "Width": 200,
      "Height": 200,
      "DyncFrames": 8
    }, {
      "Type": "Image",
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/image/g1.gif",
      "TimelineIn": 10,
      "Duration": 5,
      "X": 400,
      "Y": 40,
      "Width": 200,
      "Height": 200,
      "DyncFrames": 8
    }]
  }]
}

缩放配置

AdaptMode的取值包括:Contain、Cover、Fill,更多详细信息,请参阅VideoTrackClip

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0.3333,
      "AdaptMode": "Cover",
      "Out": 5
    },{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0.3333,
      "AdaptMode": "Cover",
      "Out": 5
    }]
  },{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0,
      "AdaptMode": "Contain",
      "Out": 5
    },{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0,
      "AdaptMode": "Contain",
      "Out": 5
    }]
  },{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h1.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0.6666,
      "AdaptMode": "Fill",
      "Out": 5
    },{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4",
      "Width": 1,
      "Height": 0.3333,
      "X": 0,
      "Y": 0.6666,
      "AdaptMode": "Fill",
      "Out": 5
    }]
  }],
  "SubtitleTracks":[
    {
      "SubtitleTrackClips":[
        {
          "Type":"Text",
          "X": 0,
          "Y": 0,
          "Font": "AlibabaPuHuiTi",
          "Content": "AdaptMode=Cover:被替换的内容在保持其宽高比的同时填充整个目标区域。如果对象的宽高比与内容框不相匹配,该对象将被剪裁以适应目标区域",
          "FontSize": 30,
          "FontColor": "#ffffff",
          "AdaptMode": "AutoWrap",
          "TextWidth": 1,
          "FontFace": {
            "Bold": true,
            "Italic": false,
            "Underline": false
          }
        }
      ]
    },
    {
      "SubtitleTrackClips":[
        {
          "Type":"Text",
          "X": 0,
          "Y": 0.3333,
          "Font": "AlibabaPuHuiTi",
          "Content": "AdaptMode=Contain:被替换的内容将被缩放,在填充目标区域的同时保留其长宽比",
          "FontSize": 30,
          "FontColor": "#ffffff",
          "AdaptMode": "AutoWrap",
          "TextWidth": 1,
          "FontFace": {
            "Bold": true,
            "Italic": false,
            "Underline": false
          }
        }
      ]
    },
    {
      "SubtitleTrackClips":[
        {
          "Type":"Text",
          "X": 0,
          "Y": 0.6666,
          "Font": "AlibabaPuHuiTi",
          "Content": "AdaptMode=Fill:默认逻辑,被替换的内容正好填充目标内容框。整个对象将完全填充此框。如果对象的宽高比与内容框不相匹配,那么该对象将被拉伸以适应目标区域",
          "FontSize": 30,
          "FontColor": "#ffffff",
          "AdaptMode": "AutoWrap",
          "TextWidth": 1,
          "FontFace": {
            "Bold": true,
            "Italic": false,
            "Underline": false
          }
        }
      ]
    }
  ]
}

视频画中画

在VideoTracks中,数组后面的轨道层级较高,会覆盖数组前面的轨道。

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4"
    }]
  },{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4",
      "X": 0.25,
      "Y": 0.25,
      "Width": 0.5,
      "Height": 0.5
    }]
  }]
}

水平翻转、垂直翻转

成片效果

Timeline示例

{
  "VideoTracks": [
    {
      "VideoTrackClips": [
        {
          "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
          "Width": 0.5,
          "Height": 0.5,
          "X": 0,
          "Y": 0,
          "Effects": [
            {
              "Type": "Text",
              "FixedX": 0,
              "FixedY": 0,
              "Font": "HappyZcool-2016",
              "Content": "原视频",
              "Alignment": "TopLeft",
              "FontSize": 80,
              "FontColor": "#F5FFFA",
              "TimelineIn": 0,
              "TimelineOut": 10,
              "Outline": 1,
              "OutlineColour": "#0e0100"
            }
          ]
        }
      ]
    },
    {
      "VideoTrackClips": [
        {
          "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
          "Width": 0.5,
          "Height": 0.5,
          "X": 0.5,
          "Y": 0,
          "Effects": [
            {
              "Type": "Flip",
              "Direction": "horizontal"
            },{
              "Type": "Text",
              "FixedX": 0.5,
              "FixedY": 0,
              "Font": "HappyZcool-2016",
              "Content": "视频水平翻转",
              "Alignment": "TopLeft",
              "FontSize": 80,
              "FontColor": "#F5FFFA",
              "TimelineIn": 0,
              "TimelineOut": 10,
              "Outline": 1,
              "OutlineColour": "#0e0100"
            }
          ]
        }
      ]
    },
    {
      "VideoTrackClips": [
        {
          "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
          "Width": 0.5,
          "Height": 0.5,
          "X": 0,
          "Y": 0.5,
          "Effects": [
            {
              "Type": "Flip",
              "Direction": "vertical"
            },{
              "Type": "Text",
              "FixedX": 0,
              "FixedY": 0.5,
              "Font": "HappyZcool-2016",
              "Content": "视频竖直翻转",
              "Alignment": "TopLeft",
              "FontSize": 80,
              "FontColor": "#F5FFFA",
              "TimelineIn": 0,
              "TimelineOut": 10,
              "Outline": 1,
              "OutlineColour": "#0e0100"
            }
          ]
        }
      ]
    },
    {
      "VideoTrackClips": [
        {
          "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h3.mp4",
          "Width": 0.5,
          "Height": 0.5,
          "X": 0.5,
          "Y": 0.5,
          "Effects": [
            {
              "Type": "Flip",
              "Direction": "horizontal"
            },{
              "Type": "Flip",
              "Direction": "vertical"
            },{
              "Type": "Text",
              "FixedX": 0.5,
              "FixedY": 0.5,
              "Font": "HappyZcool-2016",
              "Content": "视频水平竖直翻转",
              "Alignment": "TopLeft",
              "FontSize": 80,
              "FontColor": "#F5FFFA",
              "TimelineIn": 0,
              "TimelineOut": 10,
              "Outline": 1,
              "OutlineColour": "#0e0100"
            }
          ]
        }
      ]
    }
  ]
}

视频裁剪

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4",
      "Out": 3,
      "X": 0.3,
      "Y": 0.3,
      "Width":0.4,
      "Height":0.4,
      "Effects": [{
        "Type":"Crop",
        "X":0.3,
        "Y":0.3,
        "Width":0.4,
        "Height":0.4
      },{
        "Type": "Text",
        "Font": "HappyZcool-2016",
        "Content": "裁掉60%",
        "FixedY": 150,
        "Alignment": "TopCenter",
        "FixedFontSize": 70,
        "FontColor": "#F5FFFA",
        "Outline": 1,
        "OutlineColour": "#0e0100"
      }]
    },{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4",
      "In": 3,
      "Out": 6,
      "X": 0.15,
      "Y": 0.15,
      "Width":0.7,
      "Height":0.7,
      "Effects": [{
        "Type":"Crop",
        "X":0.15,
        "Y":0.15,
        "Width":0.7,
        "Height":0.7
      },{
        "Type": "Text",
        "Font": "HappyZcool-2016",
        "Content": "裁掉30%",
        "FixedY": 150,
        "Alignment": "TopCenter",
        "FixedFontSize": 70,
        "FontColor": "#F5FFFA",
        "Outline": 1,
        "OutlineColour": "#0e0100"
      }]
    },{
      "MediaURL": "http://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4",
      "In": 6,
      "Out": 9,
      "Effects": [{
        "Type": "Text",
        "Font": "HappyZcool-2016",
        "Content": "不裁剪",
        "FixedY": 150,
        "Alignment": "TopCenter",
        "FixedFontSize": 70,
        "FontColor": "#F5FFFA",
        "Outline": 1,
        "OutlineColour": "#0e0100"
      }]
    }]
  }]
}

音视频变速

在AudioTrackClips中,也可以使用Speed参数实现音视频变速。

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "Out": 3,
      "Effects": [{
        "Type": "Text",
        "Font": "HappyZcool-2016",
        "Content": "原速",
        "FixedY": 150,
        "Alignment": "TopCenter",
        "FixedFontSize": 70,
        "FontColor": "#F5FFFA"
      }]
    },{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "Speed": 2,
      "Out": 6,
      "Effects": [{
        "Type": "Text",
        "Font": "HappyZcool-2016",
        "Content": "2倍速",
        "FixedY": 150,
        "Alignment": "TopCenter",
        "FixedFontSize": 70,
        "FontColor": "#F5FFFA"
      }]
    },{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "Speed": 3,
      "Out": 9,
      "Effects": [{
        "Type": "Text",
        "Font": "HappyZcool-2016",
        "Content": "3倍速",
        "FixedY": 150,
        "Alignment": "TopCenter",
        "FixedFontSize": 70,
        "FontColor": "#F5FFFA"
      }]
    }]
  }]
}

素材旋转

成片效果

Timeline示例

{
  "VideoTracks": [{
    "VideoTrackClips": [{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "Out": 3,
      "Effects": [{
        "Type": "Text",
        "Font": "HappyZcool-2016",
        "Content": "原角度",
        "FixedY": 150,
        "Alignment": "TopCenter",
        "FixedFontSize": 70,
        "FontColor": "#F5FFFA",
        "Outline": 1,
        "OutlineColour": "#0e0100"
      }]
    },{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "Out": 3,
      "X": 0,
      "Y": 0,
      "Height": 720,
      "Width": 1280,
      "Effects": [{
        "Type": "Rotate",
        "Degree": 90
      },{
        "Type": "Text",
        "Font": "HappyZcool-2016",
        "Content": "旋转90度",
        "FixedY": 150,
        "Alignment": "TopCenter",
        "FixedFontSize": 70,
        "FontColor": "#F5FFFA",
        "Outline": 1,
        "OutlineColour": "#0e0100"
      }]
    },{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "Out": 3,
      "Effects": [{
        "Type": "Rotate",
        "Degree": 180
      },{
        "Type": "Text",
        "Font": "HappyZcool-2016",
        "Content": "旋转180度",
        "FixedY": 150,
        "Alignment": "TopCenter",
        "FixedFontSize": 70,
        "FontColor": "#F5FFFA",
        "Outline": 1,
        "OutlineColour": "#0e0100"
      }]
    },{
      "MediaURL": "http://ice-public-media.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
      "Out": 3,
      "X": 0,
      "Y": 0,
      "Height": 720,
      "Width": 1280,
      "Effects": [{
        "Type": "Rotate",
        "Degree": 270
      },{
        "Type": "Text",
        "Font": "HappyZcool-2016",
        "Content": "旋转270度",
        "FixedY": 150,
        "Alignment": "TopCenter",
        "FixedFontSize": 70,
        "FontColor": "#F5FFFA",
        "Outline": 1,
        "OutlineColour": "#0e0100"
      }]
    }]
  }]
}

圆形、矩形、线性、镜面遮罩

成片效果

Timeline示例

{
    "VideoTracks": [
        {
            "VideoTrackClips": [
                {
                    "MediaUrl": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/h2.mp4",
                    "Width": 1,
                    "Height": 1,
                    "In": 0,
                    "Out": 5,
                    "AdaptMode": "Cover",
                    "Duration": 10
                }
            ]
        },
        {
            "VideoTrackClips": [
                {
                    "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4",
                    "X": 0.1,
                    "Y": 0.1,
                    "Width": 0.3,
                    "Height": 0.3,
                    "AdaptMode": "Cover",
                    "In": 0,
                    "Out": 5,
                    "Effects": [
                        {
                            "Type": "VFX",
                            "SubType": "mask_circle",
                            "ExtParams": "x=0.5,y=0.2,width=200.0,height=200.0,antialias=0.05"
                        }
                    ]
                }
            ]
        },
        {
            "VideoTrackClips": [
                {
                    "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4",
                    "X": 0.5,
                    "Y": 0.1,
                    "Width": 0.3,
                    "Height": 0.3,
                    "AdaptMode": "Cover",
                    "In": 0,
                    "Out": 5,
                    "Effects": [
                        {
                            "Type": "VFX",
                            "SubType": "mask_linear",
                            "ExtParams": "x=0.5,y=0.2,antialias=0.1,angle=90.0"
                        }
                    ]
                }
            ]
        },
        {
            "VideoTrackClips": [
                {
                    "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4",
                    "X": 0.1,
                    "Y": 0.5,
                    "Width": 0.3,
                    "Height": 0.3,
                    "AdaptMode": "Cover",
                    "In": 0,
                    "Out": 5,
                    "Effects": [
                        {
                            "Type": "VFX",
                            "SubType": "mask_minor",
                            "ExtParams": "x=0.5,y=0.4,size=0.6,angle=45.0"
                        }
                    ]
                }
            ]
        },
        {
            "VideoTrackClips": [
                {
                    "MediaURL": "https://ice-document-materials.oss-cn-shanghai.aliyuncs.com/test_media/v1.mp4",
                    "X": 0.5,
                    "Y": 0.5,
                    "Width": 0.3,
                    "Height": 0.3,
                    "AdaptMode": "Cover",
                    "In": 0,
                    "Out": 5,
                    "Effects": [
                        {
                            "Type": "VFX",
                            "SubType": "mask_rec",
                            "ExtParams": "x=0.5,y=200.0,width=200.0,height=200.0,radius=50.0,antialias=0.03"
                        }
                    ]
                }
            ]
        }
    ]
}

参数说明

  • 圆形(椭圆)

    type = mask_circle

    参数

    类型

    取值范围

    默认值

    说明

    x

    float

    [0.0, 素材宽]

    0.5

    遮罩圆心在素材内相比素材左上角的X坐标。

    • [0.0, 1.0]时表示相对素材宽的坐标。

    • 大于1.0时,表示绝对像素值。

    y

    float

    [0.0, 素材高]

    0.5

    遮罩圆心在素材内相比素材左上角的Y坐标。

    • [0.0, 1.0]时表示相对素材高的坐标。

    • 大于1.0时,表示绝对像素值。

    width

    float

    [0.0, 素材宽]

    0.8

    遮罩椭圆的宽度,相比素材的宽度。

    • [0.0, 1.0]时表示相对素材宽的宽度。

    • 大于1.0时,表示绝对像素值。

    height

    float

    [0.0, 素材高]

    0.8

    遮罩椭圆的高度,相比素材的高度。

    • [0.0, 1.0]时表示相对素材高的高度。

    • 大于1.0时,表示绝对像素值。

    antialias

    float

    [0.0, 1.0]

    0.1

    遮罩椭圆的抗锯齿参数。值越大,边缘羽化程度越高。

    angle

    float

    [-9999.0, 9999.0]

    0.0

    旋转角度。

  • 矩形

    type = mask_rec

    参数

    类型

    取值范围

    默认值

    说明

    x

    float

    [0.0, 素材宽]

    0.5

    遮罩矩形中心在视频素材内相比素材左上角的X坐标。

    • [0.0, 1.0]时表示相对素材宽的坐标。

    • 大于1.0时,表示绝对像素值。

    y

    float

    [0.0, 素材高]

    0.5

    遮罩矩形中心在视频素材内相比素材左上角的Y坐标。

    • [0.0, 1.0]时表示相对素材高的坐标。

    • 大于1.0时,表示绝对像素值。

    width

    float

    [0.0, 素材宽]

    0.8

    遮罩矩形的宽度。

    • [0.0, 1.0]时表示相对素材宽的宽度。

    • 大于1.0时,表示绝对像素值。

    height

    float

    [0.0, 素材高]

    0.8

    遮罩矩形的高度。

    • [0.0, 1.0]时表示相对素材高的高度。

    • 大于1.0时,表示绝对像素值。

    antialias

    float

    [0.0, 1.0]

    0.1

    遮罩矩形的抗锯齿参数,值越大,边缘羽化程度越高。

    radius

    float

    [0.0, 素材宽或高的较大值]

    0.1

    遮罩矩形圆角半径。

    • [0.0, 1.0]时表示相对素材宽或高的较大值的半径大小。

    • 大于1.0时,表示绝对像素值。

    angle

    float

    [-9999.0, 9999.0]

    0.0

    旋转角度。

  • 线性

    type = mask_linear

    参数

    类型

    取值范围

    默认值

    说明

    x

    float

    [0.0, 素材宽]

    0.5

    线性遮罩中心基准点在素材内相比素材左上角的X坐标。

    • [0.0, 1.0]时表示相对素材宽的坐标。

    • 大于1.0时,表示绝对像素值。

    y

    float

    [0.0, 素材高]

    0.5

    线性遮罩中心基准点在视频素材内相比视频左上角的Y坐标。

    • [0.0, 1.0]时表示相对素材高的坐标。

    • 大于1.0时,表示绝对像素值。

    antialias

    float

    [0.0, 1.0]

    0.1

    线性遮罩的抗锯齿参数,值越大,边缘羽化程度越高。

    angle

    float

    [-9999.0, 9999.0]

    0.0

    旋转角度。

  • 镜面

    type = mask_minor

    参数

    类型

    取值范围

    默认值

    说明

    x

    float

    [0.0, 素材宽]

    0.5

    镜面遮罩中心基准点在素材内相比素材左上角的X坐标。

    • [0.0, 1.0]时表示相对素材宽的坐标。

    • 大于1.0时,表示绝对像素值。

    y

    float

    [0.0, 素材高]

    0.5

    镜面遮罩中心基准点在素材内相比素材左上角的Y坐标。

    • [0.0, 1.0]时表示相对素材高的坐标。

    • 大于1.0时,表示绝对像素值。

    antialias

    float

    [0.0, 1.0]

    0.1

    镜面遮罩的抗锯齿参数,值越大,边缘羽化程度越高。

    angle

    float

    [-9999.0, 9999.0]

    0.0

    旋转角度。

相关文档