4

Hey guys I am trying to overlay an image at the cntre of a video in ffmpeg like this:

ffmpeg -i video.mp4 -i image.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)'" -pix_fmt yuv420p -c:a copy output.mp4

But the image get placed on the top-left side of the video. How can I adjust the image to the centre?

Pradhvan Bisht
  • 341
  • 2
  • 5
  • 13

1 Answers1

16

Use

ffmpeg -i video.mp4 -i image.png -filter_complex "[0:v][1:v] overlay=(W-w)/2:(H-h)/2:enable='between(t,0,20)'" -pix_fmt yuv420p -c:a copy output.mp4

W amd H are the base video's dimensions. And w and h the overlay video's.

Gyan
  • 85,394
  • 9
  • 169
  • 201