Create GIF of a transparent image sliding up a normal image [closed]
I've always used ffmpeg
to create simple GIFs, never worked with superimposing a transparent PNG on an image. How do I do that?
You can use the overlay
filter to superimpose. It takes care of the transparency in the foreground image automatically. Example:
ffmpeg -loop 1 -i background.jpg -i foreground-with-transparent-regions.png -filter_complex "overlay=x=0:y=H-(H+h)*t/3" -t 3 output.gif
-loop 1
makes it repeat the image so that we have a duration despite using single image.
The overlay
filter (added with filter_complex
syntax here) places the foreground image at the (x, y) position, where x
is constant here (0), and y
is a calculated over time with an expression involving the background and foreground heights, as well as the current time in seconds denoted by t
in the expression, to produce the slide-up animation as shown above.
-t
defines the duration of the output