Video compositing is an offline task that performs a series of complicated operations on a video in VOD such as clipping, splicing, overlaying, and flipping. It can achieve the following effects:
The container format of the media file after compositing is MP4 (video) or MP3 (audio).
You can initiate a video compositing task by calling a server API. The return result of the API contains the task ID, which is used to associate with the corresponding task result when getting result.
After initiating a compositing task, you can wait for result notification asynchronously or perform task query synchronously to get the task execution result. Below is an example of getting the result notification in normal callback mode after the video compositing task is initiated (the fields with null value are omitted):
{
"EventType": "ComposeMediaComplete",
"ComposeMediaCompleteEvent": {
"TaskId": "ComposeMedia-f5ac8127b3b6b85cdc13f237c6005d8",
"Status": "FINISH",
"ErrCode": 0,
"Message": "SUCCESS",
"Input":{
"Tracks": [{
"Type": "Video",
"TrackItems": [{
"Type": "Video",
"SourceMedia": "5285485487985271487",
"AudioOperations": [{
"Type": "Volume",
"VolumeParam": {
"Mute": 1
}
}]
}]
},
{
"Type": "Audio",
"TrackItems": [{
"Type": "Empty",
"EmptyItem": {
"Duration": 5
}
},
{
"Type": "Audio",
"AudioItem": {
"SourceMedia": "5285485487985271488",
"Duration": 15
}
},
{
"Type": "Audio",
"AudioItem": {
"SourceMedia": "5285485487985271489",
"SourceMediaStartTime": 2,
"Duration": 14
}
}
]
}
],
"Output": {
"FileName": "Video compositing effect test",
"Container": "mp4"
}
},
"Output": {
"FileType": "mp4",
"FileId": 5285485487985271490,
"FileUrl": "http://125676836723.vod2.myqcloud.com/xxx/xxx/xxx.mp4"
}
}
}
In the callback result, Input.Tracks
contains two elements in Type
of Video
and Audio
, indicating the composited video contains a video track and an audio track.
5285485487985271487
, and the video is muted.Output.FileId
is the FileId
of the new video generated after video compositing, and the playback URL is the value in FileUrl
.
Was this page helpful?