How to combine a video and an image using “reverse” vstack?

I have an image and a video (same width). I now want to use ffmpeg to add the image above the video. Google and other SO threads the use of the vstack filter_complex tag, which works great - except that it puts the image under the video.

I've tried putting the image first and then the video, but this doesnt work. I've also tried giving the vstack command reverse inputs, but also didnt work!

The video may also contain audio which I would need to keep.

See code below:

// Works, but puts image below video (instead of above)
ffmpeg -i test.mp4 -i text.png -filter_complex vstack result.mp4

// Doesn’t work at all
ffmpeg -i test.mp4 -i text.png -filter_complex ‘[1:v][0:v]vstack’ result.mp4

// Doesn’t work at all
ffmpeg -i test.mp4 -i text.png -filter_complex ‘[1:v][0:v]vstack=inputs=2[v]’ -map ‘[v]’ -map 0:a result.mp4

Google / SO did not yield any tips on how to achieve this so far. Do you know a solution?

#video #image

2 Likes4.60 GEEK