Skip to main content

Custom transcoding

Create a custom transcoding template

Creates a custom transcoding template for the specified entry point.

HTTP request


_1
POST https://api.agora.io/v1/projects/{appid}/fls/entry_points/{entry_point}/settings/transcode/custom?id={name}

Path parameter

ParameterTypeDescription
appidStringRequired. The App ID retrieved from Agora Console.
entry_pointStringRequired. The entry point name.
nameStringRequired. The name of the custom transcoding template. This name must be different from the name of any preset transcoding templates; otherwise, an error occurs.

Request body

The request body is in the JSON Object type, and contains the following fields:

FieldTypeDescription
widthIntegerRequired. The width (pixels) of the video. The value range is [0, 1920], where 0 means to adapt using the original aspect ratio.
heightIntegerRequired. The height (pixels) of the video. The value range is [0,1920], where 0 means to adapt using the original aspect ratio.
videoCodecStringOptional. The video encoding format. Only H.264 is supported. If videoBitrate and profile are specified, this field is required.
videoBitrateIntegerOptional. The video bitrate (bit/s). The value range is [200, 6000].
profileStringOptional. The encoding profile. Each profile represents a set of encoding parameters. Generally speaking, a higher profile means better video quality and requires more resources for encoding and decoding. Possible values include the following:
  • base: The base profile, which is suitable for mobile devices.
  • main: The standard profile, which is suitable for standard-resolution devices.
  • high: The high profile, which is suitable for high-resolution devices.
  • audioCodecStringOptional. The audio encoding format. Only AAC is supported. If audioBitrate and audioSampleRate are specified, this field is required.
    audioBitrateIntegerOptional. The audio bitrate (bit/s). The value range is [100,500].
    audioSampleRateIntegerOptional. The audio sampling rate (Hz). Possible values include: 96000, 88200, 64000, 48000, 44100, 32000, and 16000.

    HTTP response

    If the returned HTTP status code is 200, the request is successful.

    If the returned HTTP status code is not 200, the request fails. You can refer to the HTTP status codes for possible reasons.

    Example

    Request line


    _1
    POST https://api.agora.io/v1/projects/{your_appid}/fls/entry_points/live/settings/transcode/custom?id={name} HTTP/1.1

    Request body


    _10
    {
    _10
    "width": 0,
    _10
    "height": 360,
    _10
    "videoCodec": "h264",
    _10
    "videoBitrate": 1200,
    _10
    "profile": "base",
    _10
    "audioCodec": "aac",
    _10
    "audioBitrate": 320,
    _10
    "audioSampleRate": 44100
    _10
    }

    Response line


    _1
    HTTP/1.1 200 OK

    Update a custom transcoding template

    Updates the custom transcoding template for the specified entry point.

    HTTP request


    _1
    PATCH https://api.agora.io/v1/projects/{appid}/fls/entry_points/{entry_point}/settings/transcode/custom/{name}

    Path parameter

    ParameterTypeDescription
    appidStringRequired. The App ID retrieved from Agora Console.
    entry_pointStringRequired. The entry point name.
    nameStringRequired. The name of the custom transcoding template.

    Request body

    The request body is in the JSON Object type, and contains the following fields:

    FieldTypeDescription
    widthIntegerOptional. The width (pixels) of the video. The value range is [0, 1920], where 0 means to adapt using the original aspect ratio. If height is specified, this field is required.
    heightIntegerOptional. The height (pixels) of the video. The value range is [0,1920], where 0 means to adapt using the original aspect ratio. If width is specified, this field is required.
    videoCodecStringOptional. The video encoding format. Only H.264 is supported. If videoBitrate and profile are specified, this field is required.
    videoBitrateIntegerOptional. The video bitrate (bit/s). The value range is [200, 6000].
    profileStringOptional. The encoding profile. Each profile represents a set of encoding parameters. Generally speaking, a higher profile means better video quality and requires more resources for encoding and decoding. Possible values include the following:
  • base: The base profile, which is suitable for mobile devices.
  • main: The standard profile, which is suitable for standard-resolution devices.
  • high: The high profile, which is suitable for high-resolution devices.
  • audioCodecStringOptional. The audio encoding format. Only AAC is supported. If audioBitrate and audioSampleRate are specified, this field is required.
    audioBitrateIntegerOptional. The audio bitrate (bit/s). The value range is [100,500].
    audioSampleRateIntegerOptional. The audio sampling rate (Hz). Possible values include: 96000, 88200, 64000, 48000, 44100, 32000, and 16000.

    HTTP response

    If the returned HTTP status code is 200, the request is successful.

    If the returned HTTP status code is not 200, the request fails. You can refer to the HTTP status codes for possible reasons.

    Example

    Request line


    _1
    PATCH https://api.agora.io/v1/projects/{your_appid}/fls/entry_points/live/settings/transcode/custom/{name} HTTP/1.1

    Request body


    _10
    {
    _10
    "width": 0,
    _10
    "height": 360,
    _10
    "videoCodec": "h264",
    _10
    "videoBitrate": 1200,
    _10
    "profile": "base",
    _10
    "audioCodec": "aac",
    _10
    "audioBitrate": 320,
    _10
    "audioSampleRate": 44100
    _10
    }

    Response line


    _1
    HTTP/1.1 200 OK

    Delete a custom transcoding template

    Deletes the custom transcoding template for the specified entry point.

    HTTP request


    _1
    DELETE https://api.agora.io/v1/projects/{appid}/fls/entry_points/{entry_point}/settings/transcode/custom/{name}

    Path parameter

    ParameterTypeDescription
    appidStringRequired. The App ID retrieved from Agora Console.
    entry_pointStringRequired. The entry point name.
    nameStringRequired. The name of the custom transcoding template.

    HTTP response

    If the returned HTTP status code is 200, the request is successful.

    If the returned HTTP status code is not 200, the request fails. You can refer to the HTTP status codes for possible reasons.

    Example

    Request line


    _1
    DELETE https://api.agora.io/v1/projects/{your_appid}/fls/entry_points/live/settings/transcode/custom/{name} HTTP/1.1

    Response line


    _1
    HTTP/1.1 200 OK

    List custom transcoding templates

    Lists the custom transcoding templates for the specified entry point.

    HTTP request


    _1
    GET https://api.agora.io/v1/projects/{appid}/fls/entry_points/{entry_point}/settings/transcode/custom

    Path parameter

    ParameterTypeDescription
    appidStringRequired. The App ID retrieved from Agora Console.
    entry_pointStringRequired. The entry point name.
    nameStringRequired. The name of the custom transcoding template.

    HTTP response

    If the returned HTTP status code is 200, the request is successful. The response body contains the following fields:

    • transcodeList: JSON Array. The list of custom transcoding templates for the entry point. Each custom transcoding template corresponds to a JSON Object and contains the following fields:
    FieldTypeDescription
    nameStringRequired. The transcoding template name.
    widthIntegerRequired. The width of the video.
    heightIntegerRequired. The height of the video.
    videoCodecStringOptional. The video encoding format. Only H.264 is supported.
    videoBitrateIntegerOptional. The video bitrate (bit/s).
    profileStringOptional. The encoding profile.
  • base: The base profile, which is suitable for mobile devices.
  • main: The standard profile, which is suitable for standard-resolution devices.
  • high: The high profile, which is suitable for high-resolution devices.
  • audioCodecStringOptional. The audio encoding format. Only AAC is supported.
    audioBitrateIntegerOptional. The audio bitrate (bit/s).
    audioSampleRateIntegerOptional. The audio sampling rate (Hz).

    If the returned HTTP status code is not 200, the request fails. You can refer to the HTTP status codes for possible reasons.

    Example

    Request line


    _1
    GET https://api.agora.io/v1/projects/{your_appid}/fls/entry_points/live/settings/transcode/custom HTTP/1.1

    Request body


    _15
    {
    _15
    "transcodeList": [
    _15
    {
    _15
    "name": "{your_transcode_name}",
    _15
    "width": 0,
    _15
    "height": 360,
    _15
    "videoCodec": "h264",
    _15
    "videoBitrate": 1200,
    _15
    "profile": "base",
    _15
    "audioCodec": "aac",
    _15
    "audioBitrate": 320,
    _15
    "audioSampleRate": 44100
    _15
    }
    _15
    ]
    _15
    }

    Response line


    _1
    HTTP/1.1 200 OK

    HTTP status codes

    Status codeDescription
    200The request succeeds.
    400The parameter is invalid, for example the appid or the entry_point is empty, or the region parameter value is invalid.
    401Unauthorized (the customer ID and the customer secret do not match).
    404The server cannot find the resource according to the request, which means the requested entry point does not exist or the requested URI path is invalid.
    500An internal error occurs in the server, so the server is not able to complete the request.
    504An internal error occurs in the server. The gateway or the proxy server did not receive a timely request from the remote server.

    Page Content