FFmpeg acrossfade: Concatenate Audio with Crossfade

This article explains how to use the acrossfade filter in FFmpeg to create seamless transitions between concatenated audio files. You will learn the basic command syntax, how to adjust transition duration and fade curves, and how to chain multiple audio files together for a professional-sounding audio mix.

The acrossfade filter in FFmpeg allows you to apply a crossfade effect when joining two audio streams. Unlike simple concatenation, which can result in abrupt transitions, crossfading gradually fades out the ending of the first audio file while fading in the beginning of the second audio file over a specified duration.

Basic Syntax for Two Audio Files

To crossfade two audio files, you must use FFmpeg’s -filter_complex option because the process requires managing multiple inputs. Here is the standard command:

ffmpeg -i input1.mp3 -i input2.mp3 -filter_complex "[0:a][1:a]acrossfade=d=5:c1=tri:c2=tri[aout]" -map "[aout]" output.mp3

Understanding the Parameters

Chaining Three or More Audio Files

Because the acrossfade filter only accepts two input streams at a time, you must chain multiple filters together in sequence if you have three or more audio files.

The command below demonstrates how to transition between three files:

ffmpeg -i input1.mp3 -i input2.mp3 -i input3.mp3 -filter_complex "[0:a][1:a]acrossfade=d=5:c1=qsin:c2=qsin[fade1]; [fade1][2:a]acrossfade=d=5:c1=qsin:c2=qsin[aout]" -map "[aout]" output.mp3

In this command, input1.mp3 and input2.mp3 are crossfaded first, creating an intermediate stream named [fade1]. Then, [fade1] is crossfaded with input3.mp3 ([2:a]) to produce the final [aout] stream.