Skip to content

Commit dbcf259

Browse files
committed
Update docs
1 parent 655b2f4 commit dbcf259

File tree

4 files changed

+153
-3
lines changed

4 files changed

+153
-3
lines changed

genindex.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ <h2 id="D">D</h2>
8181
<table style="width: 100%" class="indextable genindextable"><tr>
8282
<td style="width: 33%; vertical-align: top;"><ul>
8383
<li><a href="index.html#ffmpeg.drawbox">drawbox() (in module ffmpeg)</a>
84+
</li>
85+
</ul></td>
86+
<td style="width: 33%; vertical-align: top;"><ul>
87+
<li><a href="index.html#ffmpeg.drawtext">drawtext() (in module ffmpeg)</a>
8488
</li>
8589
</ul></td>
8690
</tr></table>

index.html

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,152 @@ <h1>ffmpeg-python: Python bindings for FFmpeg<a class="headerlink" href="#ffmpeg
141141
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#drawbox">drawbox</a></p>
142142
</dd></dl>
143143

144+
<dl class="function">
145+
<dt id="ffmpeg.drawtext">
146+
<code class="descclassname">ffmpeg.</code><code class="descname">drawtext</code><span class="sig-paren">(</span><em>stream</em>, <em>text=None</em>, <em>x=0</em>, <em>y=0</em>, <em>escape_text=True</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.drawtext" title="Permalink to this definition"></a></dt>
147+
<dd><p>Draw a text string or text from a specified file on top of a video, using the libfreetype library.</p>
148+
<p>To enable compilation of this filter, you need to configure FFmpeg with <code class="docutils literal"><span class="pre">--enable-libfreetype</span></code>. To enable default
149+
font fallback and the font option you need to configure FFmpeg with <code class="docutils literal"><span class="pre">--enable-libfontconfig</span></code>. To enable the
150+
text_shaping option, you need to configure FFmpeg with <code class="docutils literal"><span class="pre">--enable-libfribidi</span></code>.</p>
151+
<table class="docutils field-list" frame="void" rules="none">
152+
<col class="field-name" />
153+
<col class="field-body" />
154+
<tbody valign="top">
155+
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
156+
<li><strong>box</strong> – Used to draw a box around text using the background color. The value must be either 1 (enable) or 0
157+
(disable). The default value of box is 0.</li>
158+
<li><strong>boxborderw</strong> – Set the width of the border to be drawn around the box using boxcolor. The default value of
159+
boxborderw is 0.</li>
160+
<li><strong>boxcolor</strong> – The color to be used for drawing box around text. For the syntax of this option, check the “Color”
161+
section in the ffmpeg-utils manual. The default value of boxcolor is “white”.</li>
162+
<li><strong>line_spacing</strong> – Set the line spacing in pixels of the border to be drawn around the box using box. The default
163+
value of line_spacing is 0.</li>
164+
<li><strong>borderw</strong> – Set the width of the border to be drawn around the text using bordercolor. The default value of
165+
borderw is 0.</li>
166+
<li><strong>bordercolor</strong> – Set the color to be used for drawing border around text. For the syntax of this option, check the
167+
“Color” section in the ffmpeg-utils manual. The default value of bordercolor is “black”.</li>
168+
<li><strong>expansion</strong> – Select how the text is expanded. Can be either none, strftime (deprecated) or normal (default). See
169+
the Text expansion section below for details.</li>
170+
<li><strong>basetime</strong> – Set a start time for the count. Value is in microseconds. Only applied in the deprecated strftime
171+
expansion mode. To emulate in normal expansion mode use the pts function, supplying the start time (in
172+
seconds) as the second argument.</li>
173+
<li><strong>fix_bounds</strong> – If true, check and fix text coords to avoid clipping.</li>
174+
<li><strong>fontcolor</strong> – The color to be used for drawing fonts. For the syntax of this option, check the “Color” section in
175+
the ffmpeg-utils manual. The default value of fontcolor is “black”.</li>
176+
<li><strong>fontcolor_expr</strong> – String which is expanded the same way as text to obtain dynamic fontcolor value. By default
177+
this option has empty value and is not processed. When this option is set, it overrides fontcolor option.</li>
178+
<li><strong>font</strong> – The font family to be used for drawing text. By default Sans.</li>
179+
<li><strong>fontfile</strong> – The font file to be used for drawing text. The path must be included. This parameter is mandatory if
180+
the fontconfig support is disabled.</li>
181+
<li><strong>alpha</strong> – Draw the text applying alpha blending. The value can be a number between 0.0 and 1.0. The expression
182+
accepts the same variables x, y as well. The default value is 1. Please see fontcolor_expr.</li>
183+
<li><strong>fontsize</strong> – The font size to be used for drawing text. The default value of fontsize is 16.</li>
184+
<li><strong>text_shaping</strong> – If set to 1, attempt to shape the text (for example, reverse the order of right-to-left text and
185+
join Arabic characters) before drawing it. Otherwise, just draw the text exactly as given. By default 1 (if
186+
supported).</li>
187+
<li><strong>ft_load_flags</strong><p>The flags to be used for loading the fonts. The flags map the corresponding flags supported by
188+
libfreetype, and are a combination of the following values:</p>
189+
<ul>
190+
<li><code class="docutils literal"><span class="pre">default</span></code></li>
191+
<li><code class="docutils literal"><span class="pre">no_scale</span></code></li>
192+
<li><code class="docutils literal"><span class="pre">no_hinting</span></code></li>
193+
<li><code class="docutils literal"><span class="pre">render</span></code></li>
194+
<li><code class="docutils literal"><span class="pre">no_bitmap</span></code></li>
195+
<li><code class="docutils literal"><span class="pre">vertical_layout</span></code></li>
196+
<li><code class="docutils literal"><span class="pre">force_autohint</span></code></li>
197+
<li><code class="docutils literal"><span class="pre">crop_bitmap</span></code></li>
198+
<li><code class="docutils literal"><span class="pre">pedantic</span></code></li>
199+
<li><code class="docutils literal"><span class="pre">ignore_global_advance_width</span></code></li>
200+
<li><code class="docutils literal"><span class="pre">no_recurse</span></code></li>
201+
<li><code class="docutils literal"><span class="pre">ignore_transform</span></code></li>
202+
<li><code class="docutils literal"><span class="pre">monochrome</span></code></li>
203+
<li><code class="docutils literal"><span class="pre">linear_design</span></code></li>
204+
<li><code class="docutils literal"><span class="pre">no_autohint</span></code></li>
205+
</ul>
206+
<p>Default value is “default”. For more information consult the documentation for the FT_LOAD_* libfreetype
207+
flags.</p>
208+
</li>
209+
<li><strong>shadowcolor</strong> – The color to be used for drawing a shadow behind the drawn text. For the syntax of this option,
210+
check the “Color” section in the ffmpeg-utils manual. The default value of shadowcolor is “black”.</li>
211+
<li><strong>shadowx</strong> – The x offset for the text shadow position with respect to the position of the text. It can be either
212+
positive or negative values. The default value is “0”.</li>
213+
<li><strong>shadowy</strong> – The y offset for the text shadow position with respect to the position of the text. It can be either
214+
positive or negative values. The default value is “0”.</li>
215+
<li><strong>start_number</strong> – The starting frame number for the n/frame_num variable. The default value is “0”.</li>
216+
<li><strong>tabsize</strong> – The size in number of spaces to use for rendering the tab. Default value is 4.</li>
217+
<li><strong>timecode</strong> – Set the initial timecode representation in “hh:mm:ss[:;.]ff” format. It can be used with or without
218+
text parameter. timecode_rate option must be specified.</li>
219+
<li><strong>rate</strong> – Set the timecode frame rate (timecode only).</li>
220+
<li><strong>timecode_rate</strong> – Alias for <code class="docutils literal"><span class="pre">rate</span></code>.</li>
221+
<li><strong>r</strong> – Alias for <code class="docutils literal"><span class="pre">rate</span></code>.</li>
222+
<li><strong>tc24hmax</strong> – If set to 1, the output of the timecode option will wrap around at 24 hours. Default is 0 (disabled).</li>
223+
<li><strong>text</strong> – The text string to be drawn. The text must be a sequence of UTF-8 encoded characters. This parameter is
224+
mandatory if no file is specified with the parameter textfile.</li>
225+
<li><strong>textfile</strong> – A text file containing text to be drawn. The text must be a sequence of UTF-8 encoded characters.
226+
This parameter is mandatory if no text string is specified with the parameter text. If both text and
227+
textfile are specified, an error is thrown.</li>
228+
<li><strong>reload</strong> – If set to 1, the textfile will be reloaded before each frame. Be sure to update it atomically, or it
229+
may be read partially, or even fail.</li>
230+
<li><strong>x</strong> – The expression which specifies the offset where text will be drawn within the video frame. It is relative to
231+
the left border of the output image. The default value is “0”.</li>
232+
<li><strong>y</strong> – The expression which specifies the offset where text will be drawn within the video frame. It is relative to
233+
the top border of the output image. The default value is “0”. See below for the list of accepted constants
234+
and functions.</li>
235+
</ul>
236+
</td>
237+
</tr>
238+
</tbody>
239+
</table>
240+
<dl class="docutils">
241+
<dt>Expression constants:</dt>
242+
<dd><dl class="first docutils">
243+
<dt>The parameters for x and y are expressions containing the following constants and functions:</dt>
244+
<dd><ul class="first last simple">
245+
<li>dar: input display aspect ratio, it is the same as <code class="docutils literal"><span class="pre">(w</span> <span class="pre">/</span> <span class="pre">h)</span> <span class="pre">*</span> <span class="pre">sar</span></code></li>
246+
<li>hsub: horizontal chroma subsample values. For example for the pixel format “yuv422p” hsub is 2 and vsub
247+
is 1.</li>
248+
<li>vsub: vertical chroma subsample values. For example for the pixel format “yuv422p” hsub is 2 and vsub
249+
is 1.</li>
250+
<li>line_h: the height of each text line</li>
251+
<li>lh: Alias for <code class="docutils literal"><span class="pre">line_h</span></code>.</li>
252+
<li>main_h: the input height</li>
253+
<li>h: Alias for <code class="docutils literal"><span class="pre">main_h</span></code>.</li>
254+
<li>H: Alias for <code class="docutils literal"><span class="pre">main_h</span></code>.</li>
255+
<li>main_w: the input width</li>
256+
<li>w: Alias for <code class="docutils literal"><span class="pre">main_w</span></code>.</li>
257+
<li>W: Alias for <code class="docutils literal"><span class="pre">main_w</span></code>.</li>
258+
<li>ascent: the maximum distance from the baseline to the highest/upper grid coordinate used to place a glyph
259+
outline point, for all the rendered glyphs. It is a positive value, due to the grid’s orientation with the Y
260+
axis upwards.</li>
261+
<li>max_glyph_a: Alias for <code class="docutils literal"><span class="pre">ascent</span></code>.</li>
262+
<li>descent: the maximum distance from the baseline to the lowest grid coordinate used to place a glyph outline
263+
point, for all the rendered glyphs. This is a negative value, due to the grid’s orientation, with the Y axis
264+
upwards.</li>
265+
<li>max_glyph_d: Alias for <code class="docutils literal"><span class="pre">descent</span></code>.</li>
266+
<li>max_glyph_h: maximum glyph height, that is the maximum height for all the glyphs contained in the rendered
267+
text, it is equivalent to ascent - descent.</li>
268+
<li>max_glyph_w: maximum glyph width, that is the maximum width for all the glyphs contained in the rendered
269+
text.</li>
270+
<li>n: the number of input frame, starting from 0</li>
271+
<li>rand(min, max): return a random number included between min and max</li>
272+
<li>sar: The input sample aspect ratio.</li>
273+
<li>t: timestamp expressed in seconds, NAN if the input timestamp is unknown</li>
274+
<li>text_h: the height of the rendered text</li>
275+
<li>th: Alias for <code class="docutils literal"><span class="pre">text_h</span></code>.</li>
276+
<li>text_w: the width of the rendered text</li>
277+
<li>tw: Alias for <code class="docutils literal"><span class="pre">text_w</span></code>.</li>
278+
<li>x: the x offset coordinates where the text is drawn.</li>
279+
<li>y: the y offset coordinates where the text is drawn.</li>
280+
</ul>
281+
</dd>
282+
</dl>
283+
<p class="last">These parameters allow the x and y expressions to refer each other, so you can for example specify
284+
<code class="docutils literal"><span class="pre">y=x/dar</span></code>.</p>
285+
</dd>
286+
</dl>
287+
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#drawtext">drawtext</a></p>
288+
</dd></dl>
289+
144290
<dl class="function">
145291
<dt id="ffmpeg.filter_">
146292
<code class="descclassname">ffmpeg.</code><code class="descname">filter_</code><span class="sig-paren">(</span><em>stream_spec</em>, <em>filter_name</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.filter_" title="Permalink to this definition"></a></dt>

objects.inv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# Project: ffmpeg-python
33
# Version:
44
# The remainder of this file is compressed using zlib.
5-
xڍ��j�0�O1�^]�W`���B@�N4�d˜��O_5Hw��9)��ߙ����!���.Y�0���2Dg�r�|�����d��Ay�֙y����h���9���2�D�c57���66"�"�c����ٸCB�3>$ٛr�=֔��M���N�V�b;���0�'/r#� �^d�Dp���,�"�?[��cWYՠ��
6-
g�p�����vGO"w,��܏+4�0~�m51�n;)���G����B~�W>���j;߯�\��;��U����z
5+
xڍ��j�0�O1�^]�W`���B@�N4�/Ɖ��U�t
6+
��2��� j�v{�k�B�,���r�ٷ\+ߡ,�/m���Ay�֙i���[6���9���b�E�#57a[�E�m,#�"�#׊�Q�m�l�!���l(��co�n��� ɪUlg2|nF��EnD����I��&��>BpQ�3R�����]eU��+�����~[��.�;z�cW���~\�ل��g�����b������\����D�<����D�e������L'�

0 commit comments

Comments
 (0)