编写FFmpeg脚本以在特定时间码将y坐标中的文本移动一些增量 [英] Scripting FFmpeg to move text in y co-ordinate by some delta at specific time-codes
本文介绍了编写FFmpeg脚本以在特定时间码将y坐标中的文本移动一些增量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用像这样的基本drawtext命令
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"
将固定文本放在(x,y)=(0,0)的位置
which puts stationary text at location (x, y) = (0,0)
我想做的是在特定的时间代码处在y平面上将文本移动10点.
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
所以'y'坐标在'关键时间'的固定增量为10
so the 'y' co-ordinate has a fix increment of 10 at 'keytimes'
有办法吗?
推荐答案
基本方法是使用以下形式的表达式
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'
每个子表达式的形式为time-qualification * position
,并且对于时间轴的任何分段,只有一个时间限定的结果为1.
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.
这篇关于编写FFmpeg脚本以在特定时间码将y坐标中的文本移动一些增量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文