ffmpeg 8.1 has 58 named xfade transitions plus custom, each rendered below as a clip, and the offset math is simple. On ReelSDK a 7-second chain of 3 photos costs under a quarter of a cent, at $0.02 a compute minute.

Every ffmpeg xfade transition, rendered

Pick a name, set the overlap with duration and the start with offset; ReelSDK's slideshow API takes the same 58 names. Two 2-second clips with a 1-second fade at offset 1 make a 3-second video.

GuidesUpdated

crossfade
ffmpeg -i a.mp4 -i b.mp4 -filter_complex \
  "[0:v][1:v]xfade=transition=fade:duration=1:offset=1" \
  -c:v libx264 -crf 20 -preset veryfast -movflags +faststart two.mp4

offset is when the transition starts, counted from the start of the first input; duration is the overlap. With two 2-second clips, offset=1 and duration=1 give a 3-second video.

Variations

The other commands you will need

  1. Chain three clips

    The second xfade reads the output of the first, so its offset counts from the start of the joined clip: 3 s long, minus the 1-second overlap, gives offset=2. The result runs 4 seconds.

    three clips
    ffmpeg -i a.mp4 -i b.mp4 -i c.mp4 -filter_complex \
      "[0:v][1:v]xfade=transition=fade:duration=1:offset=1[ab];[ab][2:v]xfade=transition=circleopen:duration=1:offset=2" \
      -c:v libx264 -crf 20 -preset veryfast -movflags +faststart three.mp4
  2. Crossfade the sound as well

    xfade only touches video. acrossfade overlaps the two audio tracks for the same second, and -map picks both labelled outputs. Two 4-second cuts join into 7 seconds.

    with audio
    ffmpeg -t 4 -i in.mp4 -ss 5 -t 4 -i in.mp4 -filter_complex \
      "[0:v][1:v]xfade=transition=fade:duration=1:offset=3[v];[0:a][1:a]acrossfade=d=1[a]" \
      -map "[v]" -map "[a]" -c:v libx264 -crf 20 -preset veryfast -c:a aac -movflags +faststart joined.mp4
  3. Fix inputs that do not match

    A 25 fps second clip stopped the graph with the error below. Resample it to 30 fps and give both inputs the same timebase with settb=AVTB; fixed.mp4 then came out at 3 seconds, as it should.

    match the inputs
    # First input link main timebase (1/15360) do not match the corresponding second input link xfade timebase (1/12800)
    ffmpeg -i a.mp4 -i d25.mp4 -filter_complex \
      "[1:v]fps=30,settb=AVTB[b];[0:v]settb=AVTB[a];[a][b]xfade=transition=fade:duration=1:offset=1" \
      -c:v libx264 -crf 20 -preset veryfast fixed.mp4

The flags

The xfade options and the filters around it

The xfade options and the filters around it
FlagWhat it doesUsed here
transition=fadeOne of the 58 named effects, or custom with exprEvery command
duration=1Length of the overlap in seconds; the default is 1Every command
offset=1When the transition starts, from the start of the first input; the default is 0Every command
exprPer-pixel expression for custom: A and B are the two inputs, X and Y the position, P the progressCustom tile
acrossfade=d=1Overlaps two audio tracks; xfade has no audio sideWith audio
fps=30,settb=AVTBForces a frame rate and a shared timebase so the inputs matchFix
-loop 1 -framerate 30 -t 3Turns a photo into a 3-second clip at 30 fpsAPI job
setsar=1,format=yuv420pSquare pixels and one pixel format for every inputAPI job

Source: ffmpeg filters: xfade and acrossfade, checked November 2026.

The gallery

Each tile is one API job on the same two 2-second photo clips, a 1-second transition at offset 1 with only the name changed. Tap a poster to play it.

  • fade
  • wipeleft
  • wiperight
  • wipeup
  • wipedown
  • slideleft
  • slideright
  • slideup
  • slidedown
  • circlecrop
  • rectcrop
  • distance
  • fadeblack
  • fadewhite
  • radial
  • smoothleft
  • smoothright
  • smoothup
  • smoothdown
  • circleopen
  • circleclose
  • vertopen
  • vertclose
  • horzopen
  • horzclose
  • dissolve
  • pixelize
  • diagtl
  • diagtr
  • diagbl
  • diagbr
  • hlslice
  • hrslice
  • vuslice
  • vdslice
  • hblur
  • fadegrays
  • wipetl
  • wipetr
  • wipebl
  • wipebr
  • squeezeh
  • squeezev
  • zoomin
  • fadefast
  • fadeslow
  • hlwind
  • hrwind
  • vuwind
  • vdwind
  • coverleft
  • coverright
  • coverup
  • coverdown
  • revealleft
  • revealright
  • revealup
  • revealdown
  • custom

