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
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.mp4offset 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
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.mp4Crossfade the sound as well
xfade only touches video.
acrossfadeoverlaps the two audio tracks for the same second, and-mappicks 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.mp4Fix 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.mp4then 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
| Flag | What it does | Used here |
|---|---|---|
transition=fade | One of the 58 named effects, or custom with expr | Every command |
duration=1 | Length of the overlap in seconds; the default is 1 | Every command |
offset=1 | When the transition starts, from the start of the first input; the default is 0 | Every command |
expr | Per-pixel expression for custom: A and B are the two inputs, X and Y the position, P the progress | Custom tile |
acrossfade=d=1 | Overlaps two audio tracks; xfade has no audio side | With audio |
fps=30,settb=AVTB | Forces a frame rate and a shared timebase so the inputs match | Fix |
-loop 1 -framerate 30 -t 3 | Turns a photo into a 3-second clip at 30 fps | API job |
setsar=1,format=yuv420p | Square pixels and one pixel format for every input | API job |
Source: ffmpeg filters: xfade and acrossfade, checked November 2026.
The gallery
All 59 transitions on the same two clips
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.
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"]
}'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.
- Concatenate videos with ffmpegJoin clips with the concat demuxer and -c copy when they match, or with the concat filter when their size, frame rate or codec differ.
- Fade in and fade out with ffmpegFade picture and sound in and out with fade and afade, work out where the fade out starts, or fade the audio without knowing the length.
- Images to video with ffmpegTurn photos into an MP4 slideshow with music: frame rate per photo, a concat list for custom durations, and one still with audio.
- Ken Burns effect with ffmpegSlow zooms and pans on a still photo with zoompan, without the jitter: upscale first, or switch to perspective.
- ffmpeg -filter_complex explainedLabels, commas and semicolons: how a filtergraph wires inputs to outputs, with four working graphs and the errors they fix.
- TikTok slideshow APITurn photos into a vertical TikTok-style slideshow with music and transitions, named or random, in one POST.
- Merge videosJoin clips into one MP4 by URL with the concat filter or demuxer, up to 50 inputs, for well under a cent a merge.
- Photo slideshow makerTurn up to 10 photos into a video with transitions and free music for TikTok, Reels or Shorts: free right here, or one POST /v1/slideshow call.
- ReelSDK vs self-hosted FFmpegTranscoding a minute of 1080p to 720p takes about 24 seconds of compute: about 0.8 cents on ReelSDK, about a tenth of a cent on a busy 4 vCPU box. Below about 11,000 minutes a month, the API costs less than an always-on box.
Sources, checked November 2026
Ready to build?
Ship video from your app today
Your first $0.50 is free, and one key covers every endpoint.
