Split Audio into Frequency Bands with FFmpeg

This article demonstrates how to split a single audio stream into multiple distinct frequency bands—such as bass, mids, and treble—using FFmpeg. By utilizing the asplit filter alongside frequency-filtering options like lowpass and highpass, you can isolate specific frequency ranges and output them into separate audio files or streams.

To split an audio stream by frequency, you must first duplicate the input stream using the asplit filter. Once duplicated, you apply different frequency-cutting filters to each split stream to isolate the desired bands.

The FFmpeg Command

Below is a practical command that splits an input audio file into three bands: Low (under 200 Hz), Mid (200 Hz to 4000 Hz), and High (above 4000 Hz).

ffmpeg -i input.mp3 -filter_complex \
"[0:a]asplit=3[low_in][mid_in][high_in]; \
 [low_in]lowpass=f=200[low]; \
 [mid_in]highpass=f=200,lowpass=f=4000[mid]; \
 [high_in]highpass=f=4000[high]" \
-map "[low]" low.wav \
-map "[mid]" mid.wav \
-map "[high]" high.wav

How the Filters Work

  • asplit=3: This takes the input audio stream [0:a] and splits it into three identical, independent audio streams labeled [low_in], [mid_in], and [high_in].
  • lowpass=f=200: Applied to the first stream, this filter allows only frequencies below 200 Hz to pass through, effectively isolating the bass.
  • highpass=f=200,lowpass=f=4000: Applied to the second stream, this chain blocks frequencies below 200 Hz and above 4000 Hz, leaving only the mid-range frequencies.
  • highpass=f=4000: Applied to the third stream, this filter allows only frequencies above 4000 Hz to pass through, isolating the treble.
  • -map: This maps each processed stream ([low], [mid], and [high]) to its own output file (low.wav, mid.wav, and high.wav).

You can customize the cutoff frequencies by changing the f values in the filters to match your specific audio processing needs.