[FFmpeg-user] How to improve result of transitions

iburman at compuscience.com iburman at compuscience.com
Tue Jun 22 10:39:59 EEST 2021

Again you nailed it down. I really appreciate your help. 

Now that I understood how transition works, it makes perfectly sense. As a
beginner, in my naïve thinking, I thought:
If I want a transition of 4 seconds, I would like to lose 2 seconds on each
video, so therefore, if the videos are 9 seconds long, start it with offset

However, now that I understand that for 4 seconds transition you need 4
seconds on each video, I don't understand why you need two parameters,
duration and offset. Why not simply define the duration, and have ffmpeg
calculate the offset as videoDuration minus transitionDuration? Or at least,
why not make the default of offset to be videoDuration - transitionDuration?
I was always wondering what sense it makes to have offset default to zero...

Anyways, may be we can improve the documentation to explain that offset need
to be such to allow duration seconds to create the transition.  

Again, thanks a lot for your help.

-----Original Message-----
From: ffmpeg-user <ffmpeg-user-bounces at ffmpeg.org> On Behalf Of Rob Hallam
Sent: Monday, June 21, 2021 11:46 PM
To: FFmpeg user questions <ffmpeg-user at ffmpeg.org>
Subject: Re: [FFmpeg-user] How to improve result of transitions

On Mon, 21 Jun 2021 at 21:07, <iburman at compuscience.com> wrote:
> Attached is a result of a transition using two videos, one totally 
> black and one totally white, using radial transition.
> Each video has 9 seconds and the transition command is:
> Ffmpeg -i black.mp4 -i white.mp4 -filter_complex 
> "xfade=transition=radial:duration=4:offset=7"  -pix_fmt yuv420p
> trans_radial_4.mp4
> So based on the above I expect the transition to start at t=7 and end 
> at t=11, and as it is a radial transition I expect the transition to 
> move uniformly for 0 to 360 degree during these 4 seconds.
> If I look to the video, it seems to me that the transition worked fine 
> for the first half (from t=7 to t = 9 while the circle goes from 0 to 
> 180 degree. But once this point is reached, it immediately gets white, 
> like the second part of the transition is not happening.

I was able to reproduce your issue with lavfi color generators as inputs

> Is something wrong with my command? What do I need to do to get the 
> full transition working?

Your first input finishes before the transition is completed. Choose a
different offset (eg [2]) or duration (eg [3]).



[1] ffmpeg  -f lavfi -i color=black:640x480:d=9 -f lavfi -i
color=white:640x480:d=9 -c:v h264 -crf 20 -an -pix_fmt yuv420p
-filter_complex "xfade=transition=radial:duration=4:offset=7"

[2] ffmpeg -f lavfi -i color=black:640x480:d=9 -f lavfi -i
color=white:640x480:d=9 -c:v h264 -crf 20 -an -pix_fmt yuv420p
-filter_complex "xfade=transition=radial:duration=4:offset=5"

[3] ffmpeg -f lavfi -i color=black:640x480:d=9 -f lavfi -i
color=white:640x480:d=9 -c:v h264 -crf 20 -an -pix_fmt yuv420p
-filter_complex "xfade=transition=radial:duration=2:offset=7"
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org

To unsubscribe, visit link above, or email ffmpeg-user-request at ffmpeg.org
with subject "unsubscribe".

More information about the ffmpeg-user mailing list