All Products
Search
Document Center

Intelligent Media Services:Edit images and videos

Last Updated:Jan 09, 2025

This topic describes how to configure the Timeline parameters in the SubmitMediaProducingJob operation to edit images and videos. 

Usage notes

  • Intelligent production supports editing and compositing, effect rendering, and templates for live streams, VOD files, and material files from Object Storage Service (OSS). For more information, see Intelligent production overview.

  • You can produce a video from one or more videos, audio files, images, and subtitle materials by configuring Timeline parameters and calling the SubmitMediaProducingJob operation.

  • A timeline is created when you add materials and configure effects to create a video. A timeline consists of tracks, materials, and effects. For more information, see Timeline configurations.

  • For more information about how to use the IMS SDK to edit audio and video files, see Preparations.

Configure the video width and height

When you call the SubmitMediaProducingJob operation to submit a video editing task, you can use the Width and Height fields in the OutputMediaConfig parameter to define the resolution of the output video. 

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);

Rotate a video from the landscape mode to the portrait mode and add black bars

If the video in the timeline is in the landscape mode, and you set the output video to the portrait mode when you submit the editing task, the system scales the video to fit the new dimensions and centers it within the frame. 

Effect

Timeline example

{
  "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"
    }]
  }]
}

Rotate a video from the landscape mode to the portrait mode and blur the blank area

Value range of Radius: [0.01, 1]. For more information, see Effect Type:Background

Effect

Timeline example

{
	"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
			}]
		}]
	}]
}

Convert a landscape video into a 3-split screen video in the portrait mode

The AdaptMode=Cover parameter indicates that the material is resized according to the original aspect ratio to fill in the view. For information about other parameters, see VideoTrackClip

Effect

Timeline example

{
  "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": "Heading",
          "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": "Subheading",
          "Alignment": "TopCenter",
          "FontSize": 45,
          "FontColor": "#ffffff",
          "FontFace": {
            "Bold": false,
            "Italic": true,
            "Underline": true
          }
        }
      ]
    },
    {
      "SubtitleTrackClips":[
        {
          "Type":"Text",
          "X": 0,
          "Y": 900,
          "Font": "AlibabaPuHuiTi",
          "Content": "Subtitles can be added during editing\n Line breaks can be added for multi-line display",
          "Alignment": "TopCenter",
          "FontSize": 40,
          "FontColor": "#ffffff",
          "FontFace": {
            "Bold": true,
            "Italic": false,
            "Underline": false
          }
        }
      ]
    }
  ]
}

Rotate a video from the landscape mode to the portrait mode and set the background color

Effect

Timeline example

{
  "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"
      }]
    }]
  }]
}

Extract a video clip

By configuring In=3 and Out=8, you can extract a clip that spans from the third second to the eighth second from the video. 

Effect

Timeline example

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

Extract and merge multiple video clips

You can leave the TimelineIn and TimelineOut fields empty. By default, the system merges the clips by using their default start and end time. 

If MaxOut is set to 5, a maximum of 5 seconds are extracted from the clip. 

  • If the duration of the clip exceeds 5 seconds, only the first 5 seconds are extracted.

  • If the duration of the clip is less than 5 seconds, the entire clip up to its end is extracted. 

Effect

Timeline example

{
  "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
      }]
    }]
  }]
}

Edit images and videos

The default value of Type is Video. If you want to edit images, set Type to Image. 

Effect

Timeline example

{
  "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
    }]
  }]
}

Add a watermark, sticker, or GIF sticker

To edit images in GIF format, you must configure the DyncFrames parameter, which specifies the frame rate of GIF materials. 

Effect

Timeline example

{
  "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
    }]
  }]
}

Configure scaling

The valid values of AdaptMode are Contain, Cover, and Fill. For more information, see VideoTrackClip

Effect

Timeline example

{
  "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: resizes the material based on the original aspect ratio to fill in the view. If the aspect ratio of the object does not match the view, the object is cropped based on the width and height of the frame.",
          "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: resizes the material based on the original aspect ratio of the material to fill in the view.",
          "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 (default): resizes the material based on the original aspect ratio and stretches the material to fill in the view.",   
          "FontSize": 30,
          "FontColor": "#ffffff",
          "AdaptMode": "AutoWrap",
          "TextWidth": 1,
          "FontFace": {
            "Bold": true,
            "Italic": false,
            "Underline": false
          }
        }
      ]
    }
  ]
}

Configure picture-in-picture

In VideoTracks, the order of tracks in the array matters, with the last track being rendered on top of the previous tracks. 

Effect

Timeline example

{
  "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
    }]
  }]
}

Configure a horizontal or vertical flip

Effect

Timeline example

{
  "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": "Original video",
              "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": "Horizontal flip",
              "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": "Vertical flip",
              "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": "Horizontal flip and vertical flip",
              "Alignment": "TopLeft",
              "FontSize": 80,
              "FontColor": "#F5FFFA",
              "TimelineIn": 0,
              "TimelineOut": 10,
              "Outline": 1,
              "OutlineColour": "#0e0100"
            }
          ]
        }
      ]
    }
  ]
}

Crop a video

Effect

Timeline example

{
  "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": "Crop the video by 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": "Crop the video by 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": "No cropping",
        "FixedY": 150,
        "Alignment": "TopCenter",
        "FixedFontSize": 70,
        "FontColor": "#F5FFFA",
        "Outline": 1,
        "OutlineColour": "#0e0100"
      }]
    }]
  }]
}

Configure speed ramping

In AudioTrackClips, you can use the Speed parameter to configure audio and video speed ramping. 

Effect

Timeline example

{
  "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": "Original speed",
        "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": "2x speed",
        "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": "3x speed",
        "FixedY": 150,
        "Alignment": "TopCenter",
        "FixedFontSize": 70,
        "FontColor": "#F5FFFA"
      }]
    }]
  }]
}

