1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2026-05-21 16:47:28 +02:00

Port drawtext filter by Hemanth from the libavfilter soc repo, with

the following additions:
* support to anti-aliased glyph rendering
* support to UTF-8 text and Unicode chars rendering
* support for RGB packed formats

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Stefano Sabatini
2011-02-21 01:02:29 +01:00
committed by Michael Niedermayer
parent 704865fc87
commit bd8e750300
5 changed files with 770 additions and 0 deletions
+112
View File
@@ -386,6 +386,118 @@ fade=in:0:25, fade=out:975:25
fade=in:5:20
@end example
@section drawtext
Draw text string or text from specified file on top of video using the
libfreetype library.
To enable compilation of this filter you need to configure FFmpeg with
@code{--enable-libfreetype}.
The filter also recognizes strftime() sequences in the provided text
and expands them accordingly. Check the documentation of strftime().
The filter accepts parameters as a list of @var{key}=@var{value} pairs,
separated by ":".
The description of the accepted parameters follows.
@table @option
@item fontfile
The font file to be used for drawing text. Path must be included.
This parameter is mandatory.
@item text
The text string to be drawn. The text must be a sequence of UTF-8
encoded characters.
This parameter is mandatory if no file is specified.
@item textfile
A text file containing text to be drawn. The text must be a sequence
of UTF-8 encoded characters
This parameter is mandatory if no text string is specified.
If both text and textfile are specified, an error is thrown.
@item x, y
The offsets where text will be drawn within the video frame.
Relative to the top/left border of the output image.
The default value of @var{x} and @var{y} is 0.
@item fontsize
The font size to be used for drawing text.
The default value of @var{size} is 16.
@item fontcolor
The color to be used for drawing fonts.
Either a string (e.g. "red") or in 0xRRGGBB[AA] format
(e.g. "0xff000033"), possibly followed by an alpha specifier.
The default value of @var{fontcolor} is "black".
@item boxcolor
The color to be used for drawing box around text.
Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format
(e.g. "0xff00ff"), possibly followed by an alpha specifier.
The default value of @var{bgcolor} is "white".
@item box
Used to draw a box around text using background color.
Value should be either 1 (enable) or 0 (disable).
The default value of @var{box} is 0.
@item ft_load_flags
Flags to be used for loading the fonts.
The flags map the corresponding flags supported by libfreetype, and are
a combination of the following values:
@table @var
@item default
@item no_scale
@item no_hinting
@item render
@item no_bitmap
@item vertical_layout
@item force_autohint
@item crop_bitmap
@item pedantic
@item ignore_global_advance_width
@item no_recurse
@item ignore_transform
@item monochrome
@item linear_design
@item no_autohint
@item end table
@end table
Default value is "render".
For more information consult the documentation for the FT_LOAD_*
libfreetype flags.
@item tabsize
The size in number of spaces to use for rendering the tab.
Default value is 4.
@end table
For example the command:
@example
drawtext=fontfile=FreeSerif.ttf: text='Test Text': x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: boxcolor=red@@0.2: box=1"
@end example
will draw 'Test Text' with font FreeSerif of size 24 at position
(100,50), text color is yellow, and draw a red box around text. Both
the text and the box have an opacity of 20%.
Note that the double quotes are not necessary if spaces are not used
within the parameter list.
For more information about libfreetype, check:
@url{http://www.freetype.org/}
@section fifo
Buffer input images and send them when they are requested.