Help Center> Live> API Reference> Transcoding Template APIs> Querying Transcoding Templates

Querying Transcoding Templates

Function

This API is used to query transcoding templates.

URI

GET /v1/{project_id}/template/transcodings

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see "Obtaining a Project ID" .

Table 2 Query parameters

Parameter

Mandatory

Type

Description

domain

Yes

String

Streaming domain name

app_name

No

String

Application name

page

No

Integer

Page number,default value: 0

size

No

Integer

Number of records on each page

Value range: 1–100

Default value: 10

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

The token is obtained by calling the IAM API used to obtain a user token. The token is the value of X-Subject-Token in the response header.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total

Integer

Total number of elements in the query result

domain

String

Streaming domain name

templates

Array of AppQualityInfo objects

Transcoding Template

Table 5 AppQualityInfo

Parameter

Type

Description

app_name

String

Application name.

quality_info

Array of QualityInfo objects

Video quality information

Table 6 QualityInfo

Parameter

Type

Description

templateName

String

Template name

quality

String

Possible values are:

  • FHD

  • HD

  • SD

  • LD

  • XXX: custom name. XXX must be different from the default name. Custom names must be different.

PVC

String

Whether to enable low bitrate HD. PVC in different templates in a template group must be the same.

  • on: enabled

  • off: disabled

Default value: off

hdlb

String

Whether to enable image enhancement

  • on: enabled

  • off: disabled

Default value: off

codec

String

Video codec. codec in different templates in a template group must be the same. Possible values are:

  • H.264

  • H.265

The default value is H.264.

width

Integer

Video width (unit: pixel)

  • H.264 Value range: 32–3,840. The value must be a multiple of 2.

  • H.265 Value range: 320–3,840. The value must be a multiple of 4.

height

Integer

Video height (unit: pixel)

  • H.264 Value range: 32–2,160. The value must be a multiple of 2.

  • H.265 Value range: 240–2,160. The value must be a multiple of 4.

bitrate

Integer

Bitrate of a transcoded video, in kbit/s

Value range: 40–30,000

video_frame_rate

Integer

Frame rate of the transcoded video, in fps.

The value ranges from 0 to 30. Value 0 indicates that the frame rate remains unchanged.

protocol

String

Output format. RTMP and HLS are supported. protocol in different templates in a template group must be the same.

  • RTMP

  • HLS

  • DASH

The default value is RTMP.

iFrameInterval

Integer

I-frame interval (unit: frame)

Value range: 0–500

Default value: 25

gop

Integer

I-frame interval set by time

Value range: 0–10

Default value: 4

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error Code

error_msg

String

Error description

Example Requests

GET https://{endpoint}/v1/{project_id}/template/transcodings?domain=play.example.huawei.com&app_name=live&page=0&size=10

Example Responses

Status code: 200

Transcoding templates queried successfully.

{
  "domain" : "play.example.huawei.com",
  "total" : 1,
  "templates" : [ {
    "app_name" : "live",
    "quality_info" : [ {
      "PVC" : "off",
      "bitrate" : 4500,
      "codec" : "H264",
      "height" : 1080,
      "protocol" : "HLS",
      "quality" : "SD",
      "video_frame_rate" : 20,
      "width" : 1920
    }, {
      "PVC" : "off",
      "bitrate" : 4500,
      "codec" : "H264",
      "height" : 1080,
      "protocol" : "HLS",
      "quality" : "HD",
      "video_frame_rate" : 20,
      "width" : 1920
    } ]
  } ]
}

Status code: 400

Failed to query the transcoding templates.

{
  "error_code" : "LIVE.100011001",
  "error_msg" : "Request Illegal"
}

Status Codes

Status Code

Description

200

Transcoding templates queried successfully.

400

Failed to query the transcoding templates.

Error Codes

See Error Codes.