[FFmpeg-devel] [PATCH] added expr evaluation to drawtext - fontsize
brett.harrison at zyamusic.com
Fri Sep 2 01:44:04 EEST 2016
Any feedback on this newest patch?
On Tue, Aug 30, 2016 at 2:17 PM, Brett Harrison <brett.harrison at zyamusic.com
> Since there are differing opinions on how the default fontsize should be
> established this patch adds my changes while preserving the current
> behavior when fontsize is not specified.
> On Tue, Aug 30, 2016 at 2:43 AM, Nicolas George <george at nsup.org> wrote:
>> Le tridi 13 fructidor, an CCXXIV, Brett Harrison a écrit :
>> > Before I fix the patch, can you clarify the intended functionality?
>> > The docs say that 16 is the default fontsize, however if
>> > CONFIG_LIBFONTCONFIG is configured and ffmpeg if called with:
>> > -vf drawtext=text=abc:fontcolor=white
>> > on my system the font used will be /opt/X11/share/fonts/TTF/Vera.ttf
>> > default chosen by libfontconfig) and the fontsize will be set to 12.
>> > However if ffmpeg is called with:
>> > -vf
>> > drawtext=text=abc:fontcolor=white:fontfile=/opt/X11/share/fo
>> > This is the same font that libfontconfig used, however this time
>> > 16 is used as stated in the docs.
>> > The difference is this line of code in load_font_fontconfig
>> > if (!s->fontsize)
>> > s->fontsize = size + 0.5;
>> > I didn't set the fontsize in either command, but the output was
>> > Do we want to keep this as is?
>> I think the current behaviour is correct.
>> I start with the following principle: when users want something precise
>> about aesthetic or other arbitrary settings, they have to say it.
>> Default values are for the lazy or the careless ones: quick profiling and
>> testing when the exact result does not matter much. But as soon as the
>> result matters, explicit values must be given.
>> Do not take me wrong, the default values should be, as much as possible,
>> sensible. But for a font size, 12 is as sensible as 16.
>> Most importantly, backward compatibility should not be an hindrance to
>> choosing better default values. We should not change them lightly, but not
>> feel forbidden to do so either.
>> Fontconfig is not just a path search library for finding font files. It
>> is a
>> complete mechanism for choosing the right font according to several
>> conditions set by the user. Including the font size.
>> There are no less than four levels for choosing the font size:
>> (1) lavfi's default, 16;
>> (2) fontconfig's default;
>> (3) fontconfig's explicit value, as in "Times-12:bold";
>> (4) lavfi's explicit value, as in "fontsize=16".
>> I think the order of precedence should be just that, for the following
>> - First, of course, (3), (4) > (1), (2), because explicit values are
>> more important.
>> - Second, conflicting explicit values are the users' problem. We can
>> warnings to help diagnose, but in the end it is their choice. (4) > (3)
>> slightly easier to implement (distinguishing (3) from (2) requires a bit
>> of work), and (4) is more supple, especially when your patch gets
>> - Last, (2) > (1), because fontconfig is more cross-applications than
>> and also because it includes a mechanism for explicit configuration.
>> Still, the documentation should be clarified, possibly something like
>> "The default value of fontsize is provided by fontconfig if in use or 16
>> when using a font file directly."
>> Nicolas George
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
More information about the ffmpeg-devel