Adds a custom transcoding configuration for a streaming domain.
Operation description
This operation supports the following types of custom transcoding templates:
- h264: H.264
- h264-nbhd: H.264 Narrowband HD™
- h265: H.265
- h265-nbhd: H.265 Narrowband HD™
- audio: audio-only
QPS limit
You can call this operation up to 6,000 times per minute per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see QPS limits.
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:AddCustomLiveStreamTranscode | 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. | liveApp**** |
KmsKeyID | string | No | The ID of the customer master key (CMK) that you created in Key Management Service (KMS). | afce5722-81d2-43c3-9930-7601da11**** |
KmsUID | string | No | The ID of your KMS account. | 25346073170691**** |
KmsKeyExpireInterval | string | No | The rotation period of the CMK. Valid values: 60 to 3600. Unit: seconds. | 3600 |
Template | string | Yes | The name of the custom transcoding template. Note
The name can contain digits, letters, and hyphens (-), and must start with a letter or digit. The name must be different from the names of any default transcoding templates.
| LiveCusTranscode**** |
TemplateType | string | Yes | The type of the custom transcoding template. Valid values:
Note
If you set TemplateType to h264, h264-nbhd, h265, or h265-nbhd, the Height, Width, FPS, and VideoBitrate parameters are required.
| h264 |
Height | integer | No | The height of the output video. Unit: pixel. Valid values: The value must comply with all the following rules:
Note
The resolution of the output video that is transcoded by using the H.265 Narrowband HD™ transcoding template cannot exceed 1280 × 720 pixels.
| 720 |
Width | integer | No | The width of the output video. Unit: pixel. Valid values: The value must comply with all the following rules:
Note
The resolution of the output video that is transcoded by using the H.265 Narrowband HD™ transcoding template cannot exceed 1280 × 720 pixels.
| 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 bitrate of the output video. Unit: Kbit/s. Valid values: 1 to 6000. 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.
| 720 |
AudioBitrate | integer | No | The bitrate of the output audio. Unit: Kbit/s. Valid values: 1 to 1000. | 512 |
Gop | string | No | The Group of Picture (GOP) size of the video. Unit: frames or seconds.
| 1 |
Profile | integer | No | The video encoding profile. The profile defines a set of parameters that are used to encode a video. In most cases, a greater value indicates better image quality and higher resource consumption. Valid values:
| 2 |
AudioProfile | string | No | The audio encoding profile. Valid values:
| aac_low |
AudioCodec | string | No | The audio encoding format. Valid values:
| AAC |
AudioRate | integer | No | The audio sampling rate. Valid values: 22050 to 96000. Notice If you set AudioProfile to aac_ld, the audio sampling rate cannot exceed 44100. | 96000 |
AudioChannelNum | integer | No | The number of sound channels. Valid values:
| 2 |
Lazy | string | No | Specifies whether to use the load-on-demand mechanism for transcoding. Valid values: yes and no. Default value: yes. | yes |
EncryptParameters | string | No | Encryption configuration. In JSON format, the fields are explained as follows:
Note
If the EncryptParameters is configured, the KmsKeyID, KmsUID, and KmsKeyExpireInterval parameters cannot be empty
| {"EncryptType": "aliyun", "KmsKeyID":"afce5722-81d2-43c3-9930-7601da11****","KmsKeyExpireInterval":"3600"} |
ResWithSource | string | No | The source-based resolution settings. This parameter takes precedence over other resolution settings. The following fields must be included:
| {"Type":"short","Value":"1080"} |
FpsWithSource | string | No | The source-based frame rate settings. This parameter takes precedence over other frame rate settings. The following fields must be included:
| {"UpLimit":60,"LowerLimit":1} |
BitrateWithSource | string | No | The source-based bitrate settings. This parameter takes precedence over other bitrate settings. The following fields must be included:
| {"UpLimit":2500,"LowerLimit":800,"Factor":1} |
ExtWithSource | string | No | Other source-based settings, including the following fields:
| {"KeyFrameOpen":"yes","Copyts":"yes","SeiMode":1} |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "16A96B9A-F203-4EC5-8E43-CB92E68F****"
}
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 |
---|