Is there a command to insert an image for every second of video?

For the developers that use FFmpeg in their software.
Post Reply
FerDomenike
Posts: 1
Joined: Sat Oct 22, 2016 7:24 pm

Is there a command to insert an image for every second of video?

Post by FerDomenike » Sat Oct 22, 2016 7:35 pm

Hello.

I'm trying to add a different image for every second of video, but my method has not been good.
For example, if PHP use the methodology to add images to second video does not work.

My complex methodology to video of 5 seconds:
ffmpeg -i vid.mp4 -i 1.png -filter_complex "[0:v][1:v] overlay=100:25:enable='between(t,1,1.5)'" output1.mp4

ffmpeg -i output1.mp4 -i 2.png -filter_complex "[0:v][1:v] overlay=10:25:enable='between(t,1.5,2)'" output2.mp4

ffmpeg -i output2.mp4 -i 3.png -filter_complex "[0:v][1:v] overlay=250:25:enable='between(t,2,2.5)'" output1.mp4

ffmpeg -i output1.mp4 -i 4.png -filter_complex "[0:v][1:v] overlay=300:25:enable='between(t,3,3.5)'" output2.mp4

ffmpeg -i output2.mp4 -i 5.png -filter_complex "[0:v][1:v] overlay=350:25:enable='between(t,4,4.5)'" output1.mp4

ffmpeg -i output1.mp4 -i 1.png -filter_complex "[0:v][1:v] overlay=400:25:enable='between(t,4.6.5)'" output2.mp4
Please, help me?

THanks very much!

bsenftner
Posts: 11
Joined: Thu Dec 15, 2016 9:01 pm

Re: Is there a command to insert an image for every second of video?

Post by bsenftner » Sat Jan 14, 2017 9:45 pm

What you're showing in your command line examples are uses of AVFilters. AVFilters are filters one can apply to any av stream; where a 'filter' can be practically anything that observes and/or transforms data from the stream. The main documentation pages (https://ffmpeg.org/ffmpeg-filters.html) have decriptions of around 70 audio filters, and 168 video filters, doing all kinds of interesting operations. AVFilters can be linked together into an arbitrary "filter graph" of unlimited complexity, limited only by the host system's resources.

I am just learning AVFilters, and recently bookmarked this resource: https://www.ffmpeg.org/doxygen/3.2/group__lavfi.html as google searches frequently turn up older API documentation. (For example, Google searching "AVilter" is currently returning API 2.4 docs. I don't know if the API has changed much since then; I have not taken the time to check.) Most information I've found on the web is about writing AVFilters. There seems to be very little I can find about using them or the intended conceptual model one should hold when using them.

The only documentation other than the above I've found on using them is in the filtering_video.c example that downloads with the source code.

llogan
Posts: 332
Joined: Fri Mar 14, 2014 3:29 am

Re: Is there a command to insert an image for every second of video?

Post by llogan » Wed Jan 25, 2017 6:53 pm

Use a series of images as your input:

Code: Select all

ffmpeg -i vid.mp4 -framerate 1 img_%03d.png -filter_complex overlay output.mp4
In this example the image inputs are named img_001.png, img_002.png, etc. Refer to image file demuxer for more info.

Post Reply
'