drawtext=enable='between(t,18.93,20.28)':fontfile=fonts/cousine-bold.ttf:fontsize=144:fontcolor_expr=%{eif\\: if(between(t\, 18.93\, 19.02)\, 0xFFFFFF\, 0xFFB6C1) \\: x}:x=82:y=288:text='PROGRAMMING'
enable='between(t,18.93,20.28)'
Displays the text between 18.93 and 20.28 seconds.
fontfile=fonts/cousine-bold.ttf:fontsize=144
Sets the font file and size.
x=82:y=288
Sets the position of the text.
text='PROGRAMMING'
Sets the text.
fontcolor_expr=%{eif\\: if(between(t\, 18.93\, 19.02)\, 0xFFFFFF\, 0xFFB6C1) \\: x}
Sets the color of the text to white from 18.93 (when the word appears) to 19.02 (when the word is spoken). Sets it to pink from 19.02 (when the word is spoken) to 20.28 (when the word is removed from the screen).
between(x, y, z)
returns a boolean, similar to x >= y && x <= z
in JavaScript.
if(x, y, z)
is a ternary operator. If x
is true return y
else return z
. Similar to x ? y : z
.
eif :x :y :z
seems to be a formatted expression where x
is the expression, y
is the format, and z
is an optional decimal place. In this case, I'm using x
to indicate that the expression returns a hexidecimal. Unfortunately I'm not too confident with the purpose of eif
and there's not a lot of documentation on it.
Escaping counts. I'm using Node.JS with Fluent-FFmpeg and this is the code in my editor:
`drawtext=enable='between(t,${groupStart},${groupEnd})':fontfile=${fontFile}:fontsize=${fontSize}:fontcolor_expr=%{eif\\\\: if(between(t\\, ${groupStart}\\, ${wordStart})\\, 0xFFFFFF\\, 0xFFB6C1) \\\\: x}:x=${Math.floor((fontSize / 1.75) * xDistance)}:y=${Math.floor(fontSize * (lineCount + 1))}:text='${elem[0]}'`