Linux使用ffmpeg添加水印,ffmpeg视频随机添加水印

这个是看到hostloc上一个网友提问的,并有网友回复的,所以在这里做下收藏和记录。

加水印,如何实现,左上,右上,左下,右下,四个角,每隔1分钟,随机换一个位置?

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay='if(ld(0), if(lte(mod(t/60,1),0.05),st(0,0);NAN,ld(1)), st(0,1);if(lte(random(t),0.5),st(1,0),st(1,main_w-overlay_w));NAN)':'if(ld(0), if(lte(mod(t/60,1),0.05),st(0,0);NAN,ld(1)), st(0,1);if(lte(random(t),0.5),st(1,0),st(1,main_h-overlay_h));NAN)'" output.mp4

ffmpeg -i input.mp4 \

-vf \

"drawtext=fontfile=font.ttf:fontsize=80:fontcolor=yellow@0.5:text='studentname': \

x=if(eq(mod(t\,30)\,0)\,rand(0\,(W-tw))\,x): \

y=if(eq(mod(t\,30)\,0)\,rand(0\,(H-th))\,y)" \

-c:v libx264 -crf 23 -c:a copy output.mp4

ffmpeg -i input.mp4 \

-vf \

"drawtext=fontfile=font.ttf:fontsize=80:fontcolor=yellow@0.5: \

text='studentname':x=200:y=350:enable='between(mod(t\,30*3),0,30)', \

drawtext=fontfile=font.ttf:fontsize=80:fontcolor=yellow@0.5: \

text='studentname':x=1000:y=600:enable='between(mod(t\,30*3),31,60)', \

drawtext=fontfile=font.ttf:fontsize=80:fontcolor=yellow@0.5: \

text='studentname':x=450:y=50:enable='between(mod(t\,30*3),61,90)'" \

-c:v libx264 -crf 23 -c:a copy output.mp4

It is an interesting example, and I’ve seen enough similar questions like this that I think it could be useful to add it to the drawtext examples in doc/filters.texi if you feel like submitting a patch. – llogan Apr 2 ’16 at 6:11

Sounds good. Can you point to a guide on how to format and submit a doc patch? Thanks. – Gyan Apr 2 ’16 at 7:07

Clone ffmpeg repo using git. Add name and email to git global config and navigate to ffmpeg directory. Always rebase first: git pull –rebase. Make local branch: git checkout -b drawrandom. Make edits. Locally commit changes: git commit -as (see example commit titles and messages). Review log git log -p -2, make patch: git format-patch -o patches origin. Email file in patches to ffmpeg-devel at ffmpeg. – llogan Apr 2 ’16 at 18:03

Also see Using Git to develop FFmpeg. Most devs use git send-email but that involves some added complexity to setup. – llogan Apr 2 ’16 at 18:05

Thanks. Email sent. – Gyan Apr 3 ’16 at 9:13

79b17030185317c3407dc6e915b00fe6.png

sicnature ---------------------------------------------------------------------

Your current IP address is: 117.92.121.2

Your IP address location: 江苏省连云港市电信

Your IP address country and region: 中国

3211c715c0bf352c3fa72980bf0cc419.png

Your current browser is:

b2cb575f9cbd2e36961b3bf406c3355c.png

Your current system is:

mac.png

Original content, please indicate the source:

同福客栈论坛 | 蟒蛇科普 | 海南乡情论坛 | JiaYu Blog

sicnature ---------------------------------------------------------------------

Welcome to reprint. Please indicate the source https://www.myzhenai.com/post/3063.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值