Take the 2-minute tour ×
Video Production Stack Exchange is a question and answer site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation. It's 100% free, no registration required.

I have many videos and I need to put an image in front of them for about 5 seconds, but adding it manually and rendering it each time would take really long, so I am asking if it is possible to do so via ffmpeg and if you could, please, help me out with it since I have no experience with ffmpeg. I've found some commands already but none of them worked. This one for example.

ffmpeg -itsoffset 5 -i in.mp4 -r 25 -loop 1 -i intro.png -filter_complex "[1:v] fade=out:125:25:alpha=1 [intro]; [0:v][intro] overlay [v]" -map "[v]" -map 0:a -acodec copy out.mp4
share|improve this question
    
Did your just copy that command or wrote that according to your needs? I'm asking because this command involves things like a fade out and all kinds of other stuff not covered in your question. Do you just need to overlay an image or do you need more than that? –  Professor Sparkles Jul 7 at 12:18
    
I copied it from somewhere, all I need is just to put the image in front of video. –  Azthy Jul 8 at 9:11

1 Answer 1

up vote 2 down vote accepted

You can do a simple image overlay using the following syntax:

ffmpeg -i input.mp4 -i image.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)'" output.mp4

overlay=25:25 means we want to position the image 25px to the left and 25px down, originating from the top left corner.

enable='between(t,0,20)' means we want the image to show between second 0 and 20.

If you want a certain image quality/settings and not the settings ffmpeg chooses, add the image and or audio encoding options you want to use.

The -acodec copy that you have in your command f.e. would simply re-use the audio from the source file. Though you can't do that with the video of course (in this case), that has to be transcoded.

share|improve this answer
    
Thank you a lot. –  Azthy Jul 8 at 21:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.