The `acrossfade` filter is the audio version of `xfade`. It blends two audio streams for a specified duration at a specified offset, so a music track can fade into a voiceover, or two songs can be joined without a hard cut.

The command

ffmpeg -i music.mp3 -i voice.wav -filter_complex "[0:a][1:a]acrossfade=d=1:c1=tri:c2=tri" -c:a pcm_s16le out.wav

What it does

The filter takes the two audio streams, applies the crossfade for `d` seconds, and produces a single output. The `c1` and `c2` parameters are the curves for each input: `tri` (linear), `qsin` (quarter-sine), `hsin` (half-sine), `esin` (exponential-sine), `log` (logarithmic), `ipar` (inverted parabolic), `qua` (quarter-cosine), `cub` (cubic), `squ` (square), `cbr` (cubic root), `par` (parabolic), `exp` (exponential), `iqsin`, `ihsin`, `dese`, `desi`, `losi`, `nonesi`, `nofade` (no fade). The default is `tri` for both inputs, which is a linear crossfade.

Requirements

Any audio input. The filter is in libavfilter. CPU-only, single-pass. The crossfade is added during the encode, so the encoder spends extra bits on the blended samples — for a lossy target, set your bitrate one or two points higher than usual to keep the quality similar.

Things to avoid

  • Crossfading two audio streams with different sample rates. The filter expects both inputs to match, so a 48 kHz source and a 44.1 kHz source will produce a distorted output. Resample the second to match first.
  • Using a very short crossfade. A 10 ms crossfade is a glitch; a 1-second crossfade is a transition. Start at 1 second for music, 100 ms for voice.
  • Confusing `acrossfade` with `xfade`. `xfade` is for video; `acrossfade` is for audio. They are different filters.
  • Forgetting to map the video. If the inputs have video streams, the default mapping will not include them, and the output will be audio-only.