AS5 SUBTITLE FORMAT
By Rodrigo Braz Monteiro, Niels Martin Hansen, David Lamparter and Karl Blomster
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.
July 23, 2007
Contents
1 Abstract 3
2 AS5 Files 4
2.1 File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 File Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2.1 [AS5] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2.2 [Events] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.3 [Styles] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.4 [Resources] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3 Style Overrides 11
3.1 General Information on Override Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2 Invalid or Malformed Tags and Syntax Errors . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3 Vector Path Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4 Special Character Escapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4.1 \n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.4.2 \h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.4.3 \{, \} . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.4.4 \\ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.5 Basic Typography Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.5.1 \i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.5.2 \b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.5.3 \u . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.5.4 \s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.5.5 \fn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.5.6 \fe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.5.7 \fs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.5.8 \bord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.5.9 \shad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.5.10 \bordstyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.6 Font Scaling Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.6.1 \fsc, \fscx, \fscy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.6.2 \fsp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.6.3 \fsvp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.7 Colouring Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.7.1 \$c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.7.2 \$a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.8 Positioning and Rotation Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.8.1 \left, \right, \top, \bottom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.8.2 \an, \ax, \ay, \nx, \ny . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.8.3 \rel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.8.4 \vertical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.8.5 \q . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.8.6 \pos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.8.7 \org . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.8.8 \bls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.8.9 \frx, \fry, \frz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.8.10 \fax, \fay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.9 Animation Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.9.1 \fad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1
3.9.2 \t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.10 Shape Transformation Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.10.1 \distort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.10.2 \baseline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.10.3 \blpos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.11 Rastering Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.11.1 \$vc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.11.2 \$blend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.11.3 \clip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.11.4 \iclip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.11.5 \$blur . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.12 Advanced Typography Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4 Renderer Behaviour Specification 25
5 Container Multiplexing Specification 26
5.1 Matroska . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
References 27
2
1 Abstract
This document specifies the AS5 Subtitle Format, developed jointly by the Aegisub[1] and asa[2] teams
in order to replace the old Sub Station Alpha[3] subtitle format and its extensions:
• Advanced Sub Station Alpha (ASS) implemented by Gabest in VSFilter[5]
• Advanced Sub Station Alpha 2 (ASS2), also implemented by Gabest in VSFilter
• Advanced Sub Station Alpha 3 (ASS3) implemented by equinox in asa.
The goal is to create a flexible, easy to understand and powerful subtitle format that can be used in
hardsubs or multiplexed into Matroska Video[7] files as softsubs. The syntax is heavily influenced by
the older SSA and ASS formats, which in turn vaguely resemble the TeX typesetting language; but AS5
also has many differences compared to these older formats and you should not expect it to behave
exactly like them.
AS5 has no official meaning. The “A” can stand for Aegisub, asa, ASS or Advanced, the “S” for Subtitles,
and the 5 is a reference to the fact that it’s a major improvement over SSA4 format (from which ASS,
ASS2 and ASS3 derive). The full name of the format is “AS5 Subtitle Format”.
3
2 AS5 Files
2.1 File Format
All AS5 files are REQUIRED to comply with the three requirements below:
• Be encoded with one of UTF-8[8], UTF-16 Big Endian [9] or UTF-16 Little Endian Unicode Trans-
formation Formats. UTF-8 is preferred.
• Not to have any character below Unicode code point U+20, except for U+09, U+0A, U+0D.
That is, it must be a plain-text file.
• All lines must end with Windows line endings, that is, U+0D followed by U+0A.
These requirements are important so the AS5 format can be edited in most plain-text editors across
most operating systems and languages without problems. The character set of a subtitle file can be
autodetermined by its Byte-Order Mark or by the value of the first two bytes. See below.
When used as a standalone file, the extension should be .AS5. When multiplexed into a Matroska
container, the Codec ID used is S TEXT/AS5.
TODO: Get clearance from the Matroska team to use that Codec ID.
2.2 File Structure
The file is divided in sections, which are uniquely identified by a string inside square brackets, in a line
of its own. From that point on, every next line is considered to be part of the last found section until
another section is found. There is no end-of-section termination mark; they always end at the start
of the next one or at the end of the file. There MUST only be one and only one of each section; if the
parser finds two lines containing the same section header, it MUST reject the file as invalid. Section
names are case sensitive.
Each section is divided in lines, each line representing one command or definition. Empty lines (that is,
lines only containing a line ending) MUST be ignored by the parser. It is recommended that programs
generating AS5 files insert a blank line at the end of each section to increase readability. There MUST
always be a blank line at the end of the file (as every line is required to end in a line break).
Each line in a section takes the general form of Type: data1,data2,...,dataN. An unknown Type MUST
be ignored by a parser. Subtitle editing programs SHOULD keep such ignored lines in the file after
re-saving it. Note that the space after the colon is mandatory.
There are two sections which are required, [AS5] and [Events], the former being the equivalent of
[Script Info] in previous formats. If either of those sections is missing, the file is invalid and MUST be
rejected by the parser. Any other section can be ommitted from the file, and need not be implemented
by all parsers.
Finally, there is a special type of undefined group, [Private:PROGNAME], which MUST be ENTIRELY
preserved by other programs when re-saving it. This is used to store program-specific data. For
example, Aegisub would create a group called [Private:Aegisub] to store its data inside. This type of
group is identified by the fact that it starts with “[Private:”.
4