Rotate a material

Effect

Timeline example

{
  "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": "Original angle",
        "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": "Rotate by 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": "Rotate 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": "Rotate by 270°",
        "FixedY": 150,
        "Alignment": "TopCenter",
        "FixedFontSize": 70,
        "FontColor": "#F5FFFA",
        "Outline": 1,
        "OutlineColour": "#0e0100"
      }]
    }]
  }]
}

Create circle, rectangle, linear, and mirror masks

Effect

Timeline example

{
    "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"
                        }
                    ]
                }
            ]
        }
    ]
}

Parameter description

  • Circle (ellipse)

    type = mask_circle

    Parameter

    Type

    Valid values

    Default value

    Description

    x

    float

    [0.0, material width]

    0.5

    The X coordinate of the center of the circle relative to the top-left corner of the material.

    • When the value is in the range of [0.0, 1.0], it indicates the coordinate relative to the material width.

    • When the value is greater than 1.0, it indicates the absolute pixel value.

    y

    float

    [0.0, material height]

    0.5

    The Y coordinate of the center of the circle relative to the top-left corner of the material.

    • When the value is in the range of [0.0, 1.0], it indicates the coordinate relative to the material height.

    • When the value is greater than 1.0, it indicates the absolute pixel value.

    width

    float

    [0.0, material width]

    0.8

    The width of the ellipse relative to the width of the material.

    • When the value is in the range of [0.0, 1.0], it indicates the width relative to the material width.

    • When the value is greater than 1.0, it indicates the absolute pixel value.

    height

    float

    [0.0, material height]

    0.8

    The height of the ellipse relative to the height of the material.

    • When the value is in the range of [0.0, 1.0], it indicates the height relative to the material height.

    • When the value is greater than 1.0, it indicates the absolute pixel value.

    antialias

    float

    [0.0, 1.0]

    0.1

    The antialiasing parameter of the ellipse. The larger the value, the higher the degree of edge feathering.

    angle

    float

    [-9999.0, 9999.0]

    0.0

    The rotation angle.

  • Rectangle

    type = mask_rec

    Parameter

    Type

    Valid values

    Default value

    Description

    x

    float

    [0.0, material width]

    0.5

    The X coordinate of the center of the rectangle relative to the top-left corner of the material.

    • When the value is in the range of [0.0, 1.0], it indicates the coordinate relative to the material width.

    • When the value is greater than 1.0, it indicates the absolute pixel value.

    y

    float

    [0.0, material height]

    0.5

    The Y coordinate of the center of the rectangle relative to the top-left corner of the material.

    • When the value is in the range of [0.0, 1.0], it indicates the coordinate relative to the material height.

    • When the value is greater than 1.0, it indicates the absolute pixel value.

    width

    float

    [0.0, material width]

    0.8

    The width of the rectangle.

    • When the value is in the range of [0.0, 1.0], it indicates the width relative to the material width.

    • When the value is greater than 1.0, it indicates the absolute pixel value.

    height

    float

    [0.0, material height]

    0.8

    The height of the rectangle.

    • When the value is in the range of [0.0, 1.0], it indicates the height relative to the material height.

    • When the value is greater than 1.0, it indicates the absolute pixel value.

    antialias

    float

    [0.0, 1.0]

    0.1

    The antialiasing parameter of the rectangle. The larger the value, the higher the degree of edge feathering.

    radius

    float

    [0.0, the larger value of material width or height]

    0.1

    The border radius of the rectangle.

    • When the value is in the range of [0.0, 1.0], it indicates the radius relative to the larger value of the material width or height.

    • When the value is greater than 1.0, it indicates the absolute pixel value.

    angle

    float

    [-9999.0, 9999.0]

    0.0

    The rotation angle.

  • Linear

    type = mask_linear

    Parameter

    Type

    Valid values

    Default value

    Description

    x

    float

    [0.0, material width]

    0.5

    The X coordinate of the center reference point of the linear mask relative to the top-left corner of the material.

    • When the value is in the range of [0.0, 1.0], it indicates the coordinate relative to the material width.

    • When the value is greater than 1.0, it indicates the absolute pixel value.

    y

    float

    [0.0, material height]

    0.5

    The Y coordinate of the center reference point of the linear mask relative to the top-left corner of the video material.

    • When the value is in the range of [0.0, 1.0], it indicates the coordinate relative to the material height.

    • When the value is greater than 1.0, it indicates the absolute pixel value.

    antialias

    float

    [0.0, 1.0]

    0.1

    The antialiasing parameter of the linear mask. The larger the value, the higher the degree of edge feathering.

    angle

    float

    [-9999.0, 9999.0]

    0.0

    The rotation angle.

  • Mirror

    type = mask_minor

    Parameter

    Type

    Valid values

    Default value

    Description

    x

    float

    [0.0, material width]

    0.5

    The X coordinate of the center reference point of the mirror mask relative to the top-left corner of the material.

    • When the value is in the range of [0.0, 1.0], it indicates the coordinate relative to the material width.

    • When the value is greater than 1.0, it indicates the absolute pixel value.

    y

    float

    [0.0, material height]

    0.5

    The Y coordinate of the center reference point of the mirror mask relative to the top-left corner of the material.

    • When the value is in the range of [0.0, 1.0], it indicates the coordinate relative to the material height.

    • When the value is greater than 1.0, it indicates the absolute pixel value.

    antialias

    float

    [0.0, 1.0]

    0.1

    The antialiasing parameter of the mirror mask. The larger the value, the higher the degree of edge feathering.

    angle

    float

    [-9999.0, 9999.0]

    0.0

    The rotation angle.

References