Configure FFmpeg firequalizer Window and FFT Size

This article explains how to configure the window function and FFT size for the firequalizer audio filter in FFmpeg. You will learn how to select a window function using the wfunc parameter and how to control the internal FFT size by adjusting the delay and accuracy settings to achieve the desired balance between frequency resolution and latency.

Configuring the Window Function (wfunc)

The firequalizer filter uses a windowed sinc design to produce its finite impulse response (FIR) coefficients. You can change the window function using the wfunc parameter. Different window functions offer various trade-offs between main-lobe width (spectral resolution) and side-lobe attenuation (spectral leakage).

The syntax for setting the window function is: wfunc=window_name

Supported window functions include: * rectangular * hann (default) * hamming * blackman * nuttall * kaiser * tukey * welch * gaussian * lanczos * bartlett

Example:

To apply a firequalizer filter with a hamming window:

ffmpeg -i input.wav -af "firequalizer=gain='gain_interpolate(f)':wfunc=hamming" output.wav

Configuring the FFT Size (delay and accuracy)

The firequalizer filter does not have a direct fftsize parameter. Instead, FFmpeg automatically determines the FFT size based on your audio’s sample rate, the filter’s delay parameter, and the required frequency resolution (accuracy).

To force a larger or smaller FFT size, you must adjust these two parameters:

  1. delay (seconds): This parameter sets the filter delay. The number of filter taps (coefficients) is calculated as: \[\text{Taps} = 2 \times \text{delay} \times \text{sample\_rate}\] The internal FFT size must be a power of two that is large enough to accommodate this tap length. Increasing the delay directly increases the FFT size, resulting in steeper, more precise filter cuts at the expense of higher audio latency. The default is 0.05 seconds.
  2. accuracy (Hz): This parameter defines the minimum frequency resolution. If the requested accuracy requires a larger FFT size than the one calculated from the delay, FFmpeg will automatically increase the FFT size to meet this resolution. The default is 5 Hz.

Example: Increasing FFT Size for Sharp Filtering

To configure a highly accurate EQ curve with a large FFT size, increase the delay to 0.1 seconds and set the accuracy to 2 Hz:

ffmpeg -i input.wav -af "firequalizer=gain='gain_interpolate(f)':wfunc=blackman:delay=0.1:accuracy=2" output.wav

Example: Decreasing FFT Size for Low Latency

To minimize the FFT size and reduce processing latency, decrease the delay to 0.01 seconds (10 milliseconds) and increase the accuracy limit to 20 Hz:

ffmpeg -i input.wav -af "firequalizer=gain='gain_interpolate(f)':wfunc=hann:delay=0.01:accuracy=20" output.wav