Adds a custom transcoding configuration for a streaming domain.

Usage notes

This operation supports the following types of custom transcoding templates:

  • h264: custom H.264 standard transcoding template.
  • h264-nbhd: custom H.264 Narrowband HD™ transcoding template.
  • h265: custom H.265 standard transcoding template.
  • h265-nbhd: custom H.265 Narrowband HD™ transcoding template.
  • audio: audio-only template.

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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesAddCustomLiveStreamTranscode

The operation that you want to perform. Set the value to AddCustomLiveStreamTranscode.

DomainStringYesexample.com

The main streaming domain.

AppStringYesliveApp****

The name of the application to which the live stream belongs.

KmsKeyIDStringNoafce5722-81d2-43c3-9930-7601da11****

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

KmsUIDStringNo25346073170691****

The ID of the KMS account.

KmsKeyExpireIntervalStringNo3600

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

TemplateStringYesLiveCusTranscode****

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 name of default transcoding templates.
TemplateTypeStringYesh264

The type of the custom transcoding template. Valid values:

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

The height of the output video. Unit: pixel.

The value must comply with all the following rules:

  • Height ≥ 100: The height of the video is at least 100 pixels.
  • max(Height,Width) ≤ 2560: The larger of the width and height of the video cannot exceed 2,560 pixels.
  • min(Height,Width) ≤ 1440: The smaller of the width and height of the video cannot exceed 1,440 pixels.
Note The resolution of a video that is transcoded by using the H.265 Narrowband HD™ transcoding template cannot exceed 1280 × 720 pixels.
WidthIntegerNo576

The width of the output video. Unit: pixel.

The value must comply with all the following rules:

  • Width ≥ 100: The width of the video is at least 100 pixels.
  • max(Height,Width) ≤ 2560: The larger of the width and height of the video cannot exceed 2,560 pixels.
  • min(Height,Width) ≤ 1440: The smaller of the width and height of the video cannot exceed 1,440
Note The resolution of a video that is transcoded by using the H.265 Narrowband HD™ transcoding template cannot exceed 1280 × 720 pixels.
FPSIntegerNo30

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

VideoBitrateIntegerNo720

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.
AudioBitrateIntegerNo512

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

GopStringNo1

The group of pictures (GOP) size of the output video. Unit: frames. Valid values: 1 to 3000.

ProfileIntegerNo2

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.
AudioProfileStringNoaac_low

The audio codec. Valid values:

  • aac_low
  • aac_he
  • aac_he_v2
  • aac_ld
AudioCodecStringNoAAC

The audio encoding format. Valid values:

  • AAC
  • MP3
AudioRateIntegerNo96000

The audio sampling rate. Valid values: 22050 to 96000.

Important If you set the AudioProfile parameter to aac_ld, the audio sampling rate cannot exceed 44100.
AudioChannelNumIntegerNo2

The number of sound channels. Valid values:

  • 1: mono
  • 2: binaural
EncryptParametersStringNo{"EncryptType": "aliyun", "KmsKeyID":"afce5722-81d2-43c3-9930-7601da11****","KmsKeyExpireInterval":"3600"}

The encryption configuration. The value is a JSON string. The following fields are included in the syntax:

  • EncryptType: the type of encryption. Set the value to aliyun.
  • KmsKeyID: the ID of the CMK in KMS.
  • KmsKeyExpireInterval: the rotation period of the CMK. Valid values: 60 to 3600. Unit: seconds.

Response parameters

ParameterTypeExampleDescription
RequestIdString16A96B9A-F203-4EC5-8E43-CB92E68F4CD8

The ID of the request.

Examples

Sample requests

http(s)://live.aliyuncs.com/?Action=AddCustomLiveStreamTranscode
&App=liveApp****
&Domain=example.com
&Template=LiveCusTranscode****
&TemplateType=h264
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<?xml version="1.0" encoding="UTF-8" ?>
<AddCustomLiveStreamTranscodeResponse>
    <RequestId>16A96B9A-F203-4EC5-8E43-CB92E68F4CD8</RequestId>
</AddCustomLiveStreamTranscodeResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

For a list of error codes, see Service error codes.