All Products
Search
Document Center

Intelligent Media Services:Config object of a regular template

Last Updated:Nov 26, 2024

When you submit an editing and production task by specifying the TemplateId parameter, Intelligent Media Services (IMS) merges the Config object of the regular template specified by the TemplateId parameter and the specified settings of the ClipsParam parameter into a Timeline object. Then, you can edit and produce a video by using the Timeline object. This topic describes sample Config objects of regular templates and the corresponding Timeline objects.

Sample Config objects in which common parameters are used

Add watermarks to a video

Config

{
    "VideoTracks": [
        {  
            "VideoTrackClips": [
                {    
                    "MediaId": "$Video"
                }
            ]
        }
    ],
    "ImageTracks": [
        {
            "ImageTrackClips": [
                {
                    "ImageId": "******e01cb05d417c3dbcd1b9******",
                    "Width" : 200,
                    "Height" : 60,
                    "X" : 40,
                    "Y" : 40
                }
            ]
        }
    ]
}

Timeline

{
    "VideoTracks": [
        {  
            "VideoTrackClips": [
                {    
                    "MediaId": "****20b48fb04483915d4f2cd8ac****"
                }
            ]
        }
    ],
    "ImageTracks": [
        {
            "ImageTrackClips": [
                {
                    "ImageId": "******e01cb05d417c3dbcd1b9******",
                    "Width" : 200,
                    "Height" : 60,
                    "X" : 40,
                    "Y" : 40
                }
            ]
        }
    ]
}

