Configure FFmpeg adeclick Threshold and Window Size

This guide provides a straightforward overview of how to adjust the threshold and window size parameters within the FFmpeg adeclick filter. By fine-tuning these settings, you can effectively remove digital clicks, pops, and crackle from your audio files while preserving overall sound quality.

Understanding the parameters

The adeclick filter uses an impulsive noise detection and interpolation algorithm. To control how aggressively it detects and repairs clicks, you must configure two primary parameters: threshold and window.

1. Threshold (threshold or t)

The threshold parameter controls the sensitivity of click detection. * Default Value: 2.0 * Allowed Range: 1.0 to 100.0 * How it works: A lower threshold value makes the filter more sensitive, meaning it will detect and remove quieter, more subtle clicks. However, setting this value too low can result in false positives, where actual audio content (like drum transients) is mistaken for a click, leading to audio distortion. Higher values make the detection less sensitive, targeting only the loudest pops.

2. Window Size (window or w)

The window parameter defines the size of the audio segment (in milliseconds) used for analysis and interpolation. * Default Value: 55.0 * Allowed Range: 10.0 to 100.0 * How it works: This setting determines the duration of the audio buffer that FFmpeg analyzes at one time. A larger window size allows the filter to better reconstruct long or severe clicks, but it requires more processing power. A smaller window size is more suitable for short, high-frequency crackles and processes faster.


FFmpeg Command Syntax

To configure these settings, use the -af (audio filter) flag followed by adeclick and your desired parameters separated by colons.

Basic Syntax

ffmpeg -i input.wav -af "adeclick=threshold=VALUE:window=VALUE" output.wav

Example: Aggressive Click Removal

If your audio has a lot of quiet, persistent crackling, use a lower threshold and a standard window size:

ffmpeg -i input.wav -af "adeclick=threshold=1.5:window=55.0" output.wav

Example: Conservative Click Removal

If you only want to remove loud, distinct pops without affecting the rest of the dynamic range, increase the threshold:

ffmpeg -i input.wav -af "adeclick=threshold=5.0:window=60.0" output.wav

Example: Short-Hand Syntax

You can also use the abbreviated parameter names t and w:

ffmpeg -i input.wav -af "adeclick=t=3.0:w=40" output.wav

  1. Start with the default settings: Run ffmpeg -i input.wav -af "adeclick" output.wav to establish a baseline.
  2. Adjust Threshold first: If clicks remain, lower the threshold in steps of 0.2 (e.g., 1.8, 1.6) until the clicks disappear. If the audio sounds muffled or distorted, raise the threshold.
  3. Adjust Window size second: If the clicks are very long or leave noticeable “holes” in the audio after being removed, increase the window size to allow for better interpolation.