ffmpeg 修复水印大小或百分比 [英] ffmpeg fix watermark size or percentage

查看:37
本文介绍了ffmpeg 修复水印大小或百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些视频,我想给它们添加水印但问题是每个视频的水印大小"都不同(在某些视频中水印较小,而在某些视频中水印较大 - 我认为是因为视频输入大小不同)

i have some videos and i want to add watermark to them but problem is coz in every video "watermark size" is different (in some videos watermark is smaller and in some is bigger - i think because of video input size coz its different)

这是我的 ffmpeg 命令(只是链接不同)

here is my ffmpeg command (just link is different)

ffmpeg -i "http://VIDEO-LINK" -i "/var/www/logo/logo.png" -filter_complex 'overlay=17:17' -vcodec h264 -crf 25 -preset veryfast -maxrate 600k -bufsize 600k -aspect '640:360' -s '640:360' -acodec libfdk_aac -hls_time 10 -hls_wrap 10 -start_number 1 -y "1.m3u8"

有没有办法根据 640x360 的输出制作任何百分比或固定水印

is there a way to make any percentage or fixed watermark based on output which is 640x360

因为如果输入视频是 640x360,它会用这个命令显示大水印如果输入链接是 1280x720 则水印很小

coz if input video is 640x360 it show big watermark with this command if input link is 1280x720 then watermark is so small

推荐答案

您可以使用 scale2ref 过滤器.

You can use the scale2ref filter.

-filter_complex "[1][0]scale2ref=iw/8:ih/8[wm][vid];[vid][wm]overlay=17:17[out]"

如果您的水印的纵横比与您的视频输入不同,那么 scale2ref 会扭曲您的徽标.最好执行一次性操作,填充徽标,以便图像与您的视频具有相同的纵横比.

If the aspect ratio of your watermark is not the same as your video inputs, then the scale2ref will distort your logo. It's best to perform a one-time operation where the logo is padded so that the image has the same aspect ratio as your videos.

这篇关于ffmpeg 修复水印大小或百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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