All Products
Search
Document Center

ApsaraVideo Live:AddRtsLiveStreamTranscode

Last Updated:Nov 11, 2025

Adds a custom transcoding configuration for a streaming domain with Real-Time Streaming (RTS) enabled.

Operation description

Usage notes

You can call this operation to add a custom Real-Time Streaming (RTS) transcoding configuration. This operation supports only the following types of custom transcoding templates: h264, h264-nbhd, h264-origin, and audio.

QPS limits

The queries per second (QPS) limit for this operation is 10 calls per second for each user. If you exceed the limit, your API calls are throttled. This may affect your business. Plan your calls accordingly. For more information, see QPS limits.

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:AddRtsLiveStreamTranscode

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. Requirements:

  • Supports letters, digits, underscores (_), and hyphens (-).

  • Must start with a letter or a digit. A name longer than three characters is recommended.

aliyun-test

Template

string

Yes

The name of the custom transcoding template. Requirements:

  • Supports letters, digits, underscores (_), and hyphens (-).

  • Must start with a letter or a digit. A name longer than three characters is recommended.

Note

The name cannot be the same as that of a standard transcoding template.

ld

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.

  • h264-origin: original quality H.264 standard transcoding. It preserves the parameters of the source video as closely as possible.

  • audio: audio-only transcoding. The output file contains only audio. If you set this parameter to audio, you must set AudioBitrate.

Note

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

h264

Height

integer

No

Output video height in pixels.

Important

Required if you set TemplateType to h264, h264-nbhd, or h264-origin.

Requirements:

  • Height ≥ 100

  • max(Height, Width) ≤ 2560

  • min(Height, Width) ≤ 1440

For example, a resolution of 1560 × 1560 (a square video) is invalid.

Note

For h264-origin templates, the resolution can be up to 4K to retain the information of the source stream.

1280

Width

integer

No

Output video width in pixels.

Important

Required if you set TemplateType to h264, h264-nbhd, or h264-origin.

Requirements:

  • Width ≥ 100

  • max(Height, Width) ≤ 2560

  • min(Height, Width) ≤ 1440

For example, a resolution of 1560 × 1560 (a square video) is invalid.

Note

For h264-origin templates, the resolution can be up to 4K to retain the information of the source stream.

720

FPS

integer

No

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

Important

Required if you set TemplateType to h264, h264-nbhd, or h264-origin.

30

VideoBitrate

integer

No

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

Important

Required if you set TemplateType to h264, h264-nbhd, or h264-origin.

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.

2000

AudioBitrate

integer

No

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

Important

Required if you set TemplateType to audio.

128

Gop

string

No

The Group of Pictures (GOP) size, which specifies the keyframe interval. Unit: seconds. Valid values: 1 to 3.

2

DeleteBframes

boolean

No

Controls whether to remove B-frames from the transcoded output video. Valid values:

Important

Required if you set TemplateType to h264, h264-nbhd, or h264-origin.

  • true: The transcoded video has no B-frames.

  • false: The transcoded video contains B-frames. This is the default value.

false

Opus

boolean

No

Specifies whether to use the Opus codec for audio transcoding. This is mainly for compatibility with native WebRTC. Valid values:

  • true: Transcodes the audio to the Opus format.

  • false: Does not use the Opus format for transcoding. This is the default value.

true

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 codec profile. Valid values:

  • aac_low

  • aac_he

  • aac_he_v2

  • aac_ld

aac_low

AudioCodec

string

No

The audio codec. Valid values:

  • aac

  • mp3

Note

To use the Opus codec, set the Opus parameter to true.

aac

AudioRate

integer

No

The audio sample rate. Valid values: 22050 to 96000. Recommended: 44100. Unit: Hz.

Note

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

44100

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.

no

Response elements

Parameter

Type

Description

Example

object

RequestId

string

The request ID.

16A96B9A-F203-4EC5-8E43-CB92E68F4CD8

Examples

Success response

JSON format

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

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.