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

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

问题描述

我有一些视频,我想添加水印给他们
但问题是coz在每个视频水印大小是不同的
(在一些视频水印是较小的,有些是更大的 - 我想想因为视频输入的大小可以不同)



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

  ffmpeg -ihttp:// 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 -y1.m3u8

是否有一种方法可以根据640x360的输出制作任何百分比或固定水印



输入视频是640x360,如果输入链接为1280x720,则显示大水印
然后水印很小

解决方案

您可以使用scale2ref过滤器。

   

如果您的水印的宽高比与您的视频输入不同,则scale2ref会扭曲您的标志。最好是执行一次一次性操作,其中标记被填充,使得图像与您的视频具有相同的宽高比。


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)

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"

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

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

解决方案

You can use the scale2ref filter.

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

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天全站免登陆