Other tools or Simple APIs are also welcome.
I have a sequence of pngs with alpha that I want to overlay on top of a few videos. Using ffmpeg would be fantastic, but using imagemagick is also acceptable. I could extract all the frames in the video and use imagemagick to batch blend every frame then re-encode (re-encoding is acceptable).
ffmpeg
example. You mentioned "two sequences" so this example assumes you have two sets of sequentially numbered images:
ffmpeg -i input.mp4 -framerate 25 -i blue_%04d.png -framerate 25 -i red_%04d.png -filter_complex "[0][1]overlay=10:10:format=auto[bg];[bg][2]overlay=W-w-10:10:format=auto[v]" -map "[v]" -map 0:a? -c:a copy output.mp4
Example of overlay placements.
The first image sequence ("blue
") will be placed in the top left with 10px padding and the second ("red
") in the top right. If you want bottom left: 10:H-h-10
. If you want bottom right: W-w-10:H-h-10
.
The images in this example are named blue_0001.png
, blue_0002.png
, blue_0003.png
, etc. The pattern is the same for the "red
" sequence.
See the image file demuxer and overlay filter for more info.