Restore Clipped Audio Using FFmpeg adeclip Filter

This article provides a straightforward guide on how to restore clipped audio using FFmpeg’s adeclip filter. You will learn what audio clipping is, how the adeclip filter reconstructs distorted waveform peaks, and the exact command-line syntax required to clean up and recover your damaged audio files.

Understanding Audio Clipping and the adeclip Filter

Audio clipping occurs when an audio signal is over-amplified beyond the maximum limit of a digital system (0 dBFS). This slices off the tops and bottoms of the audio waveforms, resulting in flat peaks that cause harsh, digital distortion.

FFmpeg’s adeclip (audio declip) filter addresses this by detecting these flattened peaks and using mathematical interpolation—specifically, autoregressive modeling—to estimate and reconstruct the missing waveform data.

Basic Usage Command

To run the filter with its default settings, use the following basic FFmpeg command:

ffmpeg -i input.wav -af adeclip output.wav

This command reads your input file, applies the declipping algorithm, and exports the restored audio to a new file.

Advanced Configuration and Parameters

For severely clipped audio, the default settings might not be enough. You can fine-tune the adeclip filter using several key parameters:

Example of an Advanced Command:

ffmpeg -i input.wav -af "adeclip=threshold=0.85:w=100:a=12" output.wav

In this example, the filter is instructed to detect clipping at a lower threshold (0.85), use a larger window size of 100 milliseconds, and apply a higher autoregressive order of 12 for a more aggressive restoration.

Preventing Post-Restoration Clipping

Reconstructing peaks increases the volume of the restored sections, which can cause the output file to clip again at the output stage. To prevent this, it is recommended to chain the volume filter to reduce the overall gain before exporting:

ffmpeg -i input.wav -af "adeclip,volume=-3dB" output.wav

This ensures the newly reconstructed peaks have enough headroom to exist without inducing new digital distortion.