## Subtitle

`Subtitle` (clip, string text, int "x", int "y", int "first_frame", int "last_frame", string "font", int "size", int "text_color", int "halo_color", int "align", int "spc")
`Subtitle` (clip, string text)

The `Subtitle` filter adds a single line of anti-aliased text to a range of frames. If you want more than one subtitle, or a subtitle that takes more than one line, you have to chain several `Subtitle` filters together. This filter is obviously unsuitable for anything more than occasional use. I use it occasionally. All parameters after text are optional and can be omitted or specified out of order using the name=value syntax.

Parameters

text is the text which will be overlayed on the clip starting from frame first_frame and ending with frame last_frame. font is the fonts of the text (all installed fonts on the current machine are available, they are located in your 'windows\fonts' folder). size is the size of the text. (x,y) is the position of the text. The parameters x and y can be set to -1 to automatically calculate and use the horizontal or vertical center coordinate. The text_color and halo_color should be given as hexadecimal RGB values, as in HTML--except that they start with $ instead of #. (I was already using # to introduce a comment.)

The align parameter allows you to set where the text is placed relative to the (x,y) location and is based on the numeric keypad as follows:

<left> 7 <top> | <center> 8 <top> | <right> 9 <top> | top of text aligned to y-location for align=7,8,9
<left> 4 <baseline> | <center> 5 <baseline> | <right> 6 <baseline> | baseline of text aligned to y-location for align=4,5,6
<left> 1 <bottom> | <center> 2 <bottom> | <right> 3 <bottom> | bottom of text aligned to y-location for align=1,2,3
start at x for align=1,4,7 | center on x for align=2,5,8 | end at x for align=3,6,9 |

Note: There is no Y-center alignment setting.

The spc parameter allows you to modify the character spacing (0=unchanged). The value can be positive or negative to widen or narrow the text. Per the Visual C++ documentation of the function that performs this task, this value is in logical units and rounded to the nearest pixel. This is helpful for trying to match typical fonts on the PC to fonts used in film and television credits which are usually wider for the same height or to just fit or fill in a space with a fixed per-character adjustment.

The alternate, short form is useful when you don't really care what the subtitle looks like as long as you can see it--for example, when you're using StackVertical and its ilk to display several versions of a frame at once, and you want to label them to remember which is which.

This filter is used internally by AviSynth for the Version command and for reporting error messages, and the subtitling apparatus is also used by ShowFrameNumber.

Default Values

clip | last
text | no default, must be specified
x | 8 if align=1,4,7 or none; -1 if align=2,5,8; or width-8 if align=3,6,9
y | height-1 if align=1,2,3; size if align=4,5,6 or none; or 0 if align=7,8,9
first_frame | 0
last_frame | framecount(clip)-1
font | "Arial"
size | 18
text_color | $FFFF00 <yellow>
halo_color | 0 <black>
align | Normally 4 <left and baseline>; if x=-1, then 5 <horizontal center and baseline>
spc | 0 <font spacing unchanged>

Examples

    # Some text in the center of the clip
    AviSource("D:\clip.avi")
    Subtitle("Hello world!", align=5)

    # Some text in the upper right corner of the clip with specified font, size and color.
    AviSource("D:\clip.avi")
    Subtitle("Hello world!", font="georgia", size=24, text_color=$ff0000, align=9)

Version Specific Information

v1.00 | Setting x=-1 uses horizontal center and center alignment (undocumented prior to v2.07)
v2.07 | Added align and spc parameters. Setting y=-1 calculates vertical center (alignment unaffected) Default x and y values dependent on alignment (previously x=8, y=size)

`$Date: 2005/10/03 16:49:04 $`