Transcoding is an offline task that converts the source audio/video bitstream. It changes parameters of the source bitstream, such as codec, resolution, and bitrate, to adapt it to different devices and network conditions. The following benefits can be achieved with transcoding:
After a video is transcoded, the playback URL of the output video can be obtained according to Getting the Result. You can use your own player or a third-party player to play back the output video.
Note:The transcoding feature is mainly suitable for UGSV scenarios. For long video scenarios (video websites, online education, etc.), adaptive bitrate streaming can deliver a better user experience.
The target specification of an output video after transcoding is specified by parameters such as codec, resolution, and bitrate. VOD integrates these parameters in the transcoding template as shown below:
Note:For more audio/video transcoding types, see Supported transcoding types.
Type | Parameter | Description |
---|---|---|
Muxing | ||
Container format |
Supported video and audio container formats for transcoding:
|
|
Deleting video stream | If this is enabled, the output video will contain only the audio stream with no video stream. | |
Deleting audio stream | If this is enabled, the output video will contain only the video stream with no audio stream. | |
Video codec | Codec | H.264 and H.265 are supported |
Bitrate | Supported bitrate range: 10 Kbps - 35 Mbps | |
Frame Rate | Supported frame rate range: 1-60 fps; common values: 24, 25, and 30 | |
Resolution |
|
|
GOP length | Supported GOP length range: 1-10s | |
Profile |
|
|
Color Space | YUV420p is supported. | |
Audio codec | Codec | MP3, AAC, AC3, and FLAC are supported |
Sample rate |
The following audio sample rates are supported:
|
|
Bitrate |
Supported bitrate range: 26-256 Kbps, including the following values:
|
|
Channel |
|
VOD provides a List of Preset Parameter Templates for common transcoding specifications. You can also create and manage custom transcoding templates on the console (see Template Settings for detailed directions) or through server API.
There are three ways to initiate a transcoding task, namely, directly initiating through server API, directly initiating through the console, and specifying a task upon upload. For more information, please see Video Processing Task System for video processing.
Methods of initiating transcoding tasks:
MediaProcessTask.TranscodeTaskSet
parameter in the request.procedure
parameter in the ApplyUpload API.procedure
parameter in the signature for upload from client.
After initiating a transcoding task, you can wait for result notification asynchronously or perform task query synchronously to get the task execution result. Below is an example of getting the result notification in normal callback (the fields with null value are omitted):
{
"EventType":"ProcedureStateChanged",
"ProcedureStateChangeEvent":{
"TaskId":"1256768367-Procedure-2e1af2456351812be963e309cc133403t0",
"Status":"FINISH",
"FileId":"5285890784246869930",
"FileName":"Animal World",
"FileUrl":"http://1256768367.vod2.myqcloud.com/xxx/xxx/AtUCmy6gmIYA.mp4",
"MetaData":{
"AudioDuration":60,
"AudioStreamSet":[
{
"Bitrate":383854,
"Codec":"aac",
"SamplingRate":48000
}
],
"Bitrate":1021028,
"Container":"mov,mp4,m4a,3gp,3g2,mj2",
"Duration":60,
"Height":480,
"Rotate":0,
"Size":7700180,
"VideoDuration":60,
"VideoStreamSet":[
{
"Bitrate":637174,
"Codec":"h264",
"Fps":23,
"Height":480,
"Width":640
}
],
"Width":640
},
"MediaProcessResultSet":[
{
"Type":"Transcode",
"TranscodeTask":{
"Status":"SUCCESS",
"ErrCode":0,
"Message":"",
"Input":{
"Definition":220
},
"Output":{
"Url":"http://1256768367.vod2.myqcloud.com/xxx/xxx/v.f20.m3u8",
"Size":63120997,
"Container":"mov,mp4,m4a,3gp,3g2,mj2",
"Height":480,
"Width":640,
"Bitrate":513402,
"Md5":"084d403c73930ca2f835679af1f37bd3",
"Duration":60,
"VideoStreamSet":[
{
"Bitrate":473101,
"Codec":"h264",
"Fps":24,
"Height":480,
"Width":640
}
],
"AudioStreamSet":[
{
"Bitrate":48581,
"Codec":"aac",
"SamplingRate":44100
}
],
"Definition":220
}
}
}
],
"TasksPriority":0,
"TasksNotifyMode":""
}
}
In the callback result, ProcedureStateChangeEvent.MediaProcessResultSet
contains the transcoding result with Type
as Transcode
and Definition
as 220
.
Was this page helpful?