Configure FFmpeg Acrossfade Transition Curve

This article provides a quick guide on how to configure transition curves using the acrossfade filter in FFmpeg. You will learn about the parameters that control fade-in and fade-out shapes, the available curve types, and how to implement them in your command-line operations to achieve seamless audio transitions.

To configure the transition curves in the FFmpeg acrossfade filter, you must use the c1 (or curve1) and c2 (or curve2) parameters. The c1 parameter sets the curve for the fade-out of the first audio stream, while the c2 parameter sets the curve for the fade-in of the second audio stream.

Available Transition Curves

FFmpeg supports a wide variety of mathematical curves for audio crossfading. Some of the most commonly used options include:

Basic Command Syntax

The basic syntax for applying custom curves in the acrossfade filter is as follows:

ffmpeg -i input1.mp3 -i input2.mp3 -filter_complex "acrossfade=d=5:c1=exp:c2=log" output.mp3

In this example: * d=5 sets the duration of the crossfade to 5 seconds. * c1=exp applies an exponential curve to the fade-out of the first input. * c2=log applies a logarithmic curve to the fade-in of the second input.

Common Transition Configurations

Depending on your audio material, different curve combinations will yield better results:

Linear Transition

For a standard, constant-rate volume transition:

-filter_complex "acrossfade=d=3:c1=tri:c2=tri"

Natural Sounding Transition (Equal Power)

To maintain a consistent perceived volume level throughout the crossfade, logarithmic and sine curves are recommended:

-filter_complex "acrossfade=d=4:c1=qsin:c2=qsin"

Sharp Transition

If you want the first track to fade out quickly and the second track to enter rapidly, use exponential or cubic curves:

-filter_complex "acrossfade=d=3:c1=exp:c2=cbr"