Configure FFmpeg adeclip Filter Threshold and Method

The adeclip filter in FFmpeg is a powerful tool designed to restore clipped audio by interpolating damaged samples that exceed a specific digital amplitude limit. This article provides a quick guide on how to configure the threshold and method parameters within the adeclip filter to effectively clean up distorted audio recordings.

Understanding the adeclip Filter Parameters

When audio is recorded too loudly, it “clips,” resulting in flat-topped waveforms and harsh digital distortion. The adeclip filter detects these flat peaks and reconstructs them using mathematical interpolation.

To customize this process, you primarily configure two parameters: threshold and method.

1. Configuring the Threshold (threshold or t)

The threshold parameter defines the amplitude level at which a sample is considered clipped.

Example Command:

ffmpeg -i input.wav -af "adeclip=threshold=0.95" output.wav

(Alternatively, you can use the short alias t):

ffmpeg -i input.wav -af "adeclip=t=0.90" output.wav

2. Configuring the Method (method or m)

The method parameter determines the mathematical algorithm used to reconstruct the clipped peaks.

Example Command:

ffmpeg -i input.wav -af "adeclip=method=ortho" output.wav

(Using the short alias m):

ffmpeg -i input.wav -af "adeclip=m=double" output.wav

Combining Threshold and Method

For optimal results, you will usually want to configure both parameters together based on the severity of your audio’s clipping.

To apply a threshold of 0.96 using the double interpolation method, use the following command:

ffmpeg -i input.wav -af "adeclip=threshold=0.96:method=double" output.wav

If the clipping is severe, lowering the threshold (e.g., to 0.90 or 0.85) forces the filter to reconstruct a larger portion of the wave peak, though setting it too low may introduce unwanted smoothing artifacts.