Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FFMPEG - Can you overlay part of a video with a couple of images?

Tags:

ffmpeg

I need to add an overlay a video and I was wondering if there is an easy way to do this with FFMPEG.

I have a set of images (a banner and a portrait) which I would like to overlay at the bottom of my video for part of the duration of the video. For example, after about 5 seconds I would like the overlay to appear, and then about 5 seconds before the end of the video I would like to have the overlay go away.

Is this possible using FFMPEG command line options?

like image 535
Adam Avatar asked Aug 12 '11 15:08

Adam


1 Answers

With FFMpeg overlaying images using the command line by far the most powerful and elegant way to do this is with a tool called AVISynth.

Here is are some simple examples, one of which overlays one video on top of another (overlaying an image is a subset of this):
http://avisynth.org/mediawiki/Script_examples

You may wonder, what the heck kind of tool is this? This is how it works conceptually:

First, you create a simple text document with special commands, called a script. These commands make references to one or more videos and the filters you wish to run on them. Then, you run a video application, such as FFMPeg, and pass in the script file on the command line. This is when AviSynth takes action. It opens the videos you referenced in the script, runs the specified filters, and feeds the output to video application. The application, however, is not aware that AviSynth is working in the background. Instead, the application thinks that it is directly opening a filtered AVI file that resides on your hard drive.

What you are wanting is very simple with AVISynth, but it can scale to do videos like this site, where many photos, text, and effects are placed on videos. All videos on this ecard site are created with FFMpeg and AVISynth: http://www.hdgreetings.com

It may seem a little different, but once you get one simple script working, you instantly recognize this is one of the best video tools ever created. And it's free of course.

like image 94
whitneyland Avatar answered Nov 15 '22 09:11

whitneyland