如何为视频镜像+添加徽标? [英] how to mirror + add logo to video?

查看:80
本文介绍了如何为视频镜像+添加徽标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何镜像+向视频添加徽标?如何镜像视频,然后使用ffmpeg在视频中添加徽标?

how to mirror + add logo to video? How to mirror video, then add logo to video using ffmpeg?

推荐答案

要水平翻转视频,可以使用 -vf hflip (或使用 vflip 进行垂直翻转)

To flip a video horizontally, you can use -vf hflip (or vflip for vertical flipping).

在视频中添加任何图像的水印更为复杂,尤其是当您要放置它时:

To add a watermark of any image to a video is more complex, especially if you want to position it:

-i logo.png -filter_complex "overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2"

重叠式滤镜可以做很多事情,查看文档.如果您还想缩放覆盖,它会变得非常复杂,因此请确保在此之前徽标文件的大小正确.

There are a lot of things you can do with the overlay filter, check the documentation. It gets extremely complex if you also want to scale the overlay, so make sure your logo file is the right size before that.

但是,您不能混合使用-vf和-filter_complex,因此翻转必须成为复杂过滤器的一部分.因此,为了获得所需的结果,您必须执行此操作(假设您希望徽标位于位置10/10):

However, you cannot mix -vf and -filter_complex, so the flipping has to become part of the complex filter. So, for your desired result, you'd have to do this (assuming you want the logo to be at position 10/10):

ffmpeg -i input.mp4 -i logo.png -filter_complex "hflip[flipped];[flipped]overlay=x=10:y=10" out.mp4

这篇关于如何为视频镜像+添加徽标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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