Zencoder: HEVC/H.265 Guide

Product(s)
Zencoder
Role(s)
API Developer
API(s)
Zencoder API

Zencoder supports next-generation video playback with the HEVC (H.265) codec. HEVC is the successor to the ubiquitous H.264 codec, and creates high quality outputs with a much lower bitrate than AVC/H.264.

HEVC/H.265 Overview

HEVC (also commonly referred to as H.265) is available to all customers. HEVC is a next-generation video codec that is capable of delivering higher quality content at lower bitrates than its predecessor, H.264.

Encoding recommendations

video_codec_level: constrains the bitrate and coding tree units (CTUs). List of valid values.

video_codec_profile: sets the encoding profile. The currently supported HEVC profiles are: main, main10, main12, main422-10, main422-12, main444-8, main444-10, main444-12. Default: main.

video_reference_frames: Limits the number of reference frames for HEVC. Default: 3.

video_bframes: Limits the number of consecutive bframes used for HEVC. Default: 3.

tuning: Tunes the output video to optimize for a specific encoding priority. Note that for HEVC video, the allowable values for tuning are:

  • grain - optimized for film with high levels of grain.
  • psnr - uses "peak signal-to-noise ratio" to optimize video quality.
  • ssim - uses "structural similarity" to optimize video quality.
  • fastdecode - reduces encoding complexity, to allow for easier decoding.
  • zerolatency - x265 will keep an internal buffer of frames to improve quality; this setting removes that buffer, but reduces quality.

crf: CRF is a bitrate-control setting, and sets a constant ratefactor. The Zencoder Quality setting determines an appropriate CRF for a given video. So if you set both Quality and CRF, the CRF setting will override Quality. Valid values are 0-51, with lower values being better quality. Generally speaking, you shouldn't have to go below 16; 16 is nearly lossless for most files. Around 24 usually looks pretty good. Around 35 looks pretty compressed.

Sample: HEVC + MP4

Below are sample settings for a job that will create an HEVC output (muxed as mp4) with an additional MP4 output for clients that do not yet support HVEC.

{
  "input": "https://user:pass@bucket-name/file-name.mov",
  "outputs": [
      {
          "label": "hevc",
          "url": "s3://output-bucket/h265.mp4",
          "video_codec": "hevc",
          "video_codec_profile": "main",
          "audio_codec": "aac",
          "format": "mp4",
          "size": "1920x1080"
      },
      {
          "label": "h264",
          "url": "s3://output-bucket/h264.mp4",
          "video_codec": "h264",
          "video_codec_profile": "main",
          "audio_codec": "aac",
          "format": "mp4",
          "size": "640x360"
      }
  ]
}