logo
Video Call
Server API
Stream Mixing and Transcoding APIs
On this page

TranscodeMedia

GET

https://rtc-api.zego.im/

When users perform CDN recording, they can store the recorded media files on CDN servers and use this interface to perform on-demand transcoding on the media files, changing properties such as the source file's encoding format, resolution, and bitrate for playback on different terminals and network environments.

Warning

Before using this interface for the first time, please confirm whether CDN recording service has been activated. If not, please go to the ZEGOCLOUD Console to activate it yourself, for details, please refer to Console - Service Configuration - CDN, or contact ZEGOCLOUD Technical Support to activate it and configure the callback address. After the media file transcoding is completed, it will be notified through the on-demand transcoding completion callback.

Developers can view the transcoding task status, file playback URL and other detailed information through the on-demand transcoding completion callback or the query media file task interface.

Call frequency limit
All rooms under the same AppID are limited to 20 times/second

Request

Query Parameters

    Action stringrequired

    Possible values: [TranscodeMedia]

    Interface prototype parameters

    https://rtc-api.zego.im?Action=TranscodeMedia

    AppId uint32required

    💡Public parameter. Application ID, assigned by ZEGOCLOUD. Get it from the ZEGOCLOUD Admin Console.

    SignatureNonce stringrequired

    💡Common parameter. A 16-character hexadecimal random string (hex-encoded 8-byte random number). For the generation algorithm, refer to the signature example.

    Timestamp int64required

    💡Common parameter. Current Unix timestamp in seconds. For the generation algorithm, refer to the signature example. A maximum deviation of 10 minutes is allowed.

    Signature stringrequired

    💡Common parameter. Signature used to verify the legitimacy of the request. Please refer to the signature mechanism to generate it.

    SignatureVersion stringrequired

    Possible values: [2.0]

    Default value: 2.0

    💡Public parameter. Signature version number.

    Vendor stringrequired

    Possible values: [Tencent]

    CDN vendor name.

    Currently only supports Tencent: Tencent Cloud.

    FileId stringrequired

    Source file ID that needs transcoding, which can be obtained through the following methods:

    Note

    ZEGOCLOUD will not verify whether the "FileId file passed in actually exists", please pay attention to fill in the correct FileId; if an incorrect FileId is passed in, the Code in the response parameter will be 1000.

    Resolution stringrequired

    Possible values: [360p, 540p, 720p]

    Resolution of the transcoded media file, the following values are available:

    • 360p
    • 540p
    • 720p

    Note

    If you need to customize file transcoding parameters, please contact ZEGOCLOUD Technical Support to configure custom templates. For common transcoding specifications, the parameters corresponding to the default transcoding templates for each resolution are as follows:

    • 360p: Container format MP4, video encoding H.264, bitrate 400 kbps, frame rate 25 fps, audio encoding AAC.
    • 540p: Container format MP4, video encoding H.264, bitrate 1000 kbps, frame rate 25 fps, audio encoding AAC.
    • 720p: Container format MP4, video encoding H.264, bitrate 1800 kbps, frame rate 25 fps, audio encoding AAC.

Responses

Success
Schema
    Code int32

    Only the return codes related to interface business logic are listed here. For the complete return codes, please refer to Global Return Codes.

    Return CodeDescriptionSolution
    0Request successful.-
    2Input parameter error.-
    3Related permissions not activated.Please contact ZEGOCLOUD Technical Support.
    4CDN type mismatch.Please check the parameters.
    5Configuration error.Please contact ZEGOCLOUD Technical Support.
    6Request too frequent.Please try again later.
    7Authentication failed.Please check if the authentication parameters are correct.
    1000Request failed.Please contact ZEGOCLOUD Technical Support.
    41003File does not exist.Please confirm if the file format, file ID, etc. are correct.
    Message string

    Operation result description.

    RequestId string

    Request ID returned by ZEGOCLOUD server.

    Data object
    Response data.
    Tencent object
    Tencent Cloud return content (returned when Vendor is Tencent).
    TaskId string

    Unique identifier ID of the media file transcoding task, the transcoding result can be viewed through the on-demand transcoding completion callback.

    RequestId string

    Unique request ID returned by the CDN vendor corresponding to the Vendor parameter value in the request (i.e., Tencent), which needs to be provided when locating problems.

Previous

DescribeMediaTask

Next

MediaThumbnails

On this page

Back to top