Adds a real-time streaming (RTS) transcoding configuration for a streaming domain.
Usage note
This operation is applicable to main streaming domains. The supported custom template types are as follows:
- h264: H.264.
- h264-nbhd: H.264 Narrowband HD™.
- h264-origin: H.264 original quality. If you use this type of template, the settings of streams remain unchanged after transcoding.
- audio: audio-only transcoding. If you use this type of template, images are removed from input streams and audio-only streams are generated.
QPS limit
A single user can perform a maximum of 10 queries per second (QPS). Throttling is triggered when the number of calls per second exceeds the QPS limit. The throttling may affect your business. Thus, we recommend that you observe the QPS limit on this operation. For more information about what a single user means and the QPS details, see QPS limit on an API operation in ApsaraVideo Live.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | AddRtsLiveStreamTranscode | The operation that you want to perform. Set the value to AddRtsLiveStreamTranscode. |
Domain | String | Yes | example.com | The main streaming domain. |
App | String | Yes | liveApp**** | The name of the application to which the live stream belongs. The name must meet the following requirements: The name support the following character types: letters, digits, underscores (_), and hyphens (-). We recommend that you specify a name that contain more than three characters in length. The name must start with a letter or digit. |
Template | String | Yes | ld | The name of the custom transcoding template. The name must meet the following requirements: The name support the following character types: letters, digits, underscores (_), and hyphens (-). We recommend that you specify a name that contain more than three characters in length. The name must start with a letter or digit. Note The name cannot be the same as that of a standard transcoding template. |
TemplateType | String | Yes | h264 | The type of the custom transcoding template. Valid values:
|
Height | Integer | No | 1280 | The height of the output video. Unit: pixel. The value must comply with all the following rules:
For example, a resolution of 1560 × 1560 pixels is invalid. Note
|
Width | Integer | No | 720 | The width of the output video. Unit: pixel. The value must comply with all the following rules:
For example, a resolution of 1560 × 1560 pixels is invalid. Note
|
FPS | Integer | No | 30 | The frame rate of the output video. Unit: FPS. Valid values: 1 to 60. Note When TemplateType (custom transcoding template type) is set to h264 or h264-nbhd or h264-origin, this parameter is required. |
VideoBitrate | Integer | No | 2000 | The bitrate of the output video. Unit: Kbit/s. Valid values: 1 to 6000. Note
|
AudioBitrate | Integer | No | 128 | The bitrate of the output audio. Unit: Kbit/s. Valid values: 1 to 1000. Note When TemplateType (custom transcoding template type) is set to h264 or h264-nbhd or h264-origin, this parameter is required. |
Gop | String | No | 2 | The group of pictures (GOP) of the output video. This parameter is used to specify the keyframe interval. Unit: seconds. Valid values: 1 to 3. |
Profile | Integer | No | 2 | The video codec profile. The video codec profile determines how ApsaraVideo Live performs codec on the video. In normal cases, a greater value indicates a higher image quality and requires more codec resources. Valid values:
|
DeleteBframes | Boolean | No | false | Specifies whether to remove B frames during transcoding. Valid values:
|
Opus | Boolean | No | true | Specifies whether to transcode streams to the Opus format to be compatible with native WebRTC. Valid values:
|
AudioCodec | String | No | aac | The audio encoder. Valid values:
Note To use the Opus encoder, you need only to set the Opus parameter to true. |
AudioProfile | String | No | aac_low | The audio codec profile. Valid values:
|
AudioRate | Integer | No | 44100 | The audio sampling rate. Valid values: 22050 to 96000. The value 44100 is commonly used. Unit: Hz. Note If the value of the AudioProfile parameter is aac_ld, the audio sampling rate cannot exceed 44,100. |
AudioChannelNum | Integer | No | 2 | The number of audio channels. Valid values:
|
Lazy | String | No | no | Specifies whether to trigger transcoding only when a stream is pulled. Valid values:
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 16A96B9A-F203-4EC5-8E43-CB92E68F4CD8 | The ID of the request. |
Examples
Sample requests
https://live.aliyuncs.com/?Action=AddRtsLiveStreamTranscode
&Domain=example.com
&App=liveApp****
&Template=ld
&TemplateType=h264
&Height=1280
&Width=720
&FPS=25
&VideoBitrate=2400
&<Common request parameters>
Sample success responses
XML
format
<AddLiveStreamTranscodeResponse>
<RequestId>16A96B9A-F203-4EC5-8E43-CB92E68F4CD8</RequestId>
</AddLiveStreamTranscodeResponse>
JSON
format
{"RequestId":"16A96B9A-F203-4EC5-8E43-CB92E68F4CD8"}
Error codes
For a list of error codes, visit the API Error Center.
Special error codes
Error code | Error message | HTTP status code | Description |
---|---|---|---|
InvalidDomain.NotFound | The domain provided does not exist in our records. | 404 | The error message returned because the domain name does not exist or does not belong to your Alibaba Cloud account. |
IllegalOperation | Illegal domain operate is not permitted. | 403 | The error message returned because the current operation is not supported. For example, the specified domain name is not a live domain. |
InvalidParameters | Invalid parameters. | 400 | The error message returned because one or more parameters are invalid. For example, the height or bitrate is too large. |
ConfigAlreadyExists | Config has already exist. | 400 | The error message returned because an existing custom transcoding configuration is found. |
InternalError | The request processing has failed due to some unknown error. | 500 | The error message returned because an unknown error has occurred. |