[FFmpeg-user] Please release me from despair: multiple overlay images with fade in + out

Stefano Sabatini stefasab at gmail.com
Wed Jan 21 18:49:01 CET 2015


On date Wednesday 2015-01-21 16:08:29 +0100, Dog Film wrote:
> Hi Stefano,
> 
> regarding timestamps - are you suggesting things that can be done with
> the setpts filter? The example I posted works very well with static
> images, no timestamp manipulation needed here, but I can not find a
> way to add fades to all the images - how do come timestamps into play
> here?
> 
> Thanks for the suggestion, one single file with all the overlays
> fading in/out was in deed my next step, but before this I wanted to
> validate if there are any known limitations regarding the fade filter,
> as the image-sequence-only file still will have lots of them.
> 
> Would you or anybody else please like to point me to an example that
> shows how to overlay at least three images on a source with working
> fade-in and fade-out on all of this images? That would be very, very
> niiiice :) BTW the repositioning of the overlays in my example is not
> important, I did this just for testing (to better see if some image
> overlay is hidden behind another one).
> 
> I did not work on this in a scientific way, but the hundreds of
> mutations I tried to to this without success lead me to the idea that
> it might actually be a limitation of the ffmpeg tool.

> I was able to build some surprisingly complex filter graphs - but
> bringing fade-in and fade-out into the elements of such a graph never
> worked. Instead posting dozens of not working examples and asking what
> was wrong with them, I believe it would be a better approach if
> anybody could send just one working example, so we can learn from it.
> BTW, this would be a great addition for the ffmpeg wiki!
>
> From my pov fade-in and fade-out on elements is such a basic
> requirement for many video production workflows, it will be of great
> value for many people to explain how this can be done efficiently with
> ffmpeg.

> 
> However, this thread will be helpful at least for me, if anybody can
> confirm that atm it is *not* possible to do this with ffmpeg, so I can
> stop trying to search for non existing things...

You're not very explicit about you want to achieve. I think something
like this should work:

ffmpeg -f lavfi -i color=c=blue -frames:v 1 blue.png
ffmpeg -f lavfi -i color=c=red  -frames:v 1 red.png

ffmpeg -f lavfi -i testsrc=s=vga  -loop 1 -i blue.png  -loop 1 -i red.png -filter_complex "[1:0] format=rgba,fade=in:st=0:d=5:alpha=1,fade=out:st=5:d=5:alpha=1 [t0]; [2:0] format=rgba,fade=in:st=5:d=5:alpha=1,fade=out:st=10:d=5:alpha=1 [t1]; [0:0][t0] overlay [t2];[t2][t1] overlay=x=100:y=100" -t 20 -y out.mp4


More information about the ffmpeg-user mailing list