Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg- drawtext style- bold, italics, underline

Tags:

ffmpeg

How can we specify style in drawtext filter. Example, draw 'Hello' in a regular font, but it should be bold, in italics and underlined. Is this possible?

like image 705
hack Avatar asked Apr 06 '17 12:04

hack


2 Answers

Maybe this answer is late, but, from the FFMPEG documentation: http://ffmpeg.org/ffmpeg-all.html

Use fontconfig to set the font. Note that the colons need to be escaped.

drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'

You have to configure the fontconfig file of course, set up your desired fonts (be careful to have all the styles that you need) in the fonts location and then run the drawtext with the font family name followed by ':style='.

Example:

-vf "drawtext='fontfile=DejaVuSans\:style=ExtraLight:text=FFmpeg'"

This worked for me in the console and as a php shell exec command. You can use whatever font style, as long as (for the style and font family that you chose), there's a font file in the font directory that follows this rule: FontFamilyName-StyleName . I really hope that this helps!

like image 141
thvs86 Avatar answered Sep 25 '22 16:09

thvs86


You can specify the target font:

drawtext= fontfile=fonts/path/Arial-Bold.ttf :text=FFmpeg

The font family should have proper file for every style you want to use.

like image 40
Alexander Avatar answered Sep 24 '22 16:09

Alexander