Creates a Real-Time Streaming (RTS) transcoding configuration for a streaming domain.
Operation description
You can call this operation to add an RTS transcoding configuration. This operation supports four 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 limit on an API operation in ApsaraVideo Live.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
live:AddRtsLiveStreamTranscode | create | *Domain acs:cdn:*:{#accountId}:domain/{#DomainName} |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
Domain | string | Yes | The main streaming domain. | example.com |
App | string | Yes | The name of the application to which the live stream belongs. Value requirements:
| aliyun-test |
Template | string | Yes | The name of the transcoding template. Value requirements:
Note
The name cannot be the same as that of a default transcoding template.
| ld |
TemplateType | string | Yes | The type of the transcoding template. If you set this parameter to h264, h264-nbhd, or h264-origin, you must also specify the Height, Width, FPS, VideoBitrate, and DeleteBframes parameters. Valid values:
| h264 |
Height | integer | No | The height of the output video. Unit: pixels. Note
This parameter is required if you set the TemplateType parameter 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 needs to retain the source information. Therefore, the video resolution cannot exceed 4K.
| 1280 |
Width | integer | No | The width of the output video. Unit: pixels. Note
This parameter is required if you set the TemplateType parameter 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 needs to retain the source information. Therefore, the video resolution cannot exceed 4K.
| 720 |
FPS | integer | No | The frame rate of the output video. Unit: FPS. Valid values: 1 to 60. Note
This parameter is required if you set the TemplateType parameter to h264, h264-nbhd, or h264-origin.
| 30 |
VideoBitrate | integer | No | The bitrate of the output video. Unit: Kbit/s. Valid values: 1 to 6000. Note
This parameter is required if you set the TemplateType parameter to h264, h264-nbhd, or h264-origin.
Note
The bitrate of the output video is as close to the value that you specify as possible, but not exactly the same as the value, especially when the value is excessively large or small.
| 2000 |
AudioBitrate | integer | No | The bitrate of the output audio. Unit: Kbit/s. Valid values: 1 to 1000. Note
This parameter is required if you set the TemplateType parameter to audio.
| 128 |
Gop | string | No | 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. | 2 |
DeleteBframes | boolean | No | Specifies whether to remove B-frames during transcoding. Valid values: Note
This parameter is required if you set the TemplateType parameter to h264, h264-nbhd, or h264-origin.
Note
If you do not specify this parameter, the default value false is used.
| false |
Opus | boolean | No | 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.
| true |
Profile | integer | No | The 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:
| 2 |
AudioProfile | string | No | The audio codec profile. Valid values:
| aac_low |
AudioCodec | string | No | The audio encoder. Valid values:
Note
If you want to use the Opus encoding format, set the Opus parameter to true.
| aac |
AudioRate | integer | No | The audio sampling rate. Valid values: 22050 to 96000. The value 44100 is commonly used. Unit: Hz. Note
If you set the AudioProfile parameter to aac_ld, the audio sampling rate cannot exceed 44,100 Hz.
| 44100 |
AudioChannelNum | integer | No | The number of sound channels. Valid values:
| 2 |
Lazy | string | No | Specifies whether to trigger transcoding only when a stream is pulled. Valid values:
| no |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "16A96B9A-F203-4EC5-8E43-CB92E68F4CD8"
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
400 | InvalidParameters | %s |
400 | ConfigAlreadyExists | %s |
400 | TemplateLimit | %s |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|
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 specified domain name does not exist or does not belong to the current 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 domain name in ApsaraVideo Live. |
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 the configuration already exists. |
InternalError | The request processing has failed due to some unknown error. | 500 | The error message returned because an unknown error occurred. |