[Libav-user] what is the relationship between fontsize and image resolution in drawtext filter
applemax82 at 163.com
Tue Apr 26 13:32:26 CEST 2016
libfreetype is used to draw text on video stream.
There are 3 important syntaxes in the filter of drawtext.
The font size to be used for drawing text. The default value of fontsize is 16.
the height of the rendered text
the width of the rendered text
However, text_h and text_w can only be used in filtergraph description. I want to know the height and width of the rendered text that corresponds to some fondsize, such as fondsize=20. It means, how to calculate the pixel number of rendered text in width and height?
At 2016-04-26 17:20:13, "Nicolas George" <george at nsup.org> wrote:
>L'octidi 8 floréal, an CCXXIV, qw a écrit :
>> I want to use drawtext filter to put some string on video stream. What is
>> the relationship between fontsize and image resolution in drawtext filter?
>The size is the body height of the font in pixels, nothing fancy.
>> If fontsize is set to 20, what is the height and width of rendered text?
>It depends on the font.
>For the height, the rule of thumb is that the body size is the distance
>between the top of the tallest glyph (except sometimes accented ones) and
>the bottom of the deepest one, typically something like the top of a
>parenthesis and the bottom of a p or q.
>For the width, it depends completely, because not all glyphs have the same
>width, and you need to take kerning into account too.
> Nicolas George
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user