3

I have a jpg: bg.jpg (300x600) and a video: video.mp4 (280x580) I want to overlay video.mp4 over bg.jpg, so that video position is 10,10 and the output video is video.mp4 minutes long.

Is this possible with ffmpeg ?

1 Answer 1

3

This will place the video in position 10,10:

enter image description here

ffmpeg -loop 1 -i bg.png -i video.mp4 -filter_complex \
"[0:v][1:v]overlay=10:10:shortest=1,format=yuv420p[v]" \
-map "[v]" -map 1:a -c:a copy -movflags +faststart output.mp4

However, it appears you just want to center the overlay. This will work for any input where the overlay is smaller than the background:

ffmpeg -loop 1 -i bg.png -i video.mp4 -filter_complex \
"[0:v][1:v]overlay=(W-w)/2:(H-h)/2:shortest=1,format=yuv420p[v]" \
-map "[v]" -map 1:a -c:a copy -movflags +faststart output.mp4

See the overlay video filter documentation for more info.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .