When you submit a video editing job using a `TemplateId`, the system merges the `Config` of the standard template with the `ClipsParam` input parameter to create a Timeline. The job is then processed based on this Timeline. This topic describes the `Config` of common standard templates and analyzes the resulting Timelines.
Example: Standard parameters in a Config
Add a watermark to a video
Config | Timeline |
Analysis:
In a standard template `Config`, parameter fields start with a dollar sign ($), such as
"$Video"in the preceding `Config` example.When you submit a video editing job, set the `TemplateId` parameter to
IceSys_SingleVideo_Watermarkand specify theVideofield in `ClipsParam`. The final merged timeline is shown in the preceding Timeline example.http://ice.cn-shanghai.aliyuncs.com/?Action=SubmitMediaProducingJob &TemplateID=IceSys_SingleVideo_Watermark &ClipsParam={\"Video\":\"****20b48fb04483915d4f2cd8ac****\"} &<common parameters>
Add a watermark to a video (Config with default values)
Config | Timeline |
Analysis:
A standard template `Config` supports default values. If you do not specify a parameter field in the request, the system uses the default value. For example, in the preceding `Config` code,
"$TimelineIn:0"and"$TimelineOut:NULL"specify default values. The value after the colon (:) is the default value for the field.If the default value is `NULL` and you do not include the parameter in the request, the system removes the field from the final Timeline.
When you submit a video editing job, set the `TemplateId` parameter to
IceSys_SingleVideo_Watermarkand specify the required fields in `ClipsParam`. The final merged timeline is shown in the preceding Timeline example.http://ice.cn-shanghai.aliyuncs.com/?Action=SubmitMediaProducingJob &TemplateId=IceSys_SingleVideo_Watermark &ClipsParam={\"Video\":\"****20b48fb04483915d4f2cd8ac****\",\"TimelineIn\":\"5\"} &<common parameters>
Example: Array parameters in a Config
Mute an entire video track
Config | Timeline |
Analysis:
The following code from the preceding `Config` example shows an array parameter. This lets you pass a variable number of media assets.
{ "Sys_Type" : "ArrayItems", "Sys_ArrayObject" : "$VideoArray", "Sys_Template" : { "MediaId" : "$MediaId", "Effects": [ { "Type": "Volume", "Gain": "0" } ] } }When you submit a video editing job, set the `TemplateId` parameter to
IceSys_VideoMuteand pass the `VideoArray` array in `ClipsParam`. To create the Timeline, the system traverses `VideoArray`, uses `Sys_Template` to generate each element, and then encapsulates the elements into a new array. The final merged timeline is shown in the preceding Timeline example.http://ice.cn-shanghai.aliyuncs.com/?Action=SubmitMediaProducingJob &TemplateID=IceSys_VideoMute &ClipsParam={\"VideoArray\":[{\"MediaId\":\"******05512043f49f697f7425******\"},{\"MediaId\":\"******05512043f49f697f7425******\"},{\"MediaId\":\"******05512043f49f697f7425******\"}]} &<common parameters>If `Sys_Template` contains only one parameter, you can simplify the input. You do not need to specify the parameter name for each element in the array. Instead, you can simply pass the corresponding values. The final merged timeline is the same as the one in the preceding Timeline example.
http://ice.cn-shanghai.aliyuncs.com/?Action=SubmitMediaProducingJob &TemplateID=IceSys_VideoMute &ClipsParam={\"VideoArray\":[\"b3f37e05512043f49f697f7425b9188b\",\"9987d22788e810116a45109f2ea88648\",\"a8f5f167f44f4964e6c998dee827110c\"]} &<common parameters>
Add an opening and a closing clip
Config | Timeline |
Analysis:
This standard template inserts a fixed opening clip at the beginning of the video track and a fixed closing clip at the end. The array parameter between them requires a variable number of media assets. When you submit a video editing job, set the `TemplateId` parameter to IceSys_OpeningEnding and pass the `VideoArray` array in `ClipsParam`.
http://ice.cn-shanghai.aliyuncs.com/?Action=SubmitMediaProducingJob
&TemplateID=IceSys_OpeningEnding
&ClipsParam={\"VideoArray\":[\"******05512043f49f697f7425******\",\"******2788e810116a45109f2e******\",\"******67f44f4964e6c998dee8******\"]}
&<common parameters>To create the Timeline, the system traverses `VideoArray`. The system uses `Sys_Template` as a template to generate each element and encapsulates them into a new array. This creates an initial Timeline. This Timeline has an abnormal format because the middle item in `VideoTrackClips` is processed into a nested clip array, as shown below:
{
"VideoTracks": [
{
"VideoTrackClips": [
{
"MediaId": "******2788e810116a45109f2e******" // This is the opening video clip.
},
[
{
"MediaId": "******05512043f49f697f7425******"
},
{
"MediaId": "******2788e810116a45109f2e******"
},
{
"MediaId": "******67f44f4964e6c998dee8******"
}
],
{
"MediaId": "******67f44f4964e6c998dee8******" // This is the closing video clip.
}
]
}
]
}To handle this, the Intelligent Media Services system performs fault tolerance processing. The system extracts the elements from the nested array based on the current context and processes them into a one-dimensional array. The final merged timeline is shown in the preceding Timeline example.