ffmpeg fix watermark size or percentage

痴心易碎 提交于 2019-11-28 12:44:18

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/37513780/ffmpeg-fix-watermark-size-or-percentage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!