Skip to content

Transcoding Templates โ€‹

Updated

A transcoding template defines the codec, resolution, bitrate, and frame rate of the output video and audio. Creating a template alone does not generate video โ€” you must also attach it to a channel Output and receive the source stream.

Configuring Output at Two Resolutions โ€‹

Transcoding templates by resolution

This example outputs both 1080p and 720p from a 1080p 30fps source.

Item1080p output720p output
Template namedemo1080pdemo720p
Video codecH.264H.264
Resolution1920 ร— 10801280 ร— 720
Frame rate30 fps30 fps
Video bitrate4 Mbps2 Mbps
AudioAAC 128 kbps / 48 kHzAAC 128 kbps / 48 kHz

Play back sources with heavy motion, small text, and dark scenes before adjusting the bitrate.

Console Configuration โ€‹

  1. Go to the Output Group on the channel creation or edit page. To edit a running channel, stop it first.
  2. Add an Output and select Transcoding Setting โ†’ Setting.
  3. For the basic example with a single audio track, configure a combined video / audio template.
  4. Enter the template name, whether video / audio is enabled, and the codec and quality parameters.
  5. Add an Output for the other resolution and attach its own template.
  6. Verify the output frame rate and destination, then save.

If you need multiple audio tracks, consider a separated video / audio transcoding configuration.

Names and Units โ€‹

Combined video / audio template names must use letters and digits and be 1~20 characters long. Input / Channel / Output names follow the rules of their respective fields.

SettingDescription
VideoBitrateVideo bitrate in the API example, in bps
AudioBitrateAudio bitrate in the API example, in bps
AudioSampleRateAudio sample rate, in Hz
FpsThe specified output frame rate
Width / HeightOutput dimensions in pixels
GOP SizeCheck the unit shown in the console; the official guide states ms

Keep the frame rate settings consistent across the output groups and outputs of a single channel. Decide first whether to follow the source or use a fixed value.

API Configuration Example โ€‹

The following JSON describes the AVTemplates section of a Channel request. It is not a complete channel creation request โ€” you must also configure the input and the Output Group.

json
{
  "AVTemplates": [
    {
      "Name": "demo1080p",
      "NeedVideo": 1,
      "NeedAudio": 1,
      "Vcodec": "H264",
      "Width": 1920,
      "Height": 1080,
      "Fps": 30,
      "VideoBitrate": 4000000,
      "RateControlMode": "ABR",
      "Acodec": "AAC",
      "AudioBitrate": 128000,
      "AudioSampleRate": 48000,
      "FrameRateType": "SPECIFIED_HZ"
    },
    {
      "Name": "demo720p",
      "NeedVideo": 1,
      "NeedAudio": 1,
      "Vcodec": "H264",
      "Width": 1280,
      "Height": 720,
      "Fps": 30,
      "VideoBitrate": 2000000,
      "RateControlMode": "ABR",
      "Acodec": "AAC",
      "AudioBitrate": 128000,
      "AudioSampleRate": 48000,
      "FrameRateType": "SPECIFIED_HZ"
    }
  ]
}

Bitrate Control and Additional Features โ€‹

FeatureMeaning
CBREncodes targeting a constant bitrate
ABREncodes targeting an average bitrate while allowing fluctuation
VBRAdjusts according to the configured quality and maximum bitrate constraints
Audio NormalizationAdjusts audio loudness to a target LUFS
Top Speed CodecA separate transcoding feature for better quality and bitrate efficiency

When applying Top Speed Codec, evaluate quality, bitrate, and cost together. Add watermarking, face blurring, and multiple audio tracks to the configuration as needed.

Verifying the Result โ€‹

After starting the channel, play each media rendition separately. Check resolution and codec information with ffprobe, and check for stalls, quality issues, and missing audio by actually playing the stream.

Keep a record of the channel configuration and template references from before the change. After testing, stop the dedicated channel and clean up the resources.

Built with VitePress ยท Deployed on Tencent EdgeOne Pages