问题
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