Zencoder Encoding Settings: Rate Control

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

This topic contains details for encoding settings related to encoding rate control, which are important to the quality of outputs.

quality

quality:Integer

API Versions: V1, V2

Parent: outputs

Default: 3

Valid Values: 1-5

Compatible Job Types: All

Example: 4

Description:

The desired output video quality, from 1 to 5. Automatically selects a video_bitrate to achieve this quality.

This automatically chooses a video bitrate that produces a video of the desired quality. This is useful, because one video may need a higher bitrate than another to achieve a target visual quality, due to the complexity of the content, the resolution, etc.

Higher quality means higher bitrate and vice versa.

Quality 1: Highly compressed. Mediocre visual quality, but small files.
Quality 2: Acceptable quality.
Quality 3: Good quality. Better than most web video.
Quality 4: Great quality. Looks excellent.
Quality 5: Nearly lossless. Large files. Not recommended unless you plan to encode this output again.

As a rule of thumb, lowering quality by a level will reduce file size by about 40%. Higher quality encoding is also a bit slower than lower quality encoding.

Remember that the output bitrate will vary from file to file when using the quality setting, depending on the type of video. Even at the same Quality setting, low-complexity video (like a screencast) will generally result in lower bitrates than high-complexity video (like a movie).

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "quality": 4
    }
  ]
}

See Also: video_bitrate

video_bitrate

video_bitrate:Integer

API Versions: V1, V2

Parent: outputs

Valid Values: A positive integer. 100000 max.

Compatible Job Types: All

Example: 1200

Description:

The desired output bitrate for a video, expressed in kbps. This results in a predictable output bitrate, but not predictable quality. For example, at 640x480, 500kbps might be enough for a video blog to look good, but an action movie might look bad at the same bitrate. Similarly, it might be too high for a screencast, resulting in a file that is larger than it needs to be.

If a reliable bitrate is more important than reliable quality, choose video_bitrate. If a reliable visual quality is more important, use quality instead.

video_bitrate uses two-pass, variable bitrate (VBR) encoding. one_pass encoding may be triggered via the one_pass option, though one_pass VBR encoding is typically of poor quality, and only results in a small speedup, so this is not recommended.

Also keep in mind that bitrates that are too high or too low are unusable. By default, if you specify a bitrate that is too low, we will automatically correct to an acceptable bitrate. Enable strict mode if you would prefer a job to fail in this situation rather than auto-correcting.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "video_bitrate": 1200
    }
  ]
}

See Also: quality

audio_quality

audio_quality:Integer

API Versions: V1, V2

Parent: outputs

Default: 3

Valid Values: 1-5

Compatible Job Types: All

Example: 4

Description:

The desired output audio quality, from 1 to 5. Automatically selects an audio_bitrate to achieve this quality.

Quality 1 uses a low audio bitrate, which results in a low sound quality, but small files. Quality 5 results in a high audio bitrate for larger files but higher quality.

We recommend using 3 for most purposes, or 4-5 when transparent sound quality is desired.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "audio_quality": 4
    }
  ]
}

See Also: quality and audio_bitrate

audio_bitrate

audio_bitrate:Integer

API Versions: V1, V2

Parent: outputs

Valid Values: A positive integer.

Compatible Job Types: All

Example: 96

Description:

An output bitrate setting, in Kbps. With 2 channel output, this is the total audio bitrate, not the bitrate of each channel, so 128kbps stereo output is encoded at 64kbps per channel. Below 48kbps per channel, quality can start to suffer.

Beware that if you manually set an audio_sample_rate, you need to choose a compatible audio_bitrate, or the encoding may fail. By default, we will auto-correct these failues and choose a valid bitrate/sample rate combination. Enable strict_mode to avoid this auto-correction.

For AAC audio, a bitrate lower than 84 will set the AAC profile to HE-AAC.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "audio_bitrate": 96
    }
  ]
}

See Also: audio_quality, audio_sample_rate, and max_aac_profile

max_video_bitrate

max_video_bitrate:Integer

API Versions: V1, V2

Parent: outputs

Valid Values: A positive integer. 100000 max.

Compatible Job Types: All

Example: 1500

