Zencoder Encoding Settings: Audio

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

This topic contains details for encoding settings related to audio.

audio_sample_rate

audio_sample_rate:Integer

API Versions: V1, 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, live

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: V1, 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: V1, V2

Parent: outputs

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

Valid Values: 1 or 2

Compatible Job Types: All

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: V1, V2

Parent: outputs

Default: 16

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

Compatible Job Types: All

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: V1, V2

Parent: outputs

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

Compatible Job Types: All

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: V1, V2

Parent: outputs

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

Compatible Job Types: All

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: V1, V2

Parent: outputs

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

Compatible Job Types: All

Example:

  • ["FL","FR","FC","BL","BR","LFE"]
  • 2
  • 1

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 precendence 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"
      ]
    }
  ]
}