All Products
Search
Document Center

ApsaraVideo Live:AddCustomLiveStreamTranscode

更新時間:Oct 29, 2024

Adds a custom transcoding configuration.

This operation supports the following types of custom transcoding templates:

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

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

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

Parameter

Type

Required

Example

Description

Action String Yes AddCustomLiveStreamTranscode

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

Domain String Yes example.com

The main streaming domain.

App String Yes liveApp****

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

KmsKeyID String No afce5722-81d2-43c3-9930-7601da11****

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

KmsUID String No 25346073170691****

The ID of the KMS account.

KmsKeyExpireInterval String No 3600

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

Template String Yes LiveCusTranscode****

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.
TemplateType String Yes h264

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.
Height Integer No 720

The height of the output video. Unit: pixels.

The value must comply with 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 a video that is transcoded by using the H.265 Narrowband HD™ transcoding template cannot exceed 1280 × 720 pixels.
Width Integer No 576

The width of the output video. Unit: pixels.

The value must comply with 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 a video that is transcoded by using the H.265 Narrowband HD™ transcoding template cannot exceed 1280 × 720 pixels.
FPS Integer No 30

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

VideoBitrate Integer No 720

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.
AudioBitrate Integer No 512

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

Gop String No 1

The group of pictures (GOP) size of the output video. Unit: frames or seconds.

  • When the unit is frames, the valid values are 1 to 3000. For example, if you want to specify a GOP size of 2 frames, set this parameter to 2.
  • When the unit is seconds, the valid values are 1s to 20s. For example, if you want to specify a GOP size of 1 second, set this parameter to 1s.
Profile Integer No 2

The video encoding profile. The profile determines how a video is encoded. 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.
AudioProfile String No aac_low

The audio encoding profile. Valid values:

  • aac_low
  • aac_he
  • aac_he_v2
  • aac_ld
AudioCodec String No AAC

The audio codec. Valid values:

  • AAC
  • MP3
AudioRate Integer No 96000

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

Important If you set AudioProfile to aac_ld, the audio sampling rate cannot exceed 44100.
AudioChannelNum Integer No 2

The number of sound channels. Valid values:

  • 1: mono
  • 2: binaural
Lazy String No yes

Specifies whether to enable triggered transcoding. Valid values:

  • yes: enables triggered transcoding.
  • no: disables triggered transcoding.
EncryptParameters String No {"EncryptType": "aliyun", "KmsKeyID":"afce5722-81d2-43c3-9930-7601da11****","KmsKeyExpireInterval":"3600"}

The encryption settings. The value must be a JSON string that includes the following fields:

  • 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.
Note If you specify the EncryptParameters parameter, the KmsKeyID, KmsUID, and KmsKeyExpireInterval fields are required.
ResWithSource String No {"Type":"short","Value":"1080"}

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:
    Note
    • 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.
FpsWithSource String No {"UpLimit":60,"LowerLimit":1}

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. Set this field to an integer from 1 to 60. The value must be greater than the minimum frame rate.
  • LowerLimit: the minimum frame rate. Set this field to an integer from 1 to 60. The value must be smaller than the maximum frame rate.
BitrateWithSource String No {"UpLimit":2500,"LowerLimit":800,"Factor":1}

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

  • UpLimit: the maximum bitrate. Set this field to an integer from 128 to 10000. The value must be greater than the minimum bitrate.
  • LowerLimit: the minimum bitrate. Set this field to 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.
ExtWithSource String No {"KeyFrameOpen":"yes","Copyts":"yes","SeiMode":1}

Other source-based settings. The following fields are included:

  • KeyFrameOpen: Valid values: yes and no.
  • Copyts: Valid values: yes and no.
  • SeiMode: Valid values: 0, 1, and 2. 0 specifies that no supplemental enhancement information (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.

Response parameters

Parameter

Type

Example

Description

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

The request ID.

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.