Last updated: 2020-03-27 18:45:24

1. API Description

Domain name for API request:

This API is used to compose a media file, including:

  1. Clipping a media file to generate a new media file;
  2. Clipping and splicing multiple media files to generate a new media file;
  3. Clipping and splicing the media streams of multiple media files to generate a new media file;

A maximum of 100 requests can be initiated per second for this API.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: ComposeMedia.
Version Yes String Common parameter. The value used for this API: 2018-07-17.
Region No String Common parameter. This parameter is not required for this API.
Tracks.N Yes Array of MediaTrack List of input media tracks, i.e., information of multiple tracks composed of video, audio, image, and other materials. Multiple input tracks are aligned with the output media file on the time axis. The materials of each track at the same time point on the time axis will be superimposed. Specifically, videos or images will be superimposed for video image by track order, where a material with a higher track order will be more on top, while audio materials will be mixed.
Output Yes ComposeMediaOutput Information of output media file.
Canvas No Canvas Canvas used for composing video file.
SubAppId No Integer Subapplication ID in VOD. If you need to access a resource in a subapplication, enter the subapplication ID in this field; otherwise, leave it empty.

3. Output Parameters

Parameter Name Type Description
TaskId String Media file composing task ID, which can be used to query the status of composing task (with task type being MakeMedia).
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Dubbing a VOD video

This example shows you how to remove the original audio from 5285485487985271487, dub it starting from the 5th second with 5285485487985271488, and dub it starting from the 20th second with the 2nd to 16th seconds of 5285485487985271489 to generate a new VOD video.

Input Example
&<Common request parameters>

Output Example

  "Response": {
    "RequestId": "6ca31e3a-6b8e-4b4e-9256-fdc700064ef3",
    "TaskId": "125xxx65-ComposeMedia-bffb15f07530b57bc1aabb01fac74bca"

Example2 Clipping and splicing two video streams

This example shows you how to take the 2nd to 62nd seconds of 5285485487985271487 and the 6th to 81th seconds of 5285485487985271488 for splicing, set a fade-in/fade-out transition of 5 seconds in between, and paste image 5285485487985271489 with width and height of (100px, 100px) between the 3rd and 18th seconds of the video at the position of (20px, 20px).

Input Example
&<Common request parameters>

Output Example

  "Response": {
    "RequestId": "6ca31e3a-6b8e-4b4e-9256-fdc700064ef3",
    "TaskId": "125xxx65-ComposeMedia-bffb15f07530b57bc1aabb01fac74bc2"

5. Developer Resources

API Explorer

This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.


TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation.UploadCosFail Operation failed: failed to upload file to COS.
InternalError Internal error.
InternalError.GetFileInfoError Internal error: an error occurred while getting media file information.
InternalError.GetMediaListError Internal error: an error occurred while getting the media list.
InvalidParameter Invalid parameter.
InvalidParameterValue.ClipDuration Incorrect parameter value: the clipping duration is too long.
UnauthorizedOperation Unauthorized operation.

Was this page helpful?

Was this page helpful?

  • Not at all
  • Not very helpful
  • Somewhat helpful
  • Very helpful
  • Extremely helpful
Send Feedback