Audio Settings

This topic contains details for encoding settings related to audio.

audio_sample_rate

audio_sample_rate:Integer

API Versions: V2

Parent: outputs

Valid Values: A valid sample rate. Depends on the codec; typically 8000, 11025, 12000, 16000, 22050, 32000, 44100, 48000, 96000

Compatible Job Types: vod

Example: 44100

Description:

Audio sample rate in Hz.

We recommend that you only use this setting if you have a good reason to do so. Forcing an output sample rate can cause unexpected problems - for example, each audio_codec only supports a limited range of sample rates, and each sample rate is only compatible with a limited range of bitrates. You can't encode 48Khz AAC at 16kbps, or 8000hz MP3 at 320kbps.

By default, the input sample rate will be used (i.e. the audio will not be resampled), though sample rates higher than 96000 will be reduced to a max of 96000.

The FLV video format only supports sample rates of 11025, 22050, and 44100. By default, we will only use these for FLV video, and will move other sample rates to the nearest rate compatible with FLV. Enable strict_mode if you want incompatible sample rates to result in a failing job instead of auto-correcting to a valid sample_rate.

  {
    "input": "s3://zencodertesting/test.mov",
    "outputs": [
      {
        "audio_sample_rate": 44100
      }
    ]
  }

See Also: audio_bitrate and audio_quality

max_audio_sample_rate

max_audio_sample_rate:Integer

API Versions: V2

Parent: outputs

Valid Values: A valid sample rate. Depends on the codec; typically 8000, 11025, 12000, 16000, 22050, 32000, 44100, 48000, 96000

Compatible Job Types: live

Example: 44100

Description:

A maximum audio sample rate. Overrides the audio_sample_rate settings to ensure that a sample rate doesn't exceed the provided number.

If your input video has a sample rate of 48000 and your max_audio_sample_rate is set to 22050, we will resample the audio to 22050. If it has a sample rate of 11025, we will leave it alone.

Use this option if the target playback device doesn't support higher sample rates.

By default, the input sample rate will be used (i.e. the audio will not be resampled), though sample rates higher than 96000 will be reduced to a max of 96000.

The FLV video format only supports sample rates of 11025, 22050, and 44100. By default, we will only use these for FLV video, and will move other sample rates to the nearest rate compatible with FLV. Enable strict_mode if you want incompatible sample rates to result in a failing job instead of auto-correcting to a valid sample_rate.

  {
    "input": "s3://zencodertesting/test.mov",
    "outputs": [
      {
        "max_audio_sample_rate": 44100
      }
    ]
  }

See Also: audio_sample_rate, audio_bitrate, and audio_quality

audio_channels

audio_channels:Integer

API Versions: V2

Parent: outputs

Default: 1 if the original file is mono; otherwise, 2.

Valid Values: 1, 2 or 6 (6 is valid only if the input content has 6 channels in a 5.1 config, or input_audio_channels provides a valid 5.1 config)

Compatible Job Types: VOD

Example: 1

Description:

The number of audio channels to use: 1 (mono) or 2 (stereo).

Note that mono AAC audio sometimes erroneously self-reports as stereo when inspected. We recommend using iTunes to get the true number of channels for AAC audio. Note that 5.1 channel audio output is also supported. For that, you would use and output_audio_channels instead.

  {
    "input": "s3://zencodertesting/test.mov",
    "outputs": [
      {
        "audio_channels": 1
      }
    ]
  }

See Also: audio_bitrate, audio_quality, input_audio_channels, and output_audio_channels

audio_bit_depth

audio_bit_depth:Integer

API Versions: V2

Parent: outputs

Default: 16

Valid Values: 16, 24, 32 for PCM; 16 for all others.

Compatible Job Types: VOD

Example: 24

Description:

The number of bits in each sample: 16, 24, 32.

  {
    "input": "s3://zencodertesting/test.mov",
    "outputs": [
      {
        "audio_bit_depth": 24
      }
    ]
  }

