How to use FFmpeg xfade radial transition
This guide demonstrates how to apply a radial transition between two
videos using the FFmpeg xfade filter. You will find the
precise command syntax, an explanation of key parameters like offset and
duration, and a practical example to help you seamlessly merge your
video clips with a circular, sweeping wipe effect.
The xfade (crossfade) filter in FFmpeg allows for
seamless transitions between two video streams. To create a radial
transition—where the second video reveals itself in a circular,
clock-like sweeping motion over the first—you use the
transition=radial parameter.
The Basic Command Syntax
To apply the radial transition, use the filter_complex
flag to define the inputs, the filter name, the transition type, the
start time (offset), and the length of the transition
(duration).
ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex "[0:v][1:v]xfade=transition=radial:duration=1:offset=5[v]" -map "[v]" output.mp4Parameter Breakdown
[0:v][1:v]: Specifies the video streams of the first (0) and second (1) input files.xfade: Invokes the crossfade filter.transition=radial: Sets the transition style to a radial wipe.duration=1: The transition will last for 1 second. You can use decimals (e.g.,1.5) for precise timing.offset=5: The transition will begin at the 5-second mark of the first video.[v]: The label assigned to the output video stream.-map "[v]": Tells FFmpeg to use the filtered video stream in the final output file.
How to Calculate the Offset
To ensure a smooth transition without frozen frames, you must
calculate the correct offset. The transition offset should
equal the duration of the first video minus the duration of the
transition itself.
For example, if input1.mp4 is exactly 10 seconds long,
and you want a 2-second radial transition: * Offset
calculation: 10 seconds (total duration) - 2 seconds
(transition duration) = 8 seconds.
The corresponding filter configuration would be:
xfade=transition=radial:duration=2:offset=8.
Handling Audio
The xfade filter only processes video. To transition the
audio at the same time, you should pair it with the
acrossfade audio filter:
ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex "[0:v][1:v]xfade=transition=radial:duration=1:offset=5[v];[0:a][1:a]acrossfade=d=1[a]" -map "[v]" -map "[a]" output.mp4In this audio filter, d=1 sets the audio crossfade
duration to 1 second, matching the video transition duration.