Convert 1st-Order Ambisonics to Stereo with FFmpeg

This article explains how to downmix 1st-order Ambisonics (4-channel audio) to a standard stereo (2-channel) format using the FFmpeg pan audio filter. You will learn the exact command-line syntax and mathematical coefficients needed to map both AmbiX and FuMa formats into a balanced stereo field.

Understanding the Channel Mapping

First-order Ambisonics contains four channels: W (omni-directional pressure), X (front-to-back velocity), Y (left-to-right velocity), and Z (up-to-down velocity). To mix this down to stereo, we discard the Z (height) channel and combine W, X, and Y to simulate two virtual cardioid microphones angled at 45 degrees to the left and right.

Depending on how your Ambisonics file was encoded, it will use either the AmbiX (ACN/SN3D) or FuMa (Furse-Malham) standard. You must use the correct channel order for your specific format:

  • AmbiX Channel Order:
    • Input Channel 0 (c0): W
    • Input Channel 1 (c1): Y
    • Input Channel 2 (c2): Z
    • Input Channel 3 (c3): X
  • FuMa Channel Order:
    • Input Channel 0 (c0): W
    • Input Channel 1 (c1): X
    • Input Channel 2 (c2): Y
    • Input Channel 3 (c3): Z

The Stereo Downmix Equations

To create a natural stereo spread without clipping the audio, we use the following mixing coefficients for virtual cardioid microphones pointed at \(\pm45^\circ\):

  • Left Channel (\(L\)): \(0.5 \times W + 0.353 \times X + 0.353 \times Y\)
  • Right Channel (\(R\)): \(0.5 \times W + 0.353 \times X - 0.353 \times Y\)

FFmpeg Commands

Use the following commands in your terminal, choosing the one that matches your input file's Ambisonics format.

Option 1: For AmbiX Format (Most Common)

If your input file is in the modern AmbiX format (standard for YouTube spatial audio and modern spatial microphones), use this command:

ffmpeg -i input_ambix.wav -filter_complex "pan=stereo|c0=0.5*c0+0.353*c3+0.353*c1|c1=0.5*c0+0.353*c3-0.353*c1" output_stereo.wav

Option 2: For FuMa Format

If your input file is in the legacy FuMa format, use this command:

ffmpeg -i input_fuma.wav -filter_complex "pan=stereo|c0=0.5*c0+0.353*c1+0.353*c2|c1=0.5*c0+0.353*c1-0.353*c2" output_stereo.wav

How the pan Filter Syntax Works

  • pan=stereo: Sets the output layout to standard 2-channel stereo.
  • c0=...: Defines the mix for the output Left channel (c0).
  • c1=...: Defines the mix for the output Right channel (c1).
  • 0.5*c0, 0.353*c3, etc.: Multiplies the input channels (specified by their zero-indexed positions) by the defined coefficients to scale their volume before summing them together.