FFmpeg afade Filter: How to Change Transition Curves

The afade filter in FFmpeg is a powerful tool for applying fade-in and fade-out effects to audio tracks. While many users stick to the default linear fade, FFmpeg supports a wide variety of transition curves—such as logarithmic, exponential, and sinusoidal—to create more natural-sounding audio transitions. This article explains how to use the afade filter’s curve parameter to select and apply different mathematical curves for your audio transitions.

To change the transition curve in FFmpeg, you use the curve (or c) option within the afade filter. By default, FFmpeg uses a linear transition, but changing this curve alters how the volume scales over the duration of the fade.

Basic Syntax

The basic syntax for the afade filter with a custom curve is:

ffmpeg -i input.mp3 -af "afade=t=in:st=0:d=5:c=log" output.mp3

In this command: * t=in specifies a fade-in (use out for a fade-out). * st=0 sets the start time of the fade in seconds. * d=5 sets the duration of the fade in seconds. * c=log specifies the curve type, which in this case is logarithmic.

Available Transition Curves

FFmpeg supports numerous curve algorithms. Here are some of the most commonly used options for the c parameter:

Practical Examples

1. Logarithmic Fade-Out To apply a smooth, natural-sounding 4-second fade-out that starts at the 30-second mark of an audio file using a logarithmic curve:

ffmpeg -i input.wav -af "afade=t=out:st=30:d=4:c=log" output.wav

2. Sinusoidal Fade-In To apply a gentle 5-second fade-in right at the beginning of the audio track using a quarter-sine curve:

ffmpeg -i input.wav -af "afade=t=in:st=0:d=5:c=qsin" output.wav

Choosing the right curve depends on your source material. For general music transitions, log, qsin, and hsin typically produce much more organic and less abrupt results than the default linear (tri) curve.