Zencoder Encoding Settings: H.264

Product(s)
Zencoder
Role(s)
API Developer
Topic(s)
Encoding Settings
API(s)
Zencoder API

This topic contains details for encoding settings related to H.264 video outputs.

Encoding recommendations

In addition to settings found on this page, you may want to include the following general video settings.

tuning

tuning:String

API Versions: V1, V2

Parent: outputs

Valid Values: film, animation, grain, psnr, ssim, fastdecode, or zerolatency

Compatible Job Types: All

Example: film

Description:

Tune the output video to optimize for a specific content type, or a specific encoding priority.

Behind the scenes, this sets the x264 --tune option.

Possible values:

  • film - optimized for most non-animated video content (not only feature films).
  • animation - optimized for animation. Note that most 3D animation behaves more like film and not like hand-drawn animation, so only use this for hand-drawn animation (anime, classic Disney, etc.).
  • 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 - x264 will keep an internal buffer of frames to improve quality; this setting removes that buffer, but reduces quality.
{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "tuning": "film"
    }
  ]
}

crf

crf:Integer

API Versions: V1, V2

Parent: outputs

Valid Values: 1-51

Compatible Job Types: All

Example: 26

Description:

CRF is a bitrate-control setting, and sets a constant ratefactor. This is closely related to constant quantizer encoding, though CRF mode generally achieves better compression than constant Q encoding by reducing the quantizer quality on "less important" frames. Read more about crf.

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.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "crf": "26"
    }
  ]
}