The FFmpeg xfade filter is the modern, built-in way to create a transition between two video streams — a crossfade, wipe, slide, or dissolve — entirely from the command line. Before xfade existed you had to hand-build dissolves with blend and fade; today a single filter does the job, and it ships with more than 30 transition presets out of the box.
Key takeaways
xfadeblends two clips over a set duration at a chosen offset.- There are 30+ transition presets — fade, wipeleft, slideup, circleopen, pixelize, and more.
- Use
acrossfadeto crossfade the audio at the same time. - Everything composes inside a
filter_complexgraph, so transitions chain across many clips.
The basic xfade syntax
At minimum, xfade needs a transition type, a duration (how long the blend lasts, in seconds), and an offset (when the transition starts on the first clip's timeline). Here is a one-second crossfade that begins four seconds into clip_a:
ffmpeg -i clip_a.mp4 -i clip_b.mp4 \ -filter_complex \ "[0:v][1:v]xfade=transition=fade:duration=1:offset=4[v]" \ -map "[v]" out.mp4
The offset almost always trips people up: it is measured from the start of the first input, and it should equal the first clip's length minus the transition duration. If clip_a is 5 seconds long and you want a 1-second blend, set offset=4 so the fade ends exactly as the clip does.
All 30+ xfade transition presets
Swap the transition= value for any of these. They fall into a few families:
- Dissolves:
fade,fadeblack,fadewhite,fadegrays,dissolve,pixelize - Wipes:
wipeleft,wiperight,wipeup,wipedown,wipetl,wipetr,wipebl,wipebr - Slides:
slideleft,slideright,slideup,slidedown - Shapes:
circleopen,circleclose,circlecrop,rectcrop,diagtl,diagtr,diagbl,diagbr - Reveals & effects:
radial,smoothleft,smoothright,squeezeh,squeezev,hlslice,vuslice,distance,hblur
For example, a slick circleopen reveal that takes three quarters of a second:
[0:v][1:v]xfade= transition=circleopen: duration=0.75: offset=3.0[v]
Crossfading the audio too with acrossfade
A video transition with a hard audio cut feels broken. Pair xfade with acrossfade so the soundtrack blends across the same window:
ffmpeg -i clip_a.mp4 -i clip_b.mp4 -filter_complex " [0:v][1:v]xfade=transition=fade:duration=1:offset=4[v]; [0:a][1:a]acrossfade=d=1[a] " -map "[v]" -map "[a]" out.mp4
If you are mixing more than two audio sources rather than crossfading, reach for amix instead — we cover that in the filter_complex effects guide.
Chaining transitions across many clips
Because every xfade outputs a labeled stream, you can feed that output into the next transition. Three clips, two transitions:
ffmpeg -i a.mp4 -i b.mp4 -i c.mp4 -filter_complex " [0:v][1:v]xfade=transition=slideleft:duration=1:offset=4[ab]; [ab][2:v]xfade=transition=wipeup:duration=1:offset=9[v] " -map "[v]" out.mp4
Note the second offset is cumulative: it is measured against the combined [ab] timeline, not clip C alone.
Common pitfalls
- Mismatched resolution or SAR.
xfaderequires both inputs to share size, pixel format, and frame rate. Normalize first withscale,setsar=1, andfps. - Wrong offset. Too large and the second clip never appears; too small and clips overlap early. Compute it from the first clip's real duration.
- Black flash. Usually a frame-rate mismatch — force a constant
fpson both inputs.
Doing this without memorizing flags
Hand-writing filter_complex graphs is powerful but unforgiving. FFmpegLab gives you a visual timeline on top and the real FFmpeg render script underneath: drag clips, pick from the 30+ xfade presets with a duration slider, and the exact command is generated for you — fully editable when you want to drop down to the graph. It runs offline in your browser, so your footage never leaves your machine, and the whole stack is self-hostable with Docker.