Modifying a Transcoding Template
Function
This API is used to modify a transcoding template.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
URI
PUT /v2/{project_id}/asset/template/transcodings
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
No |
String |
User token. This parameter is mandatory when token authentication is used. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
|
Authorization |
No |
String |
Authentication information. This parameter is mandatory for AK/SK authentication. |
|
X-Sdk-Date |
No |
String |
Time when a request is sent. This parameter is mandatory for AK/SK authentication. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
group_id |
Yes |
String |
Template group ID. |
|
name |
No |
String |
Template group name. |
|
is_default |
No |
Boolean |
Indicates whether the template is the default transcoding template. The default value is false, which means the template is not set to the default one. |
|
is_auto_encrypt |
No |
Boolean |
Whether to encrypt the output audio/video. The default value is false (not encrypted). Only HLS audio/video streams can be encrypted before being output. Original audio/video streams are not encrypted. This field is unavailable for non-HLS transcoded audio/video. Before enabling this function, obtain the key URL by referring to section "HLS Encryption Settings" in VOD User Guide. |
|
quality_info_list |
No |
Array of QualityInfoList objects |
Image quality configuration. If this parameter is not carried or is left empty, the data of this part in the template will not be updated. |
|
watermark_template_ids |
No |
Array of strings |
Array of IDs for the associated watermark templates |
|
description |
No |
String |
Template description. |
|
common |
No |
CommonInfo object |
Parameters shared by the low-bitrate HD transcoding and multi-channel encoding format. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
video |
No |
VideoInfo object |
Video template information. Configure at least one of the video and audio parameters. |
|
audio |
No |
AudioInfo object |
Audio template information. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
quality |
Yes |
String |
Image quality.
|
|
width |
No |
Integer |
Video width. H.264 encoding: The value can be 0 or an integer multiple of 2 from 32 to 4,096. H.265 encoding: The value can be 0 or an integer multiple of 2 from 160 to 4,096. |
|
height |
No |
Integer |
Video height. H.264 encoding: The value can be 0 or an integer multiple of 2 from 32 to 2,880. H.265 encoding: The value can be 0 or an integer multiple of 2 from 160 to 2,880. |
|
bitrate |
Yes |
Integer |
Average bitrate, in kbit/s. The value can be 0 or an integer from 40 to 30,000. |
|
frame_rate |
Yes |
Integer |
Frame rate, in frames per second (FPS). The value is an integer from 0 to 75. If the value is lower than 5 or higher than 60, the frame rate is adaptive. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
sample_rate |
Yes |
String |
Audio sampling rate. Possible options:
|
|
bitrate |
No |
Integer |
Audio bitrate, in kbit/s. |
|
channels |
Yes |
String |
Number of audio channels. The options include:
|
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
pvc |
No |
Boolean |
Low-bitrate HD transcoding switch. |
|
video_codec |
No |
String |
Video encoding format.
|
|
audio_codec |
No |
String |
Audio encoding format.
|
|
is_black_cut |
No |
Boolean |
Black bar cropping type. The default value is false, indicating that black bar cropping is disabled. |
|
format |
Yes |
String |
Transcoded file format.
|
|
hls_interval |
No |
Integer |
Segment file duration. The value ranges from 2 to 10 (in seconds) and defaults to 5. |
|
upsample |
No |
Boolean |
Whether to enable upsampling. After this function is enabled, video resolution can be improved and the number of sampling points can be increased. The default value is false, indicating that upsampling is disabled. |
|
adaptation |
No |
String |
Resolution adaptation mode of the transcoded media file. The options include:
NOTE:
|
|
preset |
No |
Integer |
Encoding quality level. Value range: [0,2]. 0: default mode; 1: transcoding efficiency first; 2: transcoding quality first. |
|
max_iframes_interval |
No |
Integer |
Maximum I-frame interval. Value range: [2, 10]. Default value: 5, in seconds |
|
hls_audio_separate |
No |
Boolean |
Whether to store the transcoded audio separately. |
|
hls_segment_type |
No |
String |
Packaging format of HLS segments. Currently, TS (default) and fMP4 are supported. |
Response Parameters
Status code: 200
Returned when the request succeeded.
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error description. |
Example Requests
This example modifies a transcoding template.
PUT https://{endpoint}/v2/{project_id}/asset/template/transcodings
Content-Type: application/json
{
"group_id": "f9b045e0811c482f9de0d436a5927bb6",
"name": "trans_template_test",
"is_default": true,
"quality_info_list": [
{
"video": {
"width": 1280,
"height": 720,
"bitrate": 1000,
"quality": "HD",
"frame_rate": 0
},
"audio": {
"sample_rate": "AUDIO_SAMPLE_AUTO",
"channels": "AUDIO_CHANNELS_1",
"bitrate": 0
}
}
],
"watermark_template_ids": [],
"common": {
"pvc": false,
"video_codec": "H264",
"audio_codec": "AAC",
"format": "HLS",
"hls_interval": 5
}
}
Example Responses
Status code: 400
Returned when the request failed.
{
"error_code" : "VOD.10053",
"error_msg" : "The request parameter is illegal, illegal field: {xx}."
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Returned when the request succeeded. |
|
400 |
Returned when the request failed. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot