What You Will Learn

  • The command to fade video in and out with the fade filter
  • The command to crossfade between two clips with the xfade filter
  • 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
ParameterValueDescription
tin / outDirection of the fade
stsecondsStart time of the fade
dsecondsDuration 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
ParameterDescription
transitionName of the transition effect (see below)
durationDuration of the transition (seconds)
offsetAt 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 NameDescription
fadeCrossfade (default)
wipeleftWipe to the left
wiperightWipe to the right
wipeupWipe upward
wipedownWipe downward
slideleftSlide left
sliderightSlide right
slideupSlide up
slidedownSlide down
circlecropCircular crop
rectcropRectangular crop
distanceDistance-based
fadeblackFade through black
fadewhiteFade through white
radialRadial wipe
smoothleftSmooth slide left
smoothrightSmooth slide right
smoothupSmooth slide up
smoothdownSmooth slide down
pixelizePixelate
diagtlDiagonal (top-left → bottom-right)
diagtrDiagonal (top-right → bottom-left)
diagblDiagonal (bottom-left → top-right)
diagbrDiagonal (bottom-right → top-left)
hlsliceHorizontal slice wipe
hrsliceHorizontal reverse slice wipe
vusliceVertical up slice wipe
vdsliceVertical down slice wipe
dissolveDissolve
hblurHorizontal blur transition
fadegraysGrayscale fade
squeezehHorizontal squeeze
squeezevVertical 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
  1. A fade between clip1 and clip2
  2. 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

  • xfade is available in FFmpeg 4.3 and later. Older versions required a combination of overlay + fade.
  • The offset value must be smaller than the length of the video.
  • Matching the duration of acrossfade to the duration of xfade produces a natural-feeling transition.

Common Pitfalls

  • Symptom: xfade reports Buffer is full or an offset-related error. Cause: offset + duration exceeds the length of the first clip. Fix: keep offset well below the first clip’s duration. If the first clip is 6 seconds, offset=5:duration=1 is the safe limit.

  • Symptom: the crossfade works but the audio disappears or cuts off. Cause: xfade is video-only and the audio needs separate handling. Fix: pair it with acrossfade and map both with -map "[v]" -map "[a]". Match acrossfade’s d to xfade’s duration for a natural result.

  • Symptom: the fade-out starts at the wrong moment. Cause: in fade=t=out, st is the fade start time, not the end time. Fix: to fade out the last 2 seconds of a 10-second clip, use st=8:d=2 (because 8+2=10).

  • Symptom: the transition glitches when the two clips differ in resolution or fps. Cause: xfade expects both inputs to share the same size and frame rate. Fix: normalize them with scale and fps before feeding them into xfade.


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=.