All Products
Search
Document Center

ApsaraVideo Media Processing:SearchTemplate

Last Updated:Sep 27, 2024

You can call this operation to query custom transcoding templates in the specified state.

Operation description

You can call this operation up to 100 times per second. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation. For more information, see QPS limit.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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
mts:SearchTemplateget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
PageSizelongNo

The size of each page set during the result paging query.

  • Upper limit: 100.
  • Default value: 10.
10
PageNumberlongNo

The number of the page to return. Default value: 1.

1
StatestringNo

The status of the custom transcoding templates that you want to query.

  • All: All custom transcoding templates are queried.
  • Normal: Normal custom transcoding templates are queried.
  • Deleted: Deleted custom transcoding templates are queried.
  • Default value: All.
Normal
NamePrefixstringNo

The name prefix based on which you want to search for templates.

S00000001

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

TotalCountlong

The total number of search results.

1
TemplateListarray<object>

The transcoding templates.

Templateobject

The video codec configurations.

Videoobject

The video codec configurations.

Bufsizestring

The buffer size.

  • Unit: KB.
  • Default value: 6000.
6000
LongShortModestring

Indicates whether the auto-rotate screen feature is enabled.

  • If this feature is enabled, the width of the output video corresponds to the long side of the input video, which is the height of the input video in portrait mode. The height of the output video corresponds to the short side of the input video, which is the width of the input video in portrait mode. Valid values:
  • true
  • false
  • Default value: false.
false
Degrainstring

The level of video quality control.

10
BitrateBndobject

The average bitrate range of the video.

Maxstring

The upper limit of the total bitrate. Unit: Kbit/s.

500
Minstring

The lower limit of the total bitrate. Unit: Kbit/s.

100
PixFmtstring

The pixel format of the video. Valid values: standard pixel formats such as yuv420p and yuvj420p.

yuv420p
Padstring

The black bars that are added to the video.

  • Format: width:height:left:top.
  • Example: 1280:800:0:140.
1280:800:0:140
Codecstring

The codec.

  • Valid values: H.264 and H.265.
  • Default value: H.264.
H.264
Heightstring

The height of the video.

  • Unit: pixel.
  • Default value: the height of the input video.
800
Qscalestring

The strength of the independent denoising algorithm.

1
Cropstring

The method of video cropping. Valid values:

  • border: automatically detects and removes black bars.
  • Value in the width:height:left:top format: crops the video image based on the custom settings. Format: width:height:left:top. Example: 1280:800:0:140.
border
Bitratestring

The average bitrate of the video. Unit: Kbit/s.

200
Maxratestring

The maximum bitrate of the video. Unit: Kbit/s.

500
NarrowBandobject

The Narrowband HD settings.

Abrmaxfloat

The upper limit of the dynamic bitrate. If this parameter is set, the average bitrate is in the range of (0, 1000000].

3000
MaxAbrRatiofloat

The maximum ratio of the upper limit of dynamic bitrate. If this parameter is set, the value of Abrmax does not exceed x times of the source video bitrate. Valid values: (0,1.0].

1.0
Versionstring

The Narrowband HD version. Only 1.0 may be returned.

1.0
MaxFpsstring

The maximum frame rate.

60
Profilestring

The codec profile. Valid values:

  • baseline: applicable to mobile devices.
  • main: applicable to standard-definition devices.
  • high: applicable to high-definition devices.
  • Default value: high.
high
Crfstring

The constant rate factor.

  • Default value when the value of Codec is H.264: 23, default value when the value of Codec is H.265: 26.
  • If this parameter is set, the value of Bitrate becomes invalid.
15
Removestring

Indicates whether the video stream is deleted. Valid values:

  • true
  • false
  • Default value: false.
false
Gopstring

The maximum number of frames between two keyframes. Default value: 250.

10
Widthstring

The width of the video.

  • Valid values: [128,4096].
  • Unit: pixel.
  • Default value: the width of the input video.
256
Fpsstring

The frame rate of the video.

  • The value is 60 if the frame rate of the input video exceeds 60.
  • Default value: the frame rate of the input video.
25
Presetstring

The preset video algorithm. Default value: medium. Valid values:

  • veryfast
  • fast
  • medium
  • slow
  • slower
medium
ScanModestring

The scan mode. Valid values:

  • interlaced
  • progressive
interlaced
ResoPrioritystring

The policy of resolution adjustment.

heightFirst
Hdr2sdrstring

Indicates whether the HDR2SDR conversion feature is enabled. If this feature is enabled, high dynamic range (HDR) videos are transcoded to standard dynamic range (SDR) videos.

true
TransConfigobject

The general transcoding configurations.

IsCheckAudioBitratestring

Indicates whether the audio bitrate is checked. If the bitrate of the output audio is higher than that of the input audio, the input bitrate is retained and the specified audio bitrate does not take effect. This parameter has a lower priority than IsCheckAudioBitrateFail. Valid values:

  • true

  • false

  • Default value:

    • If this parameter is empty and the codec of the output audio is different from that of the input audio, the default value is false.
    • If this parameter is empty and the codec of the output audio is the same as that of the input audio, the default value is true.
false
TransModestring

The transcoding mode. Default value: onepass. Valid values:

  • onepass
  • twopass
  • CBR
onepass
IsCheckResostring

Indicates whether the resolution is checked. If the output resolution is higher than the input resolution based on the width or height, the input resolution is retained. Valid values:

  • true
  • false
  • Default value: false.
false
IsCheckVideoBitrateFailstring

Indicates whether video bitrate check errors are allowed. This parameter has a higher priority than IsCheckVideoBitrate. Valid values:

  • true: If the video bitrate check fails, the input file is not transcoded.
  • false: The video bitrate is not checked.
  • Default value: false.
