Reputation: 3013
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?
Upvotes: 6
Views: 3919
Reputation: 2493
FFMPEG can overlay images over a video at any given video time.
ffmpeg -i video -i image1 -i image2 -i image3
-filter_complex
"[0][1]overlay=x=X:y=Y:enable='between(t,23,27)'[v1];
[v1][2]overlay=x=X:y=Y:enable='between(t,44,61)'[v2];
[v2][3]overlay=x=X:y=Y:enable='gt(t,112)'[v3]"
-map "[v3]" -map 0:a out.mp4
Please check this post for more details: FFMPEG- Is it possible to overlay multiple images over a video at specified intervals?
Upvotes: -1
Reputation: 19986
ffmpeg doesn't allow that kind of picture manipulation. However, maybe you are in luck.
Since you'll have to decompress video anyway, you can use ffmpeg to create RAW images to disk, overlay images with some utility (simple c# app would do the trick), and use ffmpeg to create another video with desired (or same as source) parameters.
To do overlays, you can probably use GIMP: http://www.gimp.org/tutorials/Basic_Batch/ since it is a cross platform tool that can be used in a batch (command line) mode.
Upvotes: 0
Reputation: 10988
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.
Upvotes: 4
Reputation: 1
Depending on what platform you are using, you may be able to just play the video and then create like an X window with the image over the video. While you are playing the video you could use ffmpeg to record the X window with the video playing in the background and the your image in the foreground.
The is a a complete hack, but I'm throwing it out there.
Upvotes: 0