All Products
Search
Document Center

ApsaraVideo Live:AddCustomLiveStreamTranscode

Last Updated:Nov 14, 2024

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

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

liveApp****
KmsKeyIDstringNo

The ID of the customer master key (CMK) that you created in Key Management Service (KMS).

afce5722-81d2-43c3-9930-7601da11****
KmsUIDstringNo

The ID of your KMS account.

25346073170691****
KmsKeyExpireIntervalstringNo

The rotation period of the CMK. Valid values: 60 to 3600. Unit: seconds.

3600
TemplatestringYes

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

The type of the custom transcoding template. Valid values:

  • h264: custom H.264 standard transcoding.
  • h264-nbhd: custom H.264 Narrowband HD™ transcoding.
  • h265: custom H.265 standard transcoding.
  • h265-nbhd: custom H.265 Narrowband HD™ transcoding.
  • audio: audio-only transcoding.
Note If you set TemplateType to h264, h264-nbhd, h265, or h265-nbhd, the Height, Width, FPS, and VideoBitrate parameters are required.
h264
HeightintegerNo

The height of the output video. Unit: pixel. Valid values:

The value must comply with all the following rules:

  • Height ≥ 100: The height of the video is greater than or equal to 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.
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
WidthintegerNo

The width of the output video. Unit: pixel. Valid values:

The value must comply with all the following rules:

  • Width ≥ 100: The width of the video is greater than or equal to 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.
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
FPSintegerNo

The frame rate of the output video. Unit: frames per second (FPS). Valid values: 1 to 60.

30
VideoBitrateintegerNo

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
AudioBitrateintegerNo

The bitrate of the output audio. Unit: Kbit/s. Valid values: 1 to 1000.

512
GopstringNo

The Group of Picture (GOP) size of the video. Unit: frames or seconds.

  • Unit: frames. Valid values: 1 to 3000.
  • Unit: seconds. Valid value: 1 to 20.
1
ProfileintegerNo

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:

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

The audio encoding profile. Valid values:

  • aac_low
  • aac_he
  • aac_he_v2
  • aac_ld
aac_low
AudioCodecstringNo

The audio encoding format. Valid values:

  • AAC
  • MP3
AAC
AudioRateintegerNo

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
AudioChannelNumintegerNo

The number of sound channels. Valid values:

  • 1: mono.
  • 2: binaural.
2
LazystringNo

Specifies whether to use the load-on-demand mechanism for transcoding. Valid values: yes and no. Default value: yes.

yes
EncryptParametersstringNo

Encryption configuration. In JSON format, the fields are explained as follows:

  • EncryptType: Encryption type. Fixed value is aliyun.
  • KmsKeyID: User KMS master key ID.
  • KmsKeyExpireInterval: Key rotation period. Range: 60~3600, unit: seconds.
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"}
ResWithSourcestringNo

The source-based resolution settings. This parameter takes precedence over other resolution settings. The following fields must be included:

  • Type: You can set this field to short, long, or screen. short specifies that the resolution of the output video is adapted to the shorter side, long specifies that the resolution of the output video is adapted to the longer side, and screen specifies that the output video has an adaptive resolution.

  • Value:

    • Set this field to 360, 480, 540, 720, or 1080 if the Type field is set to short.
    • Set this field to 640, 848, 960, 1280, or 1920 if the Type field is set to long.
    • Set this field to 640*360, 848*480, 960*540, 1280*720, or 1920*1080 if the Type field is set to screen.
{"Type":"short","Value":"1080"}
FpsWithSourcestringNo

The source-based frame rate settings. This parameter takes precedence over other frame rate settings. The following fields must be included:

  • UpLimit: the maximum frame rate. Valid values: an integer from 1 to 60. The value must be greater than the minimum frame rate.
  • LowerLimit: the minimum frame rate. Valid values: an integer from 1 to 60. The value must be smaller than the maximum frame rate.
{"UpLimit":60,"LowerLimit":1}
BitrateWithSourcestringNo

The source-based bitrate settings. This parameter takes precedence over other bitrate settings. The following fields must be included:

  • UpLimit: the maximum bitrate limit. Valid values: an integer from 128 to 10000. The value must be greater than the minimum bitrate.
  • LowerLimit int : the minimum bitrate rate. Valid values: an integer from 128 to 10000. The value must be smaller than the maximum bitrate.
  • Factor: The ratio of the output bitrate to the source bitrate. Valid values: 0.1 to 1. The value is accurate to one decimal place. A value of 1 indicates that the output video has the same bitrate as the source video.
{"UpLimit":2500,"LowerLimit":800,"Factor":1}
ExtWithSourcestringNo

Other source-based settings, including the following fields:

  • KeyFrameOpen: specifies whether to use the key frames of the source video. Valid values: yes or no.
  • Copyts: specifies whether to use the presentation time stamp (PTS) of the source video. Valid values: yes or no.
  • SeiMode: specifies whether to pass through supplemental enhancement information (SEI) messages. Valid values: 0, 1, and 2, where 0 specifies that no SEI messages are passed through, 1 specifies that part of SEI messages are passed through, and 2 specifies that all SEI messages are passed through.
{"KeyFrameOpen":"yes","Copyts":"yes","SeiMode":1}

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

16A96B9A-F203-4EC5-8E43-CB92E68F****

Examples

Sample success responses

JSONformat

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

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