使用 ffmpeg 在视频上添加水印和缩放图像
我希望能够使用包含网站网址的徽标图像为视频添加水印。 视频可以具有不同的格式和尺寸。 我正在尝试找出一个通用的 ffmpeg 命令来实现它,这样我就不必根据我必须处理的视频来调整命令。 到目前为止,我得到:
ffmpeg -i sample.mov -sameq -acodec copy -vf 'movie=logo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]' sample2.mov
通过这种方式,尽管徽标在不同尺寸的视频中看起来太大或太小。 我看到 avfilter 有一个 scale 选项,但我不知道它是否是可以根据输入视频的尺寸调整图像徽标的大小,例如,我可以将徽标缩放到视频长度的 1/3,并保持图像比例。
有什么想法吗?不需要在单个命令中完成,甚至可以是脚本。 提前致谢。
I want to be able to watermark videos with a logo image, which contains a website url.
The videos can be of different formats and dimension.
I'm trying to figure out a generic ffmpeg command to achieve it, so that i don't have to tweak the command depending on the video i have to process.
So far i got:
ffmpeg -i sample.mov -sameq -acodec copy -vf 'movie=logo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]' sample2.mov
In this way though the logo will look too big or too small with video of different size.
I've seen there is a scale option for avfilter, but I haven't figure out whether it's possible to resize the image logo based on the dimension of the input video, so that I can say to scale the logo to 1/3 of the video length for example, and keep the image ratio.
Any idea? doesn't need to be done in a single command, could even be a script.
thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
与此同时,我想出了这个完成这项工作的脚本:
我唯一不确定的是如何保持相同的视频质量。我认为“-sameq”会保持相同的视频质量,但生成的视频尺寸较小。
我注意到了这一点:
而音频信息是相同的。
关于如何保持原始视频质量有什么建议吗?
谢谢
In the meantime i came up with this script that does the job:
The only thing i'm not certain about is how to keep the same video quality. I thought that "-sameq" would keep the same video quality, but the resulting video size is smaller.
I've noticed this:
whereas the audio information are identical.
Any advice on how to keep the original video quality?
thanks
谢谢你的主意,艾伊!
使用 powershell 同样的事情:
这里可以不使用“mogrify”工具,只使用 ffmpeg 发行版。
Thanks for idea, Ae.!
Same thing using powershell:
here a can go without using 'mogrify' tool, only ffmpeg distribution.