Making jumping text watermark

北慕城南 提交于 2019-12-11 13:16:13

问题


I want to make something like these : http://www.youtube.com/watch?v=AtM-f20XV4E you can see there a watermark which change position every two second...

But I need it for drawtext filter.

So, I am already realize how to change a text position every few seconds.. but have no idea - how to keep new position :) there is a code which I have right now..

ffmpeg.exe -i myVideo.mov -c:v libx264 -preset veryfast -crf 25 -tune zerolatency -vendor ap10 -pix_fmt yuv420p -filter:v drawtext=fontfile=arial.ttf:text=MY_WATERMARK_TEXT:fontcolor=white:alpha=0.5:fontsize=74:box=1:boxcolor=red:x=if(eq(mod(t\,1)\,0)\,1000\,10):y=(h-text_h-line_h)/2 -c:a copy outVideo.mp4

it move my text to new position every 1 second. but then immediately change position back of course.

So, I stuck about that.. how to keep new position ? may be I should using ld() and st() ?


回答1:


Ok. It was easier than I thought..

There is an answer:

ffmpeg.exe -i myVideo.mov -c:v libx264 -preset veryfast -crf 25 -tune zerolatency -vendor ap10 -pix_fmt yuv420p -filter:v drawtext=fontfile=arial.ttf:text=MY_WATERMARK_TEXT:fontcolor=white:alpha=0.5:fontsize=74:box=1:boxcolor=red:x=if(eq(mod(n\,18)\,0)\,sin(random(1))*w\,x):y=if(eq(mod(n\,18)\,0)\,sin(random(1))*h\,y) -c:a copy outVideo.mp4

That's a primary part:

x=if(eq(mod(n\,18)\,0)\,sin(random(1))*w\,x):

y=if(eq(mod(n\,18)\,0)\,sin(random(1))*h\,y)

In this example Text_Watermark will change position to random one in every 18'nth frame.



来源:https://stackoverflow.com/questions/30291331/making-jumping-text-watermark

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