[FFmpeg-user] Weird results with drawtext

Cecil Westerhof Cecil at decebal.nl
Sun Sep 19 13:42:27 EEST 2021


Michael Koch <astroelectronic at t-online.de> writes:

>> As Michael Koch said:
>>      The content of the variable "text_h" depends on which characters
>>      you are printing.
>>
>> So I changed:
>>      drawtext=
>>         enable     = 'between(t, 105, 115)':
>>         text       = 'speaker':
>>         y          = main_h - (text_h * 4),
>>      drawtext=
>>         enable     = 'between(t, 105, 115)':
>>         text       = 'subject':
>>         y          = main_h - (text_h * 2.2),
>>
>> to:
>>      drawtext=
>>         enable     = 'between(t, 105, 115)':
>>         text       = 'speaker':
>>         y          = main_h - 200,
>>      drawtext=
>>         enable     = 'between(t, 105, 115)':
>>         text       = 'subject':
>>         y          = main_h - 140,
>>
>> That gives satisfactory results. The only problem is when the font
>> size changes. Then I have to remember I need to change these two
>> values also. But I do not expect that to happen often, so I can live
>> with that.
>
> In your case with the words "speaker" and "subject" it works, but
> generally it fails.
> For example if you remove the character "k" from "speaker", then the
> vertical alignment will be wrong.

Speaker and subject where only templates, in reality there is a
speaker and a subject.
I made a video with eight sets of speakers and subjects and all look
good (enough). So I think (hope) that it works.
But who knows, maybe I need to go back to the drawing-board next time.
(But I certainly hope not.)

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the ffmpeg-user mailing list