Adds a custom Real-Time Streaming (RTS) transcoding configuration.
Usage notes
You can call this operation to add a custom RTS transcoding configuration. This operation supports four custom template types: h264, h264-nbhd, h264-origin, and audio.
QPS limit
You can call this operation up to 10 times per second per account. Requests that exceed this limit are dropped and you will experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see QPS limits.
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 | aliyun-test | The name of the application to which the live stream belongs. Value requirements:
|
Template | String | Yes | ld | The name of the custom transcoding template. Value requirements:
Note The name cannot be the same as that of a default transcoding template. |
TemplateType | String | Yes | h264 | The type of the custom transcoding template. Valid values:
Note If you set this parameter to h264, h264-nbhd, or h264-origin, you must also specify the Height, Width, FPS, VideoBitrate, and DeleteBframes parameters. |
Height | Integer | No | 1280 | The height of the output video. Unit: pixels. Important This parameter is required if you set TemplateType to h264, h264-nbhd, or h264-origin. The value must comply with the following rules:
For example, a resolution of 1560 × 1560 pixels is invalid. Note An original quality template retains the settings of the video source. Therefore, the resolution can be up to 4K. |
Width | Integer | No | 720 | The width of the output video. Unit: pixels. Important This parameter is required if you set TemplateType to h264, h264-nbhd, or h264-origin. The value must comply with the following rules:
For example, a resolution of 1560 × 1560 pixels is invalid. Note An original quality template retains the settings of the video source. Therefore, the resolution can be up to 4K. |
FPS | Integer | No | 30 | The frame rate of the output video. Unit: frames per second (FPS). Valid values: 1 to 60. Important This parameter is required if you set TemplateType to h264, h264-nbhd, or h264-origin. |
VideoBitrate | Integer | No | 2000 | The bitrate of the output video. Unit: Kbit/s. Valid values: 1 to 6000. Important This parameter is required if you set TemplateType to h264, h264-nbhd, or h264-origin. Note The bitrate of the output video may not be the same as the value that you specify, but is as close to the value as possible, especially when the value is excessively large or small. |
AudioBitrate | Integer | No | 128 | The bitrate of the output audio. Unit: Kbit/s. Valid values: 1 to 1000. Important This parameter is required if you set TemplateType to audio. |
Gop | String | No | 2 | The group of pictures (GOP) size of the output video. This parameter is used to specify the keyframe interval. Unit: seconds. Valid values: 1 to 3. |
DeleteBframes | Boolean | No | false | Specifies whether to remove B-frames during transcoding. Valid values: Important This parameter is required if you set TemplateType to h264, h264-nbhd, or h264-origin.
Note If you do not specify this parameter, the default value false is used. |
Opus | Boolean | No | true | Specifies whether to transcode audio to the Opus format to be compatible with native WebRTC. Valid values:
Note If you do not specify this parameter, the default value false is used. |
Profile | Integer | No | 2 | The video encoding profile. The profile determines how a video is encoded. In most cases, a greater value indicates better image quality and higher resource consumption. Valid values:
|
AudioProfile | String | No | aac_low | The audio encoding profile. Valid values:
|
AudioCodec | String | No | aac | The audio codec. Valid values:
Note If you want to use the Opus codec, you need only to set the Opus parameter to true. |
AudioRate | Integer | No | 44100 | The audio sampling rate. Valid values: 22050 to 96000. The value 44100 is commonly used. Unit: Hz. Note If you set AudioProfile to aac_ld, the audio sampling rate cannot exceed 44,100 Hz. |
AudioChannelNum | Integer | No | 2 | The number of sound channels. Valid values:
|
Lazy | String | No | no | Specifies whether to enable triggered transcoding. Valid values:
|
Response parameters
Parameter | Type | Example | Description |
RequestId | String | 16A96B9A-F203-4EC5-8E43-CB92E68F4CD8 | The request ID. |
Examples
Sample requests
https://live.aliyuncs.com/?Action=AddRtsLiveStreamTranscode
&Domain=example.com
&App=aliyun-test
&Template=ld
&TemplateType=h264
&Height=1280
&Width=720
&FPS=25
&VideoBitrate=2400
&DeleteBframes=false
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<AddLiveStreamTranscodeResponse>
<RequestId>16A96B9A-F203-4EC5-8E43-CB92E68F4CD8</RequestId>
</AddLiveStreamTranscodeResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "16A96B9A-F203-4EC5-8E43-CB92E68F4CD8"
}
Error codes
For a list of error codes, see Service error codes.
Special error codes
Error code | Error message | HTTP status code | Description |
InvalidDomain.NotFound | The domain provided does not exist in our records. | 404 | The domain name does not exist or does not belong to your account. |
IllegalOperation | Illegal domain operate is not permitted. | 403 | The current operation is not supported because, for example, the specified domain name is not a domain name in ApsaraVideo Live. |
InvalidParameters | Invalid parameters. | 400 | One or more parameters are invalid. For example, the height or bitrate is too large. |
ConfigAlreadyExists | Config has already exist. | 400 | The configuration already exists. |
InternalError | The request processing has failed due to some unknown error. | 500 | An unknown error occurred. |