See Also: audio_sample_rate

audio_language

audio_language:String

API Versions: V2

Parent: outputs

Valid Values: ISO 639-1 or 639-2 language code

Compatible Job Types: VOD

Example: en

Description:

Set the language identifier for the output's audio track, describing its language content. Can be an ISO 639-1 or ISO 639-2 language code (2 or 3 characters, respectively).

Note: Currently supported for MP4, MKV, and WEBM format outputs, as well as DASH streaming delivery outputs.

  {
    "input": "s3://zencodertesting/test.mov",
    "outputs": [
      {
        "audio_language": "en"
      }
    ]
  }

input_audio_channels

input_audio_channels:Hash

API Versions: V2

Parent: outputs

Valid Values: A hash of channel identifiers and track index values.

Compatible Job Types: VOD

Example:

  • {"FR":1,"FL":2,"FC":3,"BL":4,"BR":5,"LFE":6}
  • {"DL":7,"DR":8}
  • {"FL":"1:1","FR":"1:2"}

Description:

Sets the mapping between the input's audio tracks and their channel identifiers. This option can be used to take an input with multiple audio tracks and create a single audio track on the output. The keys of the hash must be valid channel identifiers, and the values must be integers, which correspond to the audio track index on the input.

This option can also be used to select individual channels from an input by specifying an additional channel index. For example, setting a channel identifier to "1:1" will select the first channel of the first audio track on the input.

Valid audio channel identifiers: "FL", "FR", "FC", "LFE", "BL", "BR", "DL", "DR".

  {
    "input": "s3://zencodertesting/test.mov",
    "outputs": [
      {
        "input_audio_channels": {
          "FL": 1,
          "FR": 2,
          "FC": 3,
          "LFE": 4,
          "BL": 5,
          "BR": 6
        }
      }
    ]
  }

output_audio_channels

output_audio_channels:Array or Integer

API Versions: V2

Parent: outputs

Valid Values: A channel layout or integer to define the number of output audio channels.

Compatible Job Types: VOD

Example:

  • ["FL","FR","FC","BL","BR","LFE"]
  • 2
  • 1
  • 6 (6 is valid only if the input content has 6 channels in a 5.1 config, or input_audio_channels provides a valid 5.1 config)

Description:

Use this along with the input_audio_channels option to define a custom output audio channel layout or mixdown.

This option has two modes, one for specifying a custom audio channel layout, and another for specifying either a mono or stereo mixdown.

This option can either be an array of valid channel identifiers or an integer. To create a stereo mixdown, set this parameter to 2. To create a mono mixdown, set this parameter to 1.

Valid audio channel identifiers: "FL", "FR", "FC", "LFE", "BL", "BR", "DL", "DR".

By setting this option to an array of valid channel identifiers, it is possible to create a custom audio channel layout.

Note: this option takes precedence over audio_channels.

  {
    "input": "s3://zencodertesting/test.mov",
    "outputs": [
      {
        "input_audio_channels": {
          "FL": 1,
          "FR": 2,
          "FC": 3,
          "LFE": 4,
          "BL": 5,
          "BR": 6
        },
        "output_audio_channels": [
          "FL",
          "FR",
          "FC",
          "BR",
          "BL",
          "LFE"
        ]
      }
    ]
  }

select_audio_language

select_audio_language:Stringr

API Versions: V2

Parent: outputs

Valid Values: A 2- or 3-character language code defined in ISO 639-1 and ISO 639-2.

Compatible Job Types: VOD

Example:

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "select_audio_language": "es"
    }
  ]
}

Description:

This option for multi-channel audio allows you to select the audio track to use for the output by language. Note that if there are multiple audio tracks with the same language, the encoder will use the first one it finds that matches the select_audio_language value. Typically, this setting would be used to select one of the channels where the video has different audio tracks in different languages.