The offset math

Every xfade adds its second input after offset, so the output runs for offset plus the length of that input. Two 2-second clips with offset=1 give 3 s. In a chain, the next offset is the length so far minus the overlap: 3 minus 1 gives 2, and the result is 4 s.

The API job above uses 3-second photos with 1-second overlaps, so its offsets are 2 and 4 and chain.mp4 runs for 7 s.

Why the inputs must match

The ffmpeg manual is strict about it: "Both inputs must be constant frame-rate and have the same resolution, pixel format, frame rate and timebase." A 640x360 clip against a 1280x720 clip fails with "do not match the corresponding second input link xfade parameters", and a 25 fps clip against a 30 fps one fails on the timebase.

Normalise each input in the same graph: scale and setsar=1 for the size, format=yuv420p for the pixel format, fps=30 for the frame rate and settb=AVTB for the timebase. Photos looped with -loop 1 -framerate 30 already share all four once they are scaled.

Custom transitions and the slideshow API

transition=custom takes an expr that picks a value per pixel. P runs from 1 at the start of the transition to 0 at the end, so if(gt(P,0.5),A,B) is a hard cut at the halfway mark. The custom tile in the gallery switches a checkerboard of 80-pixel squares at two moments.

If you only need photos joined with transitions, the slideshow API takes the same 58 names, plus random and none, and works the offsets out for you. For your own graph, send the args as they are; see pricing for compute minutes.

Without installing ffmpeg

The same command as one API call

This job turns three photos into 3-second clips with -loop 1, scales them to the same size and pixel format, and chains circleopen into slideleft. Each job runs ffmpeg 8.1 on a fresh machine at $0.02 per compute minute, billed per second; this one finished in about 7 seconds and cost under a quarter of a cent.

terminalTry it
curl "https://api.reelsdk.com/v1/ffmpeg?wait=60" \
  -H "Authorization: Bearer $REELSDK_KEY" \
  --json '{
    "inputs": {
      "plaza.jpg": "https://api.reelsdk.com/f/lib/demo/seville/plaza.jpg",
      "flamenco.jpg": "https://api.reelsdk.com/f/lib/demo/seville/flamenco.jpg",
      "oranges.jpg": "https://api.reelsdk.com/f/lib/demo/seville/oranges.jpg"
    },
    "args": [
      "-loop", "1", "-framerate", "30", "-t", "3", "-i", "plaza.jpg",
      "-loop", "1", "-framerate", "30", "-t", "3", "-i", "flamenco.jpg",
      "-loop", "1", "-framerate", "30", "-t", "3", "-i", "oranges.jpg",
      "-filter_complex",
      "[0:v]scale=1280:720,setsar=1,format=yuv420p[a];[1:v]scale=1280:720,setsar=1,format=yuv420p[b];[2:v]scale=1280:720,setsar=1,format=yuv420p[c];[a][b]xfade=transition=circleopen:duration=1:offset=2[ab];[ab][c]xfade=transition=slideleft:duration=1:offset=4",
      "-c:v", "libx264", "-crf", "20", "-preset", "veryfast", "-movflags",
      "+faststart", "chain.mp4"
    ],
    "outputs": ["chain.mp4"]
  }'
chain.mp4 from the API: three photos, two transitions, 7 seconds at 1280x720.Input: first photoa.mp4b.mp4

FAQ

Questions, answered

How many transitions does ffmpeg xfade have?

ffmpeg 8.1 lists 58 named transitions plus custom. All 59 are rendered in the gallery on this page.

Why does xfade fail with an error about inputs that do not match?

Both inputs must have the same resolution, pixel format, frame rate and timebase. Add scale, setsar=1, format=yuv420p, fps and settb=AVTB to each input before the xfade.

How do I work out the offset for the third clip?

Take the length of the joined output so far and subtract the overlap. Two 2-second clips with a 1-second overlap make 3 s, so the next offset is 2 and the result is 4 s.

Does xfade crossfade the audio too?

No, it only handles video. Add acrossfade=d=1 on the audio streams and map both outputs, as in the third command.

Ready to build?

Ship video from your app today

Your first $0.50 is free, and one key covers every endpoint.

Moonlit lake with a lit cabin under the mountains