[Libav-user] what is the relationship between fontsize and image resolution in drawtext filter

qw applemax82 at 163.com
Tue Apr 26 13:32:26 CEST 2016


Hi,
 
libfreetype is used to draw text on video stream.

http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
There are 3 important syntaxes in the filter of drawtext.
 
fontsize

The font size to be used for drawing text. The default value of fontsize is 16.

text_h, th

the height of the rendered text

text_w, tw

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?


Thanks!





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.
>
>Regards,
>
>-- 
>  Nicolas George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160426/6a83d95f/attachment.html>


More information about the Libav-user mailing list