false
AdjDarMethodstring

The method of resolution adjustment. Default value: none. Valid values:

  • rescale
  • crop
  • none
none
IsCheckVideoBitratestring

Indicates whether the video bitrate is checked. If the bitrate of the output video is higher than that of the input video, the input bitrate is retained. Valid values:

  • true
  • false
  • Default value: false.
false
IsCheckResoFailstring

Indicates whether the resolution is checked. If the output resolution is higher than the input resolution based on the width or height, a transcoding failure is returned. Valid values:

  • true
  • false
  • Default value: false.
false
IsCheckAudioBitrateFailstring

Indicates whether audio bitrate check errors are allowed. This parameter has a greater priority than IsCheckAudioBitrate. Valid values:

  • true: If the audio bitrate check fails, the input file is not transcoded.
  • false: The audio bitrate is not checked.
  • Default value: false.
false
Statestring

The status of the template. Valid values:

  • Normal
  • Deleted
Normal
MuxConfigobject

The transmuxing configurations.

Gifobject

The transmuxing configurations for GIF.

FinalDelaystring

The duration for which the final frame is paused. Unit: centisecond.

0
DitherModestring

The color dithering algorithm of the palette. Valid values: sierra and bayer.

sierra
Loopstring

The loop count.

0
IsCustomPalettestring

Indicates whether a custom palette is used.

false
Segmentobject

The segment configurations.

Durationstring

The length of the segment. Unit: seconds.

10
Namestring

The name of the template.

MPS-example
Audioobject

The audio codec configurations.

Profilestring

The codec profile of the audio. Valid values when the value of Codec is aac:

  • aac_low
  • aac_he
  • aac_he_v2
  • aac_ld
  • aac_eld
aac_low
Removestring

Indicates whether the audio stream is deleted. Valid values:

  • true
  • false
  • Default value: false.
false
Codecstring

The audio codec format. Default value: aac. Valid values:

  • aac
  • mp3
  • vorbis
  • flac
aac
Sampleratestring

The sampling rate.

  • Unit: Hz
  • Default value: 44100.
44100
Qscalestring

The strength of the independent denoising algorithm. Valid values: [1,9].

1
Channelsstring

The number of sound channels. Default value: 2.

2
Bitratestring

The audio bitrate of the output file.

  • Unit: Kbit/s.
  • Default value: 128.
500
Idstring

The transcoding template ID.

16f01ad6175e4230ac42bb5182cd****
Containerobject

The container format configurations.

Formatstring

The format of the container. Valid values:

  • flv
  • mp4
  • ts
  • m3u8
  • gif
  • mp3
  • ogg
  • flac
mp4
CreationTimestring

The time when the template was created.

2021-03-04T06:44:43Z
PageSizelong

The page number of the returned page.

10
RequestIdstring

The ID of the request.

BC860F04-778A-472F-AB39-E1BF329C****
PageNumberlong

The number of the page to return.

1

Examples

Sample success responses

JSONformat

{
  "TotalCount": 1,
  "TemplateList": {
    "Template": [
      {
        "Video": {
          "Bufsize": "6000",
          "LongShortMode": "false",
          "Degrain": "10",
          "BitrateBnd": {
            "Max": "500",
            "Min": "100"
          },
          "PixFmt": "yuv420p",
          "Pad": "1280:800:0:140",
          "Codec": "H.264",
          "Height": "800",
          "Qscale": "1",
          "Crop": "border",
          "Bitrate": "200",
          "Maxrate": "500",
          "NarrowBand": {
            "Abrmax": 3000,
            "MaxAbrRatio": 1,
            "Version": "1.0"
          },
          "MaxFps": "60",
          "Profile": "high",
          "Crf": "15",
          "Remove": "false",
          "Gop": "10",
          "Width": "256",
          "Fps": "25",
          "Preset": "medium",
          "ScanMode": "interlaced",
          "ResoPriority": "heightFirst",
          "Hdr2sdr": "true"
        },
        "TransConfig": {
          "IsCheckAudioBitrate": "false",
          "TransMode": "onepass",
          "IsCheckReso": "false",
          "IsCheckVideoBitrateFail": "false",
          "AdjDarMethod": "none",
          "IsCheckVideoBitrate": "false",
          "IsCheckResoFail": "false",
          "IsCheckAudioBitrateFail": "false"
        },
        "State": "Normal",
        "MuxConfig": {
          "Gif": {
            "FinalDelay": "0",
            "DitherMode": "sierra",
            "Loop": "0",
            "IsCustomPalette": "false"
          },
          "Segment": {
            "Duration": "10"
          }
        },
        "Name": "MPS-example",
        "Audio": {
          "Profile": "aac_low",
          "Remove": "false",
          "Codec": "aac",
          "Samplerate": "44100",
          "Qscale": "1",
          "Channels": "2",
          "Bitrate": "500"
        },
        "Id": "16f01ad6175e4230ac42bb5182cd****",
        "Container": {
          "Format": "mp4"
        },
        "CreationTime": "2021-03-04T06:44:43Z"
      }
    ]
  },
  "PageSize": 10,
  "RequestId": "BC860F04-778A-472F-AB39-E1BF329C****",
  "PageNumber": 1
}

Error codes

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

Change history

Change timeSummary of changesOperation
2024-03-14The response structure of the API has changedView Change Details
2024-01-04The response structure of the API has changedView Change Details
2023-09-21The response structure of the API has changedView Change Details
2023-07-13The request parameters of the API has changed. The response structure of the API has changedView Change Details