# Audiomix Presets Audiomix presets define how Encore mixes audio channels when transcoding between different channel layouts. They control the downmixing and upmixing of audio, such as converting 5.1 surround sound to stereo, or mono to stereo. ## Overview When encoding audio, you often need to convert between different channel configurations. For example, a source file might have 5.1 surround sound, but you need to create a stereo output for web delivery. Audiomix presets define the mathematical formulas that determine how each input channel contributes to the output channels. Encore uses FFmpeg's `pan` audio filter under the hood, and audiomix presets provide a convenient way to configure these pan mappings without writing complex filter expressions in each encoding profile. ## How It Works When Encore processes an audio encode, it: 1. Identifies the input channel layout (e.g., 5.1, stereo, mono) 2. Looks up the requested audiomix preset (defaults to "default") 3. Finds the appropriate pan mapping for the input-to-output conversion 4. If no specific mapping exists, uses the default pan for the output layout 5. If no default pan exists and `fallbackToAuto` is enabled, uses FFmpeg's automatic channel layout conversion ## Preset Structure Each audiomix preset contains three configuration options: **fallbackToAuto** (boolean, default: `true`): When set to `true`, Encore falls back to FFmpeg's automatic channel conversion if no explicit pan mapping is defined for the input/output combination. When `false`, the encode fails if no mapping exists. **defaultPan** (map): Defines default pan expressions for output channel layouts. These are used when no specific mapping exists for an input/output combination, but the output has fewer or equal channels than the input. **panMapping** (nested map): Defines specific pan expressions for exact input-to-output channel layout conversions. The outer key is the input layout, the inner key is the output layout. ## Configuration Audiomix presets can be configured in two ways: ### Inline Configuration Define presets directly in your application configuration: ```yaml encore-settings: encoding: audio-mix-presets: default: fallback-to-auto: true default-pan: stereo: FL=FL+0.707107*FC+0.707107*BL+0.707107*SL|FR=FR+0.707107*FC+0.707107*BR+0.707107*SR pan-mapping: mono: stereo: FL=0.707*FC|FR=0.707*FC ``` ### External File Reference an external YAML or JSON file containing preset definitions: ```yaml encore-settings: encoding: audio-mix-preset-location: file:///path/to/audio-mix-presets.yml ``` The file may be referenced using a http url. The external file format: ```yaml default: default-pan: stereo: FL=FL+0.707107*FC+0.707107*BL+0.707107*SL|FR=FR+0.707107*FC+0.707107*BR+0.707107*SR pan-mapping: mono: stereo: FL=0.707*FC|FR=0.707*FC de: fallback-to-auto: false default-pan: stereo: FL layout2!"** No pan mapping exists for this specific channel conversion, and either `fallbackToAuto` is `false` or the output has more channels than the input. Add a specific pan mapping or enable `fallbackToAuto`.