All Products
Search
Document Center

ApsaraVideo Live:AddRtsLiveStreamTranscode

Last Updated:Dec 05, 2024

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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
live:AddRtsLiveStreamTranscodecreate
*Domain
acs:cdn:*:{#accountId}:domain/{#DomainName}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DomainstringYes

The main streaming domain.

example.com
AppstringYes

The name of the application to which the live stream belongs. Value requirements:

  • The name can contain letters, digits, underscores (_), and hyphens (-).
  • We recommend that you specify a name that is more than three characters in length. The name must start with a letter or digit.
aliyun-test
TemplatestringYes

The name of the transcoding template. Value requirements:

  • The name can contain letters, digits, underscores (_), and hyphens (-).
  • We recommend that you specify a name that is 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 default transcoding template.
ld
TemplateTypestringYes

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: H.264 standard transcoding template.
  • h264-nbhd: H.264 Narrowband HD™ transcoding template.
  • h264-origin: H.264 original quality template. If you use this type of template, the same transcoding parameters of the video source are retained by default.
  • audio: audio-only transcoding template. If you use this type of template, images are removed from the video source and an audio-only stream is generated. In addition, you must also specify the AudioBitrate parameter.
h264
HeightintegerNo

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

  • Height ≥ 100: The height of the video is no less than 100 pixels.
  • max(Height,Width) ≤ 2560: The width or height of the video, whichever is greater, cannot exceed 2,560 pixels.
  • min(Height,Width) ≤ 1440: The width or height of the video, whichever is smaller, cannot exceed 1,440 pixels.

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
WidthintegerNo

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:

  • Width ≥ 100: The width of the video is no less than 100 pixels.
  • max(Height,Width) ≤ 2560: The width or height of the video, whichever is greater, cannot exceed 2,560 pixels.
  • min(Height,Width) ≤ 1440: The width or height of the video, whichever is smaller, cannot exceed 1,440 pixels.

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
FPSintegerNo

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
VideoBitrateintegerNo

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
AudioBitrateintegerNo

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
GopstringNo

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
DeleteBframesbooleanNo

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.
  • true: removes B-frames.
  • false: retains B-frames. This is the default value.
Note If you do not specify this parameter, the default value false is used.
false
OpusbooleanNo

Specifies whether to transcode audio to the Opus format to be compatible with native WebRTC. Valid values:

  • true: transcodes audio to the Opus format.
  • false: does not transcode audio to the Opus format.
Note If you do not specify this parameter, the default value false is used.
true
ProfileintegerNo

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:

  • 1: baseline, which is suitable for mobile devices.
  • 2: main, which is suitable for standard-definition devices.
  • 3: high, which is suitable for high-definition devices.
2
AudioProfilestringNo

The audio codec profile. Valid values:

  • aac_low
  • aac_he
  • aac_he_v2
  • aac_ld
aac_low
AudioCodecstringNo

The audio encoder. Valid values:

  • aac
  • mp3
Note If you want to use the Opus encoding format, set the Opus parameter to true.
aac
AudioRateintegerNo

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
AudioChannelNumintegerNo

The number of sound channels. Valid values:

  • 1: mono
  • 2: stereo
2
LazystringNo

Specifies whether to trigger transcoding only when a stream is pulled. Valid values:

  • yes: triggers transcoding only when a stream is pulled.
  • no: triggers transcoding whenever a stream is ingested, no matter whether the stream is pulled.
no

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

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

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError message
400InvalidParameters%s
400ConfigAlreadyExists%s
400TemplateLimit%s

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history

Special error codes

Error codeError messageHTTP status codeDescription
InvalidDomain.NotFoundThe domain provided does not exist in our records.404The error message returned because the specified domain name does not exist or does not belong to the current account.
IllegalOperationIllegal domain operate is not permitted.403The error message returned because the current operation is not supported. For example, the specified domain name is not a domain name in ApsaraVideo Live.
InvalidParametersInvalid parameters.400The error message returned because one or more parameters are invalid. For example, the height or bitrate is too large.
ConfigAlreadyExistsConfig has already exist.400The error message returned because the configuration already exists.
InternalErrorThe request processing has failed due to some unknown error.500The error message returned because an unknown error occurred.