FFMPEG : How to overlay an image on a video?

Example of a PNG overlay on a video

Here is a video with a static .png overlay on top of it

Applying a PNG image over a video is a common use case.

If you want to add a watermark or frame your pictures, you have probably found that FFMPEG is the tool to use to do this kind of things. And you’re right. But besides the fact that FFMPEG is a very powerful tool, it can be difficult and weird to use for newcomers.

Let’s see together how to overlay a video with a png.

Overlay a transparent PNG on a video

If we assume our video and the transparent PNG overlay have the same width and height, just use the following command to overlay our video.

ffmpeg -i video.mp4 -i overlay.png \
-filter_complex "[0:v][1:v] overlay=0:0" \
-c:a copy \
output.mp4

Let's explain this command in details :

  • -i video.mp4 is our source video
  • -i overlay.png is our PNG overlay
  • -filter_complex "[0:v][1:v] overlay=0:0"
    With [0:v][1:v] we are telling to FFMPEG put the input file with index 0 (the video) under the input file with index 1 (the overlay)
    • With overlay=0:0 we are setting the position of our overlay (in this case, top-left corner as our video and overlay have the exact same width/height)
  • -c:a copy  → we want to re-use the audio from the source file
  • output.mp4  is the name of the output file

Here is the result of our .png overlay on a video

Just remember, we went form this

png overlay

and this

To this !!

Bonus tip : Scale your video in the process

We took the hypothesis that our video and our overlay have the same width and height. If it’s not the case and we need to scale our video, we can do it quickly with this command -

ffmpeg -i video.mp4 -vf scale={width}:{height} -preset slow -crf 18 output.mp4

Of course, don’t forget to replace {width} by the desired width and {height} by the desired height.

There you go! You now know everything about adding a png overlay to a video using FFMPEG. However, if this tutorial felt a bit complicated, note that you can always use a video generation API like Abyssale's to ease this process.

Get started for free

Discover how Abyssale helps teams create, automate, and scale their visual content production.
Start Scaling Today
HTML5
Build HTML5 banners that capture attention. Smooth animations, and lightweight performance in every format.

Learn more about HTML5

SHARE THIS ARTICLE
JOIN OUR NEWSLETTER

Master Abyssale’s spreadsheet

Explore our guides and tutorials to unlock the full potential of Abyssale's spreadsheet feature for scaled content production.

View all resources

FFMPEG : Combine images into a video

Let's learn together how to combine images to form a video using FFMPEG. It can be very useful to auto generate video content for various use cases : e-learning, tutorials or even Instagram stories !
Read more

Use make & Google sheets to automate image creation for social media

Social media automation is in everyone's mouth. Learn how to automate your social media by creating images with Make (ex Integromat) and Abyssale and send them to your social medias
Read more

What are HTML5 Banner Ads

Everything you need to know about HTML5 banner ads - What HTML5 ads are, how to use them, and more.
Read more
GET IT STARTED

Ready to unlock your productivity ?

Book a demo and discover how Abyssale can help you scale your creativity & help your team meet unparalleled collaboration.
Create your account
14 days free trial