Scripting FFmpeg to move text in y co-ordinate by some delta at specific time-codes

大城市里の小女人 提交于 2019-12-11 19:03:48

问题


I'm using the basic drawtext command like this

ffmpeg -i output.mp4 -vf \
'drawtext=textfile='textfile.txt':x=0:y=0 \
:fontsize=30:fontcolor=white:borderw=3 \
:bordercolor=black:box=0' output.mp4"

which puts stationary text at location (x, y) = (0,0)

What I want to do is move this text by 10 points in y plane at certain time codes.

at 00:00:10, y would be 0
at 00:00:11, y would be 10
at 00:00:43, y would be 20
...
...
at 00:10:44, y would be 30

so the 'y' co-ordinate has a fix increment of 10 at 'keytimes'

Is there a way to do that?


回答1:


Basic method is to use an expression of the form,

y='lte(t,10.99)*0+between(t,11,42.99)*10+between(t,43,643.99)*20+gte(t,644)*30'

Each sub-expression is of the form of time-qualification * position and only one time-qualification evaluates to 1 for any segment of the timeline.



来源:https://stackoverflow.com/questions/54907490/scripting-ffmpeg-to-move-text-in-y-co-ordinate-by-some-delta-at-specific-time-co

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