如何在ffmpeg中将图像叠加/放置在视频上 [英] How to overlay/place an image on a video in ffmpeg

查看:2633
本文介绍了如何在ffmpeg中将图像叠加/放置在视频上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们我试图在ffmpeg的视频中覆盖图像,如下所示:

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?

推荐答案

使用

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 是基本视频的尺寸。并且 w h 叠加视频。

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

这篇关于如何在ffmpeg中将图像叠加/放置在视频上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