[FFmpeg-devel] [PATCH] vf_drawtext: make x and y options parametric

Stefano Sabatini stefasab at gmail.com
Sat Sep 24 12:46:13 CEST 2011


On date Friday 2011-09-23 14:30:01 +0200, Stefano Sabatini encoded:
> On date Friday 2011-09-23 02:41:26 +0200, Stefano Sabatini encoded:
> > On date Thursday 2011-09-22 01:14:12 +0200, Stefano Sabatini encoded:
> > > On date Wednesday 2011-09-21 22:14:26 +0200, Víctor Paesa encoded:
> > > > Hi,
> > [...]
> > > > So the example (ruining parametric horizontal centering) is:
> > > > drawtext=fontsize=30:fontfile=FreeSerif.ttf:fontcolor=green:text='g':x=w/2:y=(h-text_h+ascent-line_h)/2
> > > > drawtext=fontsize=30:fontfile=FreeSerif.ttf:fontcolor=red:text='ood':x=w/2+22:y=(h-text_h+ascent-line_h)/2
> > > 
> > > Updated work in progress, not still ready for commit with a few fixes
> > > and the addition of the ascent/descent/max_glyph_w constants.
> > > 
> > > Still missing:
> > > 
> > > * documentation for the new variables (in particular about the meaning
> > >   of ascent/descent)
> > > 
> > > * better names or short aliases for max_glyph_h/w (suggestions are
> > >   welcome...), also max_glyph_h == line_h so maybe I should keep an
> > >   alias for that
> > 
> > Nit, now we have:
> > "max_glyph_w",   ///< max glyph width
> > "max_glyph_h",   ///< max glyph height
> > "ascent",        ///< max glyph ascent
> > "descent",       ///< max glyph descent
> > 
> > maybe a better scheme could be:
> > max_glyph_w
> > max_glyph_h
> > max_glyph_a
> > max_glyph_d
> > 
> > Opinions?
> 
> Created aliases.
> 
> > > * figure out how to deal with the wrapline feature, I don't think it
> > >   is possible to conciliate it easily with moving x/y, but I see it is
> > >   useful under certain scenarios so I'd like to keep it at least as a
> > >   tweakable option.
> > 
> > I made my mind, and I believe it's better to drop it at all, rather
> > than leave it half-implement, drawtext is not supposed to be a word
> > processor, and having an half-baked wrapping feature is not going to
> > help in that sense, and drawtext is just supposed to be a thin wrapper
> > around the libfreetype capabilities, we may add a text processing
> > filter as a separate filter (e.g. wrapping imagemagik or even an HTML
> > renderer).
> > 
> > Updated.
> 
> Updated again, I'm going to push it in a day or so if I read no
> comments.

Pushed.
 
> Possible improvements:
> 
> * detect if the provided text contains % parameters, if not there is
>   no need to recompute the size/position each time (should improve
>   performance when scrolling big files).
[...]
-- 
FFmpeg = Frenzy Fabulous Muttering Pure Erudite Goblin


More information about the ffmpeg-devel mailing list