(FFmpeg) How to cross fade two mp3 tracks?

In this section we’ll learn various useful audio filters specifically to audio but all filters will work on video as well. Since this is just an audio section, -af instead of -filter_complex unless multiple audio input sources are required. See question “How to use filters (-vf/-af vs -filter_complex)?” for more details.

Making a music mix? Easily cross fade each track with FFMPEG within seconds. Cross fading allows for a smooth fade in and out between two audio files. In this example a cross fade of 1 second is applied:

 $ ffmpeg -i input1.mp3 -i input2.mp3 -filter_complex "acrossfade=duration=00:00:01:curve1=exp:curve2=exp" output.mp3  
acrossfade
	Indicates the filter name for crossfading

duration, d 
	Indicates the duration of the cross fade effect

curve1
	Indicates the cross fade curve for the first input
curve2 
	Indicates the cross fade curve for the first input

Although in this example, both cross fade curves are exp or exponential, FFMPEG support multiple curves but below are 6 recommended curves:

log
	Logarithmic

par
	Parabola

ipar
	Inverted parabola

losi
	Logistic sigmoid

cub
	cubic

nofade
	No fade applied

For more information on curves, visit: https://ffmpeg.org/ffmpeg-filters.html#afade