How to scale and position watermark to scale?

坚强是说给别人听的谎言 提交于 2019-12-30 05:30:08

问题


I'm scaling a video and applying a watermark like so:

ffmpeg -ss 0:0:0.000 -i video.mp4 -y -an -t 0:0:10.000
 -vf \"[in]scale=400:316[middle]\" -b:v 2000k -r 20
 -vf 'movie=watermark.png,pad=400:316:0:0:0x00000000 [watermark];[middle] [watermark]overlay=0:0[out]'
 out.flv

However, the applied watermark seems to be scaled to the original video size rather than the smaller scaled video size.

This command line worked on ffmpeg version 0.8.6.git and now behaves differently after an upgrade to version N-52381-g2288c77.

How do I get it to work again?


Update 2013-04-26:
I now have tried to use the overlay filter's X and Y parameters instead of padding without success.

回答1:


Answered by ubitux on the FFmpeg IRC:

Use scale and overlay in a single -filter_complex chain, like so:

ffmpeg -y -ss 0 -t 0:0:30.0 -i 'video.mp4' -i '/watermark.png'
 -filter_complex "[0:0] scale=400:225 [wm]; [wm][1:0] overlay=305:0 [out]"
 -map "[out]" -b:v 896k -r 20 -an 
 'out.flv'

Also load the watermark via -i rather than the movie filter.



来源:https://stackoverflow.com/questions/16148068/how-to-scale-and-position-watermark-to-scale

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