这个是看到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
sicnature ---------------------------------------------------------------------
Your current IP address is: 117.92.121.2
Your IP address location: 江苏省连云港市电信
Your IP address country and region: 中国
Your current browser is:
Your current system is:
Original content, please indicate the source:
同福客栈论坛 | 蟒蛇科普 | 海南乡情论坛 | JiaYu Blog
sicnature ---------------------------------------------------------------------
Welcome to reprint. Please indicate the source https://www.myzhenai.com/post/3063.html