Description:

A maximum average bitrate for a movie. Overrides both the quality and video_bitrate settings to ensure that a bitrate doesn't exceed the provided number.

max_video_bitrate is especially useful when encoding for mobile devices using the quality setting, which autoselects a bitrate. Mobile devices sometimes have fixed bitrate limits; for example, the iPhone 3GS has a bitrate limit of 1500 kbps.

Note: This option does not apply to the VP6 codec. It will be ignored if used with VP6.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "max_video_bitrate": 1500
    }
  ]
}

speed

speed:Integer

API Versions: V1, V2

Parent: outputs

Default: 3

Valid Values: 1-5

Compatible Job Types: vod

Example: 4

Description:

A target transcoding speed. Slower transcoding allows for more advanced file compression, while faster transcoding is possible by skipping some advanced compression features. Valid values are 1-5.

Note: at the moment, only H.264 output has five speed levels. For VP6 content, 1-2 are a slower mode, and 3-5 are a faster mode. Other video codecs do not support this setting at all.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "speed": 4
    }
  ]
}

decoder_bitrate_cap

decoder_bitrate_cap:Integer

API Versions: V1, V2

Parent: outputs

Valid Values: A positive integer. 100000 max.

Compatible Job Types: All

Example: 800

Description:

The max bitrate fed to the decoder via a buffer. This setting is typically used only for streaming (RTMP, HLS, or broadcast video).

Only use this setting if you understand its implications, as it can decrease video quality.

For Live outputs, this defaults to 15% higher than the video_bitrate, if video_bitrate is specified.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "decoder_bitrate_cap": 800
    }
  ]
}

See Also: decoder_buffer_size

decoder_buffer_size

decoder_buffer_size:Integer

API Versions: V1, V2

Parent: outputs

Valid Values: A positive integer. 100000 max.

Compatible Job Types: All

Example: 800

Description:

The size of the buffer fed to the decoder when using a bitrate_cap, expressed in kbps. The buffer_size divided by bitrate_cap represents the size of the buffer in seconds; so if you set bitrate_cap to 1000 and buffer_size to 1000, the buffer is effectively 1.0 second. If bitrate_cap is 500 and buffer_size is 1000, the buffer is 2.0 seconds.

Only use this setting if you understand its implications, as it can decrease video quality. This should typically only be used for streaming (or for device playback).

For Live outputs, this defaults to 300% of the decoder_bitrate_cap, creating a buffer duration of 3 seconds. However, if segment_seconds is also set, the default decoder_buffer_size will be reduced such that the effective buffer duration is half of a segment's duration.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "decoder_buffer_size": 800
    }
  ]
}

See Also: decoder_bitrate_cap

one_pass

one_pass:Boolean

API Versions: V1, V2

Parent: outputs

Default: false

Valid Values: true or false

Compatible Job Types: vod

Example: true

Description:

By default, we will use two-pass encoding whenever encoding to a target video_bitrate, and one_pass encoding when performing constant quality encoding (which doesn't benefit from a second pass). This option will force one_pass encoding when targeting a specific video_bitrate.

We highly recommend not forcing one_pass encoding. The first pass in two-pass encoding is faster than the second pass, so going from two-pass encoding to one_pass encoding only results in a 25% encoding speedup, not 50% faster encoding. And two-pass encoding looks significantly better than one_pass encoding.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "one_pass": true
    }
  ]
}

audio_constant_bitrate

audio_constant_bitrate:Boolean

API Versions: V1, V2

Parent: outputs

Default: false

Valid Values: true or false

Compatible Job Types: All

Example: true

Description:

Enable constant bitrate (CBR) mode for audio, when possible. audio_sample_rate may be adjusted for compatibility.

audio_bitrate setting must also be specified when using this option.

Compatible with AAC and MP3 audio codecs. Not compatible when used with the VP6 video_codec.) For MP3 audio, only certain bitrates are compatible with this option: 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320.

Note: The AAC codec does not define a fixed CBR mode, so there are still small variations in bitrate over short time periods. Most software will still report these encodes as VBR.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "audio_constant_bitrate": true
    }
  ]
}

See Also: audio_bitrate