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 |
|
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 |
|
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 |
|
Rotate a video from the landscape mode to the portrait mode and set the background color
Effect | Timeline example |
|
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 |
|
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 |
|
Edit images and videos
The default value of Type is Video. If you want to edit images, set Type to Image.
Effect | Timeline example |
|
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 |
|
Configure scaling
The valid values of AdaptMode are Contain, Cover, and Fill. For more information, see VideoTrackClip.
Effect | Timeline example |
|
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 |
|
Configure a horizontal or vertical flip
Effect | Timeline example |
|
Crop a video
Effect | Timeline example |
|
Configure speed ramping
In AudioTrackClips, you can use the Speed parameter to configure audio and video speed ramping.
Effect | Timeline example |
|
Rotate a material
Effect | Timeline example |
|
Create circle, rectangle, linear, and mirror masks
Effect | Timeline example |
|
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.