What You Will Learn
- The command to fade video in and out with the
fadefilter - The command to crossfade between two clips with the
xfadefilter - A full list of built-in transition effects
- How to chain multiple clips together with transitions
Tested with: FFmpeg 6.1 (verified against real FFmpeg)
Supported OS: Windows / macOS / Linux
The fade Filter — Fade In and Fade Out
Fade In (gradually reveal the opening from black)
ffmpeg -i input.mp4 -vf "fade=t=in:st=0:d=2" output.mp4
| Parameter | Value | Description |
|---|---|---|
t | in / out | Direction of the fade |
st | seconds | Start time of the fade |
d | seconds | Duration of the fade |
Fade Out (fade the end of the video to black)
ffmpeg -i input.mp4 -vf "fade=t=out:st=8:d=2" output.mp4
st=8 fades out over 2 seconds starting at the 8-second mark. Adjust it to match the length of your video. To find existing fade-to-black points automatically, see detecting black frames with blackdetect.
Apply Fade In and Fade Out Together
ffmpeg -i input.mp4 \
-vf "fade=t=in:st=0:d=1.5, fade=t=out:st=8.5:d=1.5" \
output.mp4
Fade to a Color Other Than Black
ffmpeg -i input.mp4 \
-vf "fade=t=in:st=0:d=2:color=white" \
output.mp4
With color=white the fade goes through white (a white fade-in). To fade the soundtrack along with the picture, pair this with audio fade-in and fade-out using afade.
The xfade Filter — Crossfade Between Two Clips
Basic Crossfade
ffmpeg -i input1.mp4 -i input2.mp4 \
-filter_complex "[0][1]xfade=transition=fade:duration=1:offset=4" \
output.mp4
| Parameter | Description |
|---|---|
transition | Name of the transition effect (see below) |
duration | Duration of the transition (seconds) |
offset | At what point in the first clip the transition begins (seconds) |
offset=4 means “the transition starts 4 seconds into the first clip.”
List of Built-In Transition Effects
| Effect Name | Description |
|---|---|
fade | Crossfade (default) |
wipeleft | Wipe to the left |
wiperight | Wipe to the right |
wipeup | Wipe upward |
wipedown | Wipe downward |
slideleft | Slide left |
slideright | Slide right |
slideup | Slide up |
slidedown | Slide down |
circlecrop | Circular crop |
rectcrop | Rectangular crop |
distance | Distance-based |
fadeblack | Fade through black |
fadewhite | Fade through white |
radial | Radial wipe |
smoothleft | Smooth slide left |
smoothright | Smooth slide right |
smoothup | Smooth slide up |
smoothdown | Smooth slide down |
pixelize | Pixelate |
diagtl | Diagonal (top-left → bottom-right) |
diagtr | Diagonal (top-right → bottom-left) |
diagbl | Diagonal (bottom-left → top-right) |
diagbr | Diagonal (bottom-right → top-left) |
hlslice | Horizontal slice wipe |
hrslice | Horizontal reverse slice wipe |
vuslice | Vertical up slice wipe |
vdslice | Vertical down slice wipe |
dissolve | Dissolve |
hblur | Horizontal blur transition |
fadegrays | Grayscale fade |
squeezeh | Horizontal squeeze |
squeezev | Vertical squeeze |
# Wipe-left example
ffmpeg -i input1.mp4 -i input2.mp4 \
-filter_complex "[0][1]xfade=transition=wipeleft:duration=1:offset=4" \
output.mp4
A Note When the Two Clips Have Different Lengths
offset is measured in seconds of the first clip. Set it so that offset + duration stays within the total length of the first clip.
# If the first clip is 6 seconds long: offset=5, duration=1 is fine
ffmpeg -i clip1.mp4 -i clip2.mp4 \
-filter_complex "[0][1]xfade=transition=fade:duration=1:offset=5" \
output.mp4
Joining Three Clips with Two Transitions
ffmpeg -i clip1.mp4 -i clip2.mp4 -i clip3.mp4 \
-filter_complex \
"[0][1]xfade=transition=fade:duration=1:offset=4[v01]; \
[v01][2]xfade=transition=wipeleft:duration=1:offset=8" \
output.mp4
- A fade between
clip1andclip2 - A wipe between that result and
clip3
Handling Clips with Audio
xfade is a video-only filter. To apply a matching transition to the audio as well, use the acrossfade filter.
ffmpeg -i clip1.mp4 -i clip2.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]" \
output.mp4
Adding Crossfades to a Still-Image Slideshow
ffmpeg -loop 1 -t 3 -i img1.jpg \
-loop 1 -t 3 -i img2.jpg \
-filter_complex "[0][1]xfade=transition=fade:duration=1:offset=2" \
output.mp4
Things to Watch Out For
xfadeis available in FFmpeg 4.3 and later. Older versions required a combination ofoverlay+fade.- The
offsetvalue must be smaller than the length of the video. - Matching the duration of
acrossfadeto the duration ofxfadeproduces a natural-feeling transition.
Common Pitfalls
-
Symptom:
xfadereportsBuffer is fullor anoffset-related error. Cause:offset + durationexceeds the length of the first clip. Fix: keepoffsetwell below the first clip’s duration. If the first clip is 6 seconds,offset=5:duration=1is the safe limit. -
Symptom: the crossfade works but the audio disappears or cuts off. Cause:
xfadeis video-only and the audio needs separate handling. Fix: pair it withacrossfadeand map both with-map "[v]" -map "[a]". Matchacrossfade’sdtoxfade’sdurationfor a natural result. -
Symptom: the fade-out starts at the wrong moment. Cause: in
fade=t=out,stis the fade start time, not the end time. Fix: to fade out the last 2 seconds of a 10-second clip, usest=8:d=2(because8+2=10). -
Symptom: the transition glitches when the two clips differ in resolution or fps. Cause:
xfadeexpects both inputs to share the same size and frame rate. Fix: normalize them withscaleandfpsbefore feeding them intoxfade.
FAQ
Q. What is the difference between fade and xfade?
A. fade fades a single clip in or out to black (or a chosen color). xfade is a transition that blends two clips as it switches between them, and it requires -filter_complex with two inputs.
Q. Can I fade to a color other than black or white?
A. With fade, set it via color= (e.g. color=white). With xfade, choose a dedicated transition name like fadeblack or fadewhite in transition=.
Q. Can I chain three or more clips?
A. Yes. Label the output of one xfade and feed it as the input of the next. As in the three-clip example above, separate the chains with ;.
Q. Does it work for a still-image slideshow?
A. Yes. Loop each image as input with -loop 1 -t 3 -i img1.jpg and join them with xfade. Set offset to match how long each image is shown.
Q. How many transition effects are there?
A. Many — besides fade, there are wipeleft, slideup, circlecrop, dissolve, and more. Pick a name from the table above and pass it to transition=.
Related Filters
afade— Audio fade in/outacrossfade— Audio crossfadeoverlay— Compositing video on top of videoconcat— Concatenating video