Description:

  • Parameter values in the Config object of a regular template start with $. Example: "$Video" in the preceding sample Config object.

  • When you submit an editing and production task, set the TemplateId parameter to IceSys_SingleVideo_Watermark and add Video to the settings of the ClipsParam parameter. For more information about the generated Timeline object, see the preceding sample Timeline object.

    http://ice.cn-shanghai.aliyuncs.com/?Action=SubmitMediaProducingJob
    &TemplateID=IceSys_SingleVideo_Watermark
    &ClipsParam={\"Video\":\"****20b48fb04483915d4f2cd8ac****\"}
    &<Common parameters>

Add watermarks to a video (Default parameter values are supported in the Config object)

Config

{
    "VideoTracks": [
        {  
            "VideoTrackClips": [
                {    
                    "MediaId": "$Video"
                }
            ]
        }
    ],
    "ImageTracks": [
        {
            "ImageTrackClips": [
                {
                    "ImageId": "******e01cb05d417c3dbcd1b9******",
                    "Width" : 200,
                    "Height" : 60,
                    "X" : "$X:40",
                    "Y" : "$Y:40",
                    "TimelineIn" : "$TimelineIn:0",
                    "TimelineOut" : "$TimelineOut:NULL"
                }
            ]
        }
    ]
}

Timeline

{
    "VideoTracks": [
        {  
            "VideoTrackClips": [
                {    
                    "MediaId": "****20b48fb04483915d4f2cd8ac****"
                }
            ]
        }
    ],
    "ImageTracks": [
        {
            "ImageTrackClips": [
                {
                    "ImageId": "******e01cb05d417c3dbcd1b9******",
                    "Width" : 200,
                    "Height" : 60,
                    "X" : 40,
                    "Y" : 40,
                    "TimelineIn" : 5
                }
            ]
        }
    ]
}

Description:

  • Default parameter values are supported in the Config object of a regular template. If you do not specify parameters, IMS uses the default values of the parameters. Examples: "$TimelineIn:0" and "$TimelineOut:NULL" in the preceding sample Config object. The values after the colons (:) are the default values of the TimelineIn and TimelineOut parameters.

  • If the default value of a parameter is NULL and you do not specify the parameter, the parameter is deleted from the generated Timeline object.

  • When you submit an editing and production task, set the TemplateId parameter to IceSys_SingleVideo_Watermark and add Video to the settings of the ClipsParam parameter. For more information about the generated Timeline object, see the preceding sample Timeline object.

    http://ice.cn-shanghai.aliyuncs.com/?Action=SubmitMediaProducingJob
    &TemplateId=IceSys_SingleVideo_Watermark
    &ClipsParam={\"Video\":\"****20b48fb04483915d4f2cd8ac****\",\"TimelineIn\":\"5\"}
    &<Common parameters>

Sample Config objects in which array parameters are used

Mute an entire video track

Config

{
    "VideoTracks": [
        {
            "VideoTrackClips": [
                {
                    "Sys_Type" : "ArrayItems",
                    "Sys_ArrayObject" : "$VideoArray",
                    "Sys_Template" : {
                        "MediaId" : "$MediaId",
                        "Effects": [
                            {
                                "Type": "Volume",
                                "Gain": "0"
                            }
                        ]
                    }
                }
            ]
        }
    ]
}

Timeline

{
    "VideoTracks": [
        {
            "VideoTrackClips": [
                {
                    "MediaId" : "******05512043f49f697f7425******",
                    "Effects": [
                        {
                            "Type": "Volume",
                            "Gain": "0",
                        }
                    ]
                },
                {
                    "MediaId" : "******2788e810116a45109f2e******",
                    "Effects": [
                        {
                            "Type": "Volume",
                            "Gain": "0",
                        }
                    ]
                },
                {
                    "MediaId" : "******67f44f4964e6c998dee8******",
                    "Effects": [
                        {
                            "Type": "Volume",
                            "Gain": "0",
                        }
                    ]
                }
            ]
        }
    ]
}

Description:

  • The following section in the preceding sample Config object uses an array-based structure to accommodate a variable number of materials defined in $VideoArray:

    {
        "Sys_Type" : "ArrayItems",
        "Sys_ArrayObject" : "$VideoArray",
        "Sys_Template" : {
            "MediaId" : "$MediaId",
            "Effects": [
                {
                    "Type": "Volume",
                    "Gain": "0"
                }
            ]
        }
    }

    When you submit an editing and production task, set the TemplateId parameter to IceSys_VideoMute and add VideoArray to the settings of the ClipsParam parameter. To generate a Timeline object, IMS traverses the VideoArray parameter, generates elements by using the Sys_Template object, and encapsulates the elements into a new array. For more information about the generated Timeline object, see the preceding sample Timeline object.

    http://ice.cn-shanghai.aliyuncs.com/?Action=SubmitMediaProducingJob
    &TemplateID=IceSys_VideoMute
    &ClipsParam={\"VideoArray\":[{\"MediaId\":\"******05512043f49f697f7425******\"},{\"MediaId\":\"******05512043f49f697f7425******\"},{\"MediaId\":\"******05512043f49f697f7425******\"}]}
    &<Common parameters>
  • If the Sys_Template object contains only one parameter, you can simplify parameter input by specifying only the parameter values for elements in the array. You do not need to specify the corresponding parameter names. The generated Timeline object is the same as the preceding sample Timeline object.

    http://ice.cn-shanghai.aliyuncs.com/?Action=SubmitMediaProducingJob
    &TemplateID=IceSys_VideoMute
    &ClipsParam={\"VideoArray\":[\"b3f37e05512043f49f697f7425b9188b\",\"9987d22788e810116a45109f2ea88648\",\"a8f5f167f44f4964e6c998dee827110c\"]}
    &<Common parameters>

Add intro and outro videos

Config

{
    "VideoTracks": [
        {
            "VideoTrackClips": [
                {
                    "MediaId": "******2788e810116a45109f2e******" // The ID of the intro video to be merged.
                },
                {
                    "Sys_Type" : "ArrayItems",
                    "Sys_ArrayObject" : "$VideoArray",
                    "Sys_Template" : {
                        "MediaId" : "$MediaId"
                    }
                },
                {
                    "MediaId": "******67f44f4964e6c998dee8******" // The ID of the outro video to be merged.
                }
            ]
        }
    ]
}

Timeline

{
    "VideoTracks": [
        {
            "VideoTrackClips": [
                {
                    "MediaId": "******2788e810116a45109f2e******" // The ID of the intro video to be merged.
                },
                {
                    "MediaId": "******05512043f49f697f7425******"
                },
                {
                    "MediaId": "******2788e810116a45109f2e******"
                },
                {
                    "MediaId": "******67f44f4964e6c998dee8******"
                },
                {
                    "MediaId": "******67f44f4964e6c998dee8******" // The ID of the outro video to be merged.
                }
            ]
        }
    ]
}

Description:

A regular template inserts a fixed intro video and a fixed outro video at the beginning and end of a video track. You need to specify a variable number of materials between the intro video and outro video by using an array parameter. When you submit an editing and production task, set the TemplateId parameter to IceSys_OpeningEnding and add VideoArray to the settings of the ClipsParam parameter.

http://ice.cn-shanghai.aliyuncs.com/?Action=SubmitMediaProducingJob
&TemplateID=IceSys_OpeningEnding
&ClipsParam={\"VideoArray\":[\"******05512043f49f697f7425******\",\"******2788e810116a45109f2e******\",\"******67f44f4964e6c998dee8******\"]}
&<Common parameters>

To generate a Timeline object, IMS traverses the VideoArray parameter, generates elements by using the Sys_Template object, and encapsulates the elements into a new array. However, the format of the preliminarily generated Timeline object is invalid because the intermediate items between the intro video and outro video in VideoTrackClips are processed as a clip array. Sample code:

{
    "VideoTracks": [
        {
            "VideoTrackClips": [
                {
                    "MediaId": "******2788e810116a45109f2e******" // The ID of the intro video to be merged.
                },
                [
                    {
                        "MediaId": "******05512043f49f697f7425******"
                    },
                    {
                        "MediaId": "******2788e810116a45109f2e******"
                    },
                    {
                        "MediaId": "******67f44f4964e6c998dee8******"
                    }
                ],
                {
                    "MediaId": "******67f44f4964e6c998dee8******" // The ID of the outro video to be merged.
                }
            ]
        }
    ]
}

In this case, IMS performs automatic fault tolerance. Specifically, IMS extracts the elements in the array based on the current context and transforms the array into a one-dimensional array. For more information about the finally generated Timeline object, see the preceding sample Timeline object.

References