[FFmpeg-devel] [PATCH 0/2] Drawtext: dynamic fontcolor
Andrey Utkin
andrey.krieger.utkin at gmail.com
Sun Jun 22 16:31:08 CEST 2014
The patchset introduces fontcolor_expr argument which is evaluated every frame.
This allows to have fade in/out effect (gradual (dis)appearing of text) with drawtext by manipulating alpha value of color.
The change is currently done only for fontcolor, so shadow, box etc. colors are still static. But i'd like to get comments on this before proceeding.
You can test how fading in and out works now, with following lines executed in shell:
DS=1.0 # display start
DE=10.0 # display end
FID=1.5 # fade in duration
FOD=5 # fade out duration
$FFPLAY -f lavfi -i "color=color=white,drawtext=text=TEST:fontsize=50:fontfile=/usr/share/fonts/corefonts/verdana.ttf:fontcolor_expr=ff0000%{eif\\\: %02x\\\: max(0\\, min(255\\, 255*(1*between(t\\, $DS + $FID\\, $DE - $FOD) + ((t - $DS)/$FID)*between(t\\, $DS\\, $DS + $FID) + (-(t - $DE)/$FOD)*between(t\\, $DE - $FOD\\, $DE) ) ))}"
You can also look at the text blinking with random color on each new frame:
$FFPLAY -f lavfi -i "color=color=white,drawtext=text=TEST:fontsize=50:fontfile=/usr/share/fonts/corefonts/verdana.ttf:fontcolor_expr=random"
Andrey Utkin (2):
drawtext: drop unused draw_glyphs() arg "rgbcolor"
drawtext: introduce fontcolor argument expansion
libavfilter/vf_drawtext.c | 76 +++++++++++++++++++++++++++++++++++++++++------
1 file changed, 67 insertions(+), 9 deletions(-)
--
1.8.3.2
More information about the ffmpeg-devel
mailing list