|
2 | 2 |
|
3 | 3 | namespace ProjektGopher\FFMpegTools\Filters\Video;
|
4 | 4 |
|
5 |
| -use ProjektGopher\FFMpegTools\Filters\BaseFilter; |
| 5 | +use ProjektGopher\FFMpegTools\Filters\Filter; |
6 | 6 | use ProjektGopher\FFMpegTools\Filters\Traits\SupportsTimelineEditing;
|
7 | 7 |
|
8 | 8 | /**
|
9 | 9 | * DrawText
|
10 | 10 | *
|
11 | 11 | * The parameters for x and y are expressions containing the following constants and functions:
|
12 | 12 | *
|
13 |
| - * dar |
14 |
| - * input display aspect ratio, it is the same as (w / h) * sar |
15 |
| - * |
16 |
| - * hsub |
17 |
| - * vsub |
18 |
| - * horizontal and vertical chroma subsample values. For example for the pixel format "yuv422p" hsub is 2 and vsub is 1. |
19 |
| - * |
20 |
| - * line_h, lh |
21 |
| - * the height of each text line |
22 |
| - * |
23 |
| - * main_h, h, H |
24 |
| - * the input height |
25 |
| - * |
26 |
| - * main_w, w, W |
27 |
| - * the input width |
28 |
| - * |
29 |
| - * max_glyph_a, ascent |
30 |
| - * the maximum distance from the baseline to the highest/upper grid coordinate used to place a glyph outline point, for all the rendered glyphs. It is a positive value, due to the grid’s orientation with the Y axis upwards. |
31 |
| - * |
32 |
| - * max_glyph_d, descent |
33 |
| - * the maximum distance from the baseline to the lowest grid coordinate used to place a glyph outline point, for all the rendered glyphs. This is a negative value, due to the grid’s orientation, with the Y axis upwards. |
34 |
| - * |
35 |
| - * max_glyph_h |
36 |
| - * maximum glyph height, that is the maximum height for all the glyphs contained in the rendered text, it is equivalent to ascent - descent. |
37 |
| - * |
38 |
| - * max_glyph_w |
39 |
| - * maximum glyph width, that is the maximum width for all the glyphs contained in the rendered text |
40 |
| - * |
41 |
| - * n |
42 |
| - * the number of input frame, starting from 0 |
43 |
| - * |
44 |
| - * rand(min, max) |
45 |
| - * return a random number included between min and max |
46 |
| - * |
47 |
| - * sar |
48 |
| - * The input sample aspect ratio. |
49 |
| - * |
50 |
| - * t |
51 |
| - * timestamp expressed in seconds, NAN if the input timestamp is unknown |
52 |
| - * |
53 |
| - * text_h, th |
54 |
| - * the height of the rendered text |
55 |
| - * |
56 |
| - * text_w, tw |
57 |
| - * the width of the rendered text |
58 |
| - * |
59 |
| - * x |
60 |
| - * y |
61 |
| - * the x and y offset coordinates where the text is drawn. |
62 |
| - * |
63 |
| - * These parameters allow the x and y expressions to refer to each other, so you can for example specify y=x/dar. |
64 |
| - * |
65 |
| - * pict_type |
66 |
| - * A one character description of the current frame’s picture type. |
67 |
| - * |
68 |
| - * pkt_pos |
69 |
| - * The current packet’s position in the input file or stream (in bytes, from the start of the input). A value of -1 indicates this info is not available. |
70 |
| - * |
71 |
| - * duration |
72 |
| - * The current packet’s duration, in seconds. |
73 |
| - * |
74 |
| - * pkt_size |
75 |
| - * The current packet’s size (in bytes). |
| 13 | + * dar - input display aspect ratio, it is the same as (w / h) * sar |
| 14 | + * hsub - horizontal and vertical chroma subsample values. For example for the pixel format "yuv422p" hsub is 2 and vsub is 1. |
| 15 | + * vsub - horizontal and vertical chroma subsample values. For example for the pixel format "yuv422p" hsub is 2 and vsub is 1. |
| 16 | + * line_h, lh - the height of each text line |
| 17 | + * main_h, h, H - the input height |
| 18 | + * main_w, w, W - the input width |
| 19 | + * max_glyph_a, ascent - the maximum distance from the baseline to the highest/upper grid coordinate used to place a glyph outline point, for all the rendered glyphs. It is a positive value, due to the grid’s orientation with the Y axis upwards. |
| 20 | + * max_glyph_d, descent - the maximum distance from the baseline to the lowest grid coordinate used to place a glyph outline point, for all the rendered glyphs. This is a negative value, due to the grid’s orientation, with the Y axis upwards. |
| 21 | + * max_glyph_h - maximum glyph height, that is the maximum height for all the glyphs contained in the rendered text, it is equivalent to ascent - descent. |
| 22 | + * max_glyph_w - maximum glyph width, that is the maximum width for all the glyphs contained in the rendered text |
| 23 | + * n - the number of input frame, starting from 0 |
| 24 | + * rand(min, max) - return a random number included between min and max |
| 25 | + * sar - The input sample aspect ratio. |
| 26 | + * t - timestamp expressed in seconds, NAN if the input timestamp is unknown |
| 27 | + * text_h, th - the height of the rendered text |
| 28 | + * text_w, tw - the width of the rendered text |
| 29 | + * x - the x and y offset coordinates where the text is drawn. These parameters allow the x and y expressions to refer to each other, so you can for example specify y=x/dar. |
| 30 | + * y - the x and y offset coordinates where the text is drawn. These parameters allow the x and y expressions to refer to each other, so you can for example specify y=x/dar. |
| 31 | + * pict_type - A one character description of the current frame’s picture type. |
| 32 | + * pkt_pos - The current packet’s position in the input file or stream (in bytes, from the start of the input). A value of -1 indicates this info is not available. |
| 33 | + * duration - The current packet’s duration, in seconds. |
| 34 | + * pkt_size - The current packet’s size (in bytes). |
76 | 35 | *
|
77 | 36 | * @see https://ffmpeg.org/ffmpeg-filters.html#drawtext-1
|
78 | 37 | *
|
|
92 | 51 | * @method self font(string $value) Set the font family to be used for drawing text. By default Sans.
|
93 | 52 | * @method self fontfile(string $value) Set the font file to be used for drawing text. The path must be included. This parameter is mandatory if the fontconfig support is disabled.
|
94 | 53 | * @method self alpha(string $value) Draw the text applying alpha blending. The value can be a number between 0.0 and 1.0. The expression accepts the same variables x, y as well. The default value is 1. Please see fontcolor_expr.
|
95 |
| - * @method self fontsize(int $value) Set the font size to be used for drawing text. The default value of fontsize is 16. |
| 54 | + * @method self fontsize(string $value) Set the font size to be used for drawing text. The default value of fontsize is 16. |
96 | 55 | * @method self text_shaping(int $value) If set to 1, attempt to shape the text (for example, reverse the order of right-to-left text and join Arabic characters) before drawing it. Otherwise, just draw the text exactly as given. By default 1 (if supported).
|
97 | 56 | * @method self ft_load_flags(int $value) The 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: default no_scale no_hinting render no_bitmap vertical_layout force_autohint crop_bitmap pedantic ignore_global_advance_width no_recurse ignore_transform monochrome linear_design no_autohint Default value is "default". For more information consult the documentation for the FT_LOAD_* libfreetype flags.
|
98 | 57 | * @method self shadowcolor(string $value) The color to be used for drawing a shadow behind the drawn text. For the syntax of this option, check the (ffmpeg-utils)"Color" section in the ffmpeg-utils manual. The default value of shadowcolor is "black".
|
|
112 | 71 | * @method self x(string $value) The expressions which specify the offsets where text will be drawn within the video frame. They are relative to the top/left border of the output image. The default value of x and y is "0".
|
113 | 72 | * @method self y(string $value) The expressions which specify the offsets where text will be drawn within the video frame. They are relative to the top/left border of the output image. The default value of x and y is "0".
|
114 | 73 | */
|
115 |
| -final class DrawText extends BaseFilter |
| 74 | +final class DrawText extends Filter |
116 | 75 | {
|
117 | 76 | use SupportsTimelineEditing;
|
118 | 77 |
|
|
0 commit comments