DEV Community 👩‍💻👨‍💻

Cover image for Add an animation overlay on a video with ffmpeg
Donald Feury
Donald Feury

Posted on • Updated on • Originally published at

Add an animation overlay on a video with ffmpeg

This one was a doozy to figure out but I finally managed to overlay a little subscribe animation over my main videos.

Normally I would explain it but its pretty long winded so if you want the full explanation, please watch the video.

The short answer is, its using a complex filtergraph to offset the timestamps on the frames of the sub animation and delay its audio so they play over the main video when I wanted them to.

The command is as follows:

#!/usr/bin/env sh


ffmpeg -i $IN -filter_complex \
[0:a:0][0:a:1][a1]amix=inputs=3:duration=longest:dropout_transition=0:weights=3 3 1[outa]" \
-map "[out1]" -map "[outa]" $OUT
Enter fullscreen mode Exit fullscreen mode

🎥 YouTube - Subscribe for more FFMPEG videos!

Top comments (0)

Stop sifting through your feed.

Find the content you want to see.

Change your feed algorithm by adjusting your experience level and give weights to the tags you follow.