All Products
Search
Document Center

ApsaraVideo Live:AddCustomLiveStreamTranscode

Last Updated:Oct 31, 2025

Adds a custom transcoding configuration.

Operation description

This operation supports the following types of custom transcoding templates:

  • h264: a custom H.264 standard template.

  • h264-nbhd: a custom H.264 Narrowband HD™ template.

  • h265: a custom H.265 standard template.

  • h265-nbhd: a custom H.265 Narrowband HD template.

  • audio: an audio-only template.

QPS limit

This operation has a queries per second (QPS) limit of 6,000 calls per minute for each user. If you exceed the limit, API calls are throttled, which can affect your business. For more information, see QPS limit.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

live:AddCustomLiveStreamTranscode

create

*Domain

acs:cdn:*:{#accountId}:domain/{#DomainName}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

No

The region ID.

cn-shanghai

Domain

string

Yes

The streaming domain.

example.com

App

string

Yes

The AppName of the live stream.

liveApp****

KmsKeyID

string

No

The ID of the customer master key (CMK) in Key Management Service (KMS).

afce5722-81d2-43c3-9930-7601da11****

KmsUID

string

No

The ID of the KMS account.

25346073170691****

KmsKeyExpireInterval

string

No

The key rotation period. Unit: seconds. Valid values: 60 to 3600.

3600

Template

string

Yes

The custom name of the transcoding template.

Note

The name can contain digits, letters, and hyphens (-). It must start with a digit or a letter. It cannot be the same as the name of a standard transcoding template.

LiveCusTranscode****

TemplateType

string

Yes

The type of the custom transcoding template. Valid values:

  • h264: custom H.264 standard transcoding.

  • h264-nbhd: custom H.264 Narrowband HD™ transcoding.

  • h265: custom H.265 standard transcoding.

  • h265-nbhd: custom H.265 Narrowband HD™ transcoding.

  • audio: audio-only transcoding.

Note

For video types, Height, Width, FPS, and VideoBitrate are required.

h264

Height

integer

No

Output video height in pixels. Requirements:

  • Height ≥ 100

  • max(Height, Width) ≤ 2560

  • min(Height, Width) ≤ 1440

Note

For h265-nbhd, it cannot exceed 720.

720

Width

integer

No

Output video width in pixels.

Requirements:

  • Width ≥ 100

  • max(Height, Width) ≤ 2560

  • min(Height, Width) ≤ 1440

Note

For h265-nbhd, it cannot exceed 1280.

576

FPS

integer

No

The frame rate of the output video. Unit: frames per second (FPS). Valid values: 1 to 60.

30

VideoBitrate

integer

No

The output video bitrate. Unit: kbps. Valid values: 1 to 6000.

Note

The system tries to transcode the video at the specified bitrate. However, the actual bitrate may not be the same as the specified value, especially when the specified value is too high or too low.

720

AudioBitrate

integer

No

The output audio bitrate. Unit: kbps. Valid values: 1 to 1000.

512

Gop

string

No

The Group of Pictures (GOP) size. The unit can be frame or second. Valid values:

  • By frames: 1 to 3000.

  • By seconds: 1s to 20s.

1

Profile

integer

No

The video codec profile. A larger value indicates better video quality and higher resource consumption for encoding and decoding. Valid values:

  • 1: baseline (for mobile devices).

  • 2: main (for SD devices).

  • 3: high (for HD devices).

2

AudioProfile

string

No

The audio profile. Valid values:

  • aac_low

  • aac_he

  • aac_he_v2

  • aac_ld

aac_low

AudioCodec

string

No

The audio codec. Valid values:

  • AAC

  • MP3

AAC

AudioRate

integer

No

The audio sample rate. Valid values: 22050 to 96000.

Important

If you set AudioProfile to aac_ld, the sample rate cannot exceed 44100.

96000

AudioChannelNum

integer

No

The number of audio channels. Valid values:

  • 1: mono.

  • 2: stereo.

2

Lazy

string

No

Specifies whether to enable on-demand transcoding. Valid values:

  • yes: Transcoding only starts when the first viewer requests this transcoded stream.

  • no: Transcoding starts immediately after the stream is published.

yes

EncryptParameters

string

No

The encryption settings, formatted as a JSON string.

  • EncryptType: The encryption type. Set the value to aliyun.

  • KmsKeyID: The ID of the customer master key (CMK) in Key Management Service (KMS).

  • KmsKeyExpireInterval: The key rotation period. Unit: seconds. Valid values: 60 to 3600.

Note

If set, its internal fields cannot be empty.

{"EncryptType": "aliyun", "KmsKeyID":"afce5722-81d2-43c3-9930-7601da11****","KmsKeyExpireInterval":"3600"}

ResWithSource

string

No

The adaptive resolution settings. If specified, it overrides the Height and Width parameters. Fieds:

  • Type (string): Required. Valid values:

    • short: sets the shorter edge of the video to the specified value and scales the other edge to maintain the original aspect ratio.

    • long: sets the longer edge of the video to the specified value and scales the other edge to maintain the original aspect ratio.

    • screen: Matches the output to a standard resolution, automatically flipping the dimensions based on the source's orientation.

  • Value (string): Required. Valid values:

    • For short: 360, 480, 540, 720, and 1080.

    • For long: 640, 848, 960, 1280, and 1920.

    • For screen: 640×360, 848×480, 960×540, 1280×720, and 1920×1080.

{"Type":"short","Value":"1080"}

FpsWithSource

string

No

Adapts the output frame rate based on the source's frame rate, while keeping it within a specified range. If specified, it overrides the FPS parameter. Fields:

  • UpLimit (integer): Required. The upper limit of the frame rate. This must be an integer from 1 to 60 and greater than the lower limit.

  • LowerLimit (integer): Required. The lower limit of the frame rate. This must be an integer from 1 to 60 and less than the upper limit.

{"UpLimit":60,"LowerLimit":1}

BitrateWithSource

string

No

The adaptive bitrate settings. If specified, it overrides the VideoBitrate parameter. Fields:

  • UpLimit (integer): Required. The upper limit of the bitrate. This must be an integer from 128 to 10000 and greater than the lower limit.

  • LowerLimit (integer): Required. The lower limit of the bitrate. This must be an integer from 128 to 10000 and less than the upper limit.

  • Factor (float): Required: The factor by which the source bitrate is multiplied to calculate the output bitrate. Valid values: 0.1 to 1. The value can be accurate to one decimal place. A value of 1 indicates that the output bitrate is the same as the source bitrate.

{"UpLimit":2500,"LowerLimit":800,"Factor":1}

ExtWithSource

string

No

Other adaptive settings that align the transcoded stream with the source stream. Fields:

  • KeyFrameOpen: Specifies whether to align keyframes with the source stream. Valid values: yes and no.

  • Copyts (string): Specifies whether to align the presentation timestamp (PTS) with the source stream. Valid values: yes and no.

  • SeiMode: The pass-through mode for Supplemental Enhancement Information (SEI). Valid values: 0 (disabled) and 1 (enabled).

{"KeyFrameOpen":"yes","Copyts":"yes","SeiMode":1}

DeInterlaced

boolean

No

Specifies whether to automatically detect and remove interlacing during transcoding. Deinterlacing converts interlaced video into progressive video.

  • true: enables deinterlacing.

  • false: keeps the source format. This is the default value.

false

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

16A96B9A-F203-4EC5-8E43-CB92E68F****

Examples

Success response

JSON format

{
  "RequestId": "16A96B9A-F203-4EC5-8E43-CB92E68F****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameters %s
400 ConfigAlreadyExists %s
400 TemplateLimit %s

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.