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

Dog Film dogfilm at googlemail.com
Wed Jan 21 03:23:41 CET 2015


Hi,

I really tried hard, I did not succeed, so I am asking here, if it is
possible at all and if yes, how to do it...

ok, I would like to generate a movie with several images overlayed,
like one image at a time, but the images are changing. So essentially
like an image sequence which is overlayed on top of a video. Imagine
slides overlayed  on the video of a speaker.

I found several ways of doing quite complex overlays, however the
resulting video would look much nicer if the image overlays had a fade
in and fade out.

This way I made the overlays without fades:

# WORKS: A LITTLE SUCCESS! THIS SHOWS ALL PIC_x IN A SEQUENCE, BUT NO
FADE IN OR OUT
FILENAME=${DIR_OUT}Lecture-16-Overlay-Fade-Trans-04.mov
${FFMPEG} -y -i ${VID_A} -i ${png_1} -i ${png_2} -i ${png_3} -i
${png_4} -i ${png_5} -i ${png_6} -filter_complex "
[0:v][1:v] overlay=10:10:enable='between(t,2,4)' [tmp];
[tmp][2:v] overlay=30:30:enable='between(t,6,8)' [tmp];
[tmp][3:v] overlay=50:50:enable='between(t,10,12)' [tmp];
[tmp][4:v] overlay=70:70:enable='between(t,14,16)' [tmp];
[tmp][5:v] overlay=90:90:enable='between(t,18,20)' [tmp];
[tmp][6:v] overlay=120:120:enable='between(t,22,24)' " ${FILENAME}

But I can not find a way to apply a fade-in and fade-out to each of
these images. The filter syntax just kills me, sorry.

Finally, I 'hardcoded' the fades and generated movies, like this:

 for png in $DIR_SLIDE*.png
 do
     # ${FFMPEG} -y -loop 1 -i $png -t 3 -c qtrle -vf 'fade=in:1:25,
fade=out:50:25' ${png%%png}mov
     ${FFMPEG} -y -loop 1 -i $png -t 3 -c png -vf 'fade=in:1:25,
fade=out:50:25' ${png%%png}mov
 done

I found this extra step not a perfect solution, but ok, I was sure it
would work - BUT you know what - it did NOT. All the *.mov files have
a fade-in and out, I checked this, but when I try to overlay them with
the same approach as above only the first movie is shown as expected,
it fades in and fades out, but then there is no second movie anymore.
It "feels" like some alpha-channel had to be reset or anything like
this, but I did not find any solution.

I actually used the same command as above, only replaced the png
variables with the mov files.

I also tried several different variations building a valid filter
chain, but it was only darkness, frustration and no positive results,
so I will not post my 120 not working variations of how not to build a
ffmpeg filter chain...

However, I am starting to wonder if this is possible at all? If yes,
how is this trick working?

Anybody, please release me from my pain!


thank you very much for your attention,
have a nice day,
John


More information about the ffmpeg-user mailing list