This topic describes the parameters of a transcoding template and provides examples.
|
Parameter |
Data type |
Required |
Description |
Example |
|
Type |
string |
Yes |
The type of the transcoding template. Valid values:
|
Normal |
|
Container |
JSON |
Yes |
The container format. |
{"Format" : "mp4"} |
|
Video |
JSON |
No |
The parameters of the output video. |
{"Codec" : "H.264", "Maxrate" : 900, "Rotate" : "auto", "Preset" : "medium", "PixFmt" : "yuv420p", "Width" : 640, "Bitrate" : 400 } |
|
Audio |
JSON |
No |
The parameters of the output audio. |
{ "Codec" : "aac", "Bitrate" : 64, "Samplerate" : 44100, "Channels" : 2 } |
|
MuxConfig |
JSON |
No |
The container segment. |
{ "Segment": { "Duration" : 5, "ForceSegTime" : "2,3" }} |
Container
|
Parameter |
Data type |
Required |
Description |
Example |
|
Format |
String |
Yes |
The container format. Valid values: mp4, m3u8, flv, ts, hls-fmp4, mpd, mxf, mp3, ogg, flac, m4a, gif, and webp. |
mp4 |
Video
|
Parameter |
Data type |
Required |
Description |
Example |
|
Codec |
string |
No |
The encoding format. Valid values: H.264, H.265, GIF, WEBP, AV1, and AVC-Intra. |
H.264 |
|
Profile |
string |
No |
The encoding profile. Default value: high. Valid values:
|
main |
|
Bitrate |
integer |
No |
The average bitrate of the video. Valid values: [10,50000]. Unit: Kbit/s. |
3000 |
|
Crf |
integer |
No |
The constant rate factor. Valid values: [0,51]. If you specify this parameter, the value of Bitrate is invalid. Default value:
|
23 |
|
Width |
integer |
No |
The width of the output video.
|
1920 |
|
Height |
integer |
No |
The height of the output video.
|
1080 |
|
Fps |
integer |
No |
The video frame rate.
|
25 |
|
Gop |
integer |
No |
The maximum number of frames between two keyframes.
|
250 |
|
Preset |
string |
No |
The preset video algorithm. This parameter is valid only if the Codec parameter is set to H.264.
|
medium |
|
ScanMode |
string |
No |
The scan mode. Valid values: interlaced and progressive. |
progressive |
|
PixFmt |
string |
No |
The pixel format. Valid values: yuv420p, yuvj420p, yuv422p, yuvj422p, yuv444p, yuvj444p, nv12, nv16, nv20, yuv420p10, yuv422p10, and yuv444p10. |
yuv420p |
|
Remove |
boolean |
No |
Specifies whether to remove the video. Valid values:
|
false |
|
Crop |
string |
No |
The crop mode. Two modes are supported:
|
1280:800:0:140 |
|
Pad |
string |
No |
The information about the black bars.
|
1280:800:0:140 |
|
LongShortMode |
boolean |
No |
Specifies whether to enable the auto-rotate screen feature. |
false |
|
Bufsize |
integer |
No |
The buffer size.
|
6000 |
|
Maxrate |
integer |
No |
The maximum bitrate of the video. Valid values: [10,50000]. Unit: Kbit/s. |
9000 |
|
AbrMax |
string |
No |
The maximum adaptive bitrate (ABR). This parameter is valid only when the Type parameter is set to NarrowBandV1.
|
6000 |
Audio
|
Parameter |
Data type |
Required |
Description |
Example |
|
Codec |
string |
No |
The audio encoding and decoding format.
Note
When the container format is m3u8 and the video codec is H.265, AAC is a valid audio codec. |
AAC |
|
Profile |
string |
No |
The audio encoding profile. If the Codec parameter is set to AAC, you can set this parameter to aac_low, aac_he, aac_he_v2, aac_ld, or aac_eld. |
aac_low |
|
Samplerate |
integer |
No |
The sampling rate.
|
44100 |
|
Bitrate |
integer |
No |
The audio bitrate of the output file.
|
128 |
|
Channels |
integer |
No |
The number of sound channels. Default value: 2. |
2 |
|
Remove |
boolean |
No |
Specifies whether to delete the audio stream. Valid values: Valid values:
|
false |
|
Volume |
JSON |
No |
The volume control configurations. |
For more information, see Audio.Volume. |
Audio.Volume
|
Parameter |
Data type |
Required |
Description |
Example |
|
Method |
string |
No |
The volume adjustment method. Valid values:
|
auto |
|
IntegratedLoudnessTarget |
integer |
No |
The output volume. |
-6 |
|
TruePeak |
integer |
No |
The maximum volume. |
-1 |
|
LoudnessRangeTarget |
integer |
No |
The range of the volume relative to the output volume. It takes effect when Method is set to dynamic.
|
8 |
MuxConfig
|
Parameter |
Data type |
Required |
Description |
Example |
|
Segment |
JSON |
Yes |
The segment parameters. |
For more information, see MuxConfig.Segment. |
MuxConfig.Segment
|
Parameter |
Data type |
Required |
Description |
Example |
|
Duration |
integer |
Yes |
The segment length. Unit: seconds. |
10 |
|
ForceSegTime |
string |
No |
The time point at which a forced segment is generated. |
2,3 |
Sample template
{
"Type": "Normal",
"Container": {
"Format": "mp4"
},
"Video": {
"Codec": "H.264",
"LongShortMode": false,
"Height": 2160,
"Remove": false,
"Profile": "high"
},
"Audio": {
"Codec": "AAC",
"Volume": {
"Method": "auto"
},
"Remove": false,
"Samplerate": 44100,
"Bitrate": 128,
"Channels": 2
}
}