2007-07-10 05:06:41 +02:00
|
|
|
\documentclass{spec}
|
2007-07-10 08:59:03 +02:00
|
|
|
\usepackage[pdftex]{graphicx}
|
2007-07-10 05:06:41 +02:00
|
|
|
\newcommand{\syntax}[1]{
|
|
|
|
|
|
|
|
\subsubsection*{Syntax}
|
|
|
|
|
|
|
|
\begin{tabbing}
|
|
|
|
|
|
|
|
\hspace{2cm}\=\\[-16pt]
|
|
|
|
|
|
|
|
#1
|
|
|
|
|
|
|
|
\end{tabbing}
|
|
|
|
|
|
|
|
}
|
|
|
|
\newcommand{\secspec}[1]{Section:\>\texttt{#1}}
|
|
|
|
\newcommand{\secspecs}[2]{Sections:\>\texttt{#1}, \texttt{#2}}
|
2007-07-10 08:59:03 +02:00
|
|
|
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
|
2007-07-10 05:06:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
\begin{document}
|
|
|
|
\title{AS5 Subtitle Format Draft}
|
|
|
|
\author{Rodrigo Braz Monteiro, Niels Martin Hansen, David Lamparter}
|
2007-07-10 08:59:03 +02:00
|
|
|
|
|
|
|
\begin{titlepage}
|
|
|
|
\begin{center}
|
|
|
|
|
|
|
|
\vspace*{3cm}
|
|
|
|
|
|
|
|
\HRule \\[0.5cm]
|
|
|
|
\textsc{\huge AS5 Subtitle Format}\\
|
|
|
|
\HRule \\[1.1cm]
|
|
|
|
{\large By Rodrigo Braz Monteiro, Niels Martin Hansen and David Lamparter}\\[0.3cm]
|
|
|
|
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.\\
|
|
|
|
\vfill
|
|
|
|
|
|
|
|
\begin{minipage}{0.4\textwidth}
|
|
|
|
\begin{flushleft} \large
|
|
|
|
\includegraphics[width=0.7\textwidth]{./aegisub}
|
|
|
|
\end{flushleft}
|
|
|
|
\end{minipage}
|
|
|
|
\begin{minipage}{0.4\textwidth}
|
|
|
|
\begin{flushright} \large
|
|
|
|
\includegraphics[width=0.6\textwidth]{./asa}
|
|
|
|
\end{flushright}
|
|
|
|
\end{minipage}\\[1.5cm]
|
|
|
|
|
|
|
|
{\large \today}
|
|
|
|
|
|
|
|
\end{center}
|
|
|
|
\end{titlepage}
|
|
|
|
|
|
|
|
\setlength{\parskip}{0pt}
|
|
|
|
\tableofcontents
|
|
|
|
\newpage
|
|
|
|
\setlength{\parskip}{8pt}
|
2007-07-10 05:06:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
\section{Abstract}
|
2007-07-10 06:36:37 +02:00
|
|
|
This document specifies the \emph{AS5 Subtitle Format}, developed jointly by the
|
2007-07-10 05:06:41 +02:00
|
|
|
Aegisub\cite{Aegisub} and asa\cite{asa} teams in order to replace the old
|
|
|
|
\emph{Sub Station Alpha}\cite{SSA} subtitle format and its extensions:
|
|
|
|
|
|
|
|
\begin{itemize}
|
2007-07-10 06:36:37 +02:00
|
|
|
\item Advanced Sub Station Alpha (ASS) implemented by Gabest in VSFilter\cite{VSFilter}
|
|
|
|
\item Advanced Sub Station Alpha 2 (ASS2), also implemented by Gabest in VSFilter
|
|
|
|
\item Advanced Sub Station Alpha 3 (ASS3) implemented by equinox in asa.
|
2007-07-10 05:06:41 +02:00
|
|
|
\end{itemize}
|
|
|
|
|
|
|
|
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\cite{mkv} files as
|
|
|
|
softsubs.
|
|
|
|
|
2007-07-11 03:41:44 +02:00
|
|
|
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
|
2007-07-10 06:36:37 +02:00
|
|
|
improvement over SSA4 format (from which ASS, ASS2 and ASS3 derive). The full
|
2007-07-11 03:41:44 +02:00
|
|
|
name of the format is ``AS5 Subtitle Format''.
|
2007-07-10 06:36:37 +02:00
|
|
|
|
2007-07-10 05:06:41 +02:00
|
|
|
|
2007-07-11 03:41:44 +02:00
|
|
|
\newpage
|
2007-07-10 08:59:03 +02:00
|
|
|
\section{AS5 Files}
|
2007-07-10 05:06:41 +02:00
|
|
|
\subsection{File Format}
|
|
|
|
All AS5 files are \emph{REQUIRED} to comply with the three requirements below:
|
|
|
|
|
|
|
|
\begin{itemize}
|
|
|
|
\item Be encoded with one of \emph{UTF-8}\cite{UTF-8}, \emph{UTF-16 Big Endian}
|
|
|
|
\cite{UTF-16} or \emph{UTF-16 Little Endian} Unicode Transformation Formats. UTF-8 is
|
|
|
|
preffered.
|
|
|
|
\item 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.
|
|
|
|
\item All lines must end with Windows line endings, that is, U+0D followed by U+0A.
|
|
|
|
\end{itemize}
|
|
|
|
|
2007-07-11 03:41:44 +02:00
|
|
|
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 \textsc{.as5}. When multiplexed
|
|
|
|
into a Matroska container, the Codec ID should be \textsc{S\_TEXT/AS5}.
|
|
|
|
|
|
|
|
\todo{Get clearance from the Matroska team to use that Codec ID.}
|
2007-07-10 05:06:41 +02:00
|
|
|
|
2007-07-10 08:59:03 +02:00
|
|
|
|
2007-07-10 05:06:41 +02:00
|
|
|
\subsection{File Structure}
|
|
|
|
The file is divided in \emph{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.
|
2007-07-10 06:36:37 +02:00
|
|
|
\emph{Section names are case sensitive.}
|
2007-07-10 05:06:41 +02:00
|
|
|
|
2007-07-10 05:29:54 +02:00
|
|
|
Each section is divided in lines, each line representing one command or definition. Empty
|
2007-07-11 00:09:13 +02:00
|
|
|
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).
|
2007-07-10 05:29:54 +02:00
|
|
|
|
|
|
|
Each line in a section takes the general form of \textit{Type: data1,data2,...,dataN}. An
|
2007-07-11 00:09:13 +02:00
|
|
|
unknown \textit{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 \emph{mandatory}.
|
2007-07-10 05:29:54 +02:00
|
|
|
|
2007-07-10 06:36:37 +02:00
|
|
|
There are two sections which are required, \emph{[AS5]} and \emph{[Events]}, the former being
|
|
|
|
the equivalent of \emph{[Script Info]} in previous formats. If either of those sections is
|
2007-07-11 00:09:13 +02:00
|
|
|
missing, the file is invalid and \emph(MUST) be refused by the parser. Any other section
|
2007-07-10 05:29:54 +02:00
|
|
|
can be ommitted from the file, and need not be implemented by all parsers. However, any unknown
|
2007-07-10 08:59:03 +02:00
|
|
|
section \must\ be preserved in the file by a subtitle editing program when it re-saves a
|
2007-07-10 05:29:54 +02:00
|
|
|
file with sections that it does not recognize. It can, however, be removed at the user's discretion.
|
|
|
|
|
|
|
|
Finally, there is a special type of undefined group, \emph{[Private:PROGNAME]}, which
|
2007-07-10 08:59:03 +02:00
|
|
|
\must\ be \emph{ENTIRELY} preserved by other programs when re-saving it. This is used to
|
2007-07-11 00:09:13 +02:00
|
|
|
store program-specific data. For example, Aegisub would create a group called
|
2007-07-10 05:29:54 +02:00
|
|
|
\emph{[Private:Aegisub]} to store its data inside. This type of group should be identified
|
2007-07-11 03:41:44 +02:00
|
|
|
by the fact that it starts with \emph{``[Private:''}.
|
|
|
|
|
|
|
|
Note that \emph{Format:} lines from the previous formats are not admitted in AS5. If the parser
|
|
|
|
finds any of them, it \must\ halt parsing.
|
2007-07-10 05:29:54 +02:00
|
|
|
|
2007-07-11 00:09:13 +02:00
|
|
|
The sections \may\ be written in any order, with the exception of the \emph{[AS5]} section which
|
|
|
|
\must\ always be the first section.
|
2007-07-10 08:59:03 +02:00
|
|
|
|
2007-07-10 05:06:41 +02:00
|
|
|
\subsubsection{[AS5]}
|
2007-07-11 00:09:13 +02:00
|
|
|
This \must\ be the first section in every AS5 file. If the very first line of the file is not
|
2007-07-10 08:59:03 +02:00
|
|
|
[AS5], the file \must\ be rejected by the parser as invalid. Note, however, that the first
|
2007-07-10 05:06:41 +02:00
|
|
|
line is allowed to contain a Byte-Order Mark (BOM), which is the character U+FEFF encoded in
|
2007-07-10 05:29:54 +02:00
|
|
|
the encoding used for the rest of the script\cite{Unicode BOM}. The first four bytes will therefore be:
|
2007-07-10 05:06:41 +02:00
|
|
|
|
|
|
|
\begin{itemize}
|
|
|
|
\item 0xEF 0xBB 0xBF 0x5B - UTF-8 (with BOM)
|
|
|
|
\item 0x5B 0x41 0x53 0x53 - UTF-8 (without BOM)
|
|
|
|
\item 0xFF 0xFE 0x5B 0x00 - UTF-16 LE (with BOM)
|
|
|
|
\item 0x5B 0x00 0x41 0x00 - UTF-16 LE (without BOM)
|
|
|
|
\item 0xFE 0xFF 0x00 0x5B - UTF-16 BE (with BOM)
|
|
|
|
\item 0x00 0x5B 0x00 0x41 - UTF-16 BE (without BOM)
|
|
|
|
\end{itemize}
|
|
|
|
|
2007-07-10 05:29:54 +02:00
|
|
|
It is possible, therefore, to determine the encoding of the file by checking its first two bytes.
|
|
|
|
|
2007-07-10 06:36:37 +02:00
|
|
|
This section is used to declare several script properties that affect its parsing and rendering.
|
|
|
|
All properties are stored in the format \textit{Name: data}, with one property per line.
|
2007-07-10 08:59:03 +02:00
|
|
|
This section \must\ always declare the following properties:
|
2007-07-10 06:36:37 +02:00
|
|
|
|
|
|
|
\begin{itemize}
|
|
|
|
\item ScriptType: Should always be set to \textit{AS5}, for this particular version of the specification.
|
2007-07-10 08:59:03 +02:00
|
|
|
If this contains a value that the parser does not understand, it \must\ abort parsing.
|
2007-07-10 06:36:37 +02:00
|
|
|
\item Resolution: Should contain the script resolution in \textit{WxH} format. For example, for a 640x480
|
2007-07-11 03:41:44 +02:00
|
|
|
script, this should say \textit{``Resolution: 640x480''}. Note that this does not need to correspond to the
|
2007-07-10 08:59:03 +02:00
|
|
|
video resolution, however, subtitles \must\ be rendered on such a coordinate space. That is, in a
|
2007-07-10 06:36:37 +02:00
|
|
|
640x480 script, \textbackslash{pos(320,240)} always represents the center of the script, no matter the
|
|
|
|
resolution of the video it's being drawn on. Also, in a 100x100 script, a radius 50 circle centered on
|
|
|
|
the center will always take half of the height and half of the width of the video, even if that means
|
2007-07-11 00:09:13 +02:00
|
|
|
being distorted if drawn on a video with a non-1:1 aspect ratio (for example, a 640x480 video).
|
2007-07-10 06:36:37 +02:00
|
|
|
\end{itemize}
|
|
|
|
|
2007-07-11 00:09:13 +02:00
|
|
|
The following items \may\ also be used; they are not required, but are recommended. They all have default values:
|
2007-07-10 06:36:37 +02:00
|
|
|
|
|
|
|
\begin{itemize}
|
2007-07-11 03:41:44 +02:00
|
|
|
\item Generator: The name of the program that generated this script, e.g. \textit{``Generator: Aegisub''}.
|
2007-07-10 06:36:37 +02:00
|
|
|
Default value is empty. This should be ignored by the renderer, but might be useful for inter-editing-program
|
|
|
|
interaction.
|
2007-07-11 03:41:44 +02:00
|
|
|
\item Wrapping: The line wrapping style. This can be ``Manual'', in which case only \textbackslash{n} can
|
|
|
|
break lines or ``Automatic'', in which the renderer chooses how to break them. The default is ``Automatic''.
|
2007-07-10 06:36:37 +02:00
|
|
|
Note that if this is set to manual, the line can NEVER be broken at anywhere other than forced line breaks,
|
|
|
|
even if it means that the line will become unreadable because it goes outside the display area.
|
2007-07-10 08:59:03 +02:00
|
|
|
\item Extensions: A comma-separated list of all extensions being used in this file. At the moment, there are
|
|
|
|
no extensions available. Renderers should read this to enable any extensions that they might support.
|
|
|
|
Editing programs \must\ keep this field intact, unless the user chooses otherwise. Scripts WILL break
|
|
|
|
if the list of extensions is suddenly lost.
|
2007-07-11 00:09:13 +02:00
|
|
|
\item Credits: Credits for the people who worked on this subtitle file. Purely for informational purposes and
|
|
|
|
\should\ be ignored by the renderer. Subtitling programs \should\ be able to display these credits to the user.
|
|
|
|
\item Title: The title of this script. Purely for informational purposes and \should\ be ignored by the renderer.
|
|
|
|
Subtitling programs \should\ be able to display this title to the user.
|
2007-07-10 06:36:37 +02:00
|
|
|
\end{itemize}
|
|
|
|
|
2007-07-11 00:09:13 +02:00
|
|
|
Unlike in the previous incarnations of the format, storing private data here is not allowed, which means
|
|
|
|
that this section \must not\ contain any properties not listed here. Any application-specific or otherwise
|
|
|
|
private data \must\ be stored in \textit{[Private:PROGNAME]} groups instead, as mentioned above.
|
2007-07-10 06:36:37 +02:00
|
|
|
|
2007-07-10 08:59:03 +02:00
|
|
|
|
2007-07-10 06:36:37 +02:00
|
|
|
\subsubsection{[Events]}
|
|
|
|
|
2007-07-11 03:41:44 +02:00
|
|
|
The most important section, [Events], lists all the actual subtitle lines in the file. The syntax has
|
|
|
|
been radically simplified from previous incarnations of the format, and now consist of only five fields.
|
|
|
|
Each line is represented as:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
Line: start,end,style,user,content
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
Where:
|
2007-07-10 06:36:37 +02:00
|
|
|
|
|
|
|
\begin{itemize}
|
|
|
|
\item Start: The start time of the line. See below for the timestamp format. A line is only displayed if
|
|
|
|
the timestamp of the current frame is \emph{greater than or equal} to the start time. That is, start
|
|
|
|
time is \emph{inclusive}.
|
|
|
|
\item End: The end time of the line. It follows the same format as the start time. The line is only
|
|
|
|
displayed if the timestamp of the current frame is \emph{lesser than} the end time. That is, end time is
|
|
|
|
\emph{exclusive}. In particular, it means that a line whose start time is equal to its end time will
|
2007-07-11 00:09:13 +02:00
|
|
|
never be displayed. If the end time is earlier than the start time, the renderer \may\ issue a warning,
|
|
|
|
but it \should\ render the remaining lines regardless of the issue.
|
|
|
|
\item Style: The name of the default style used for this line. See the [Style] section below. If left blank,
|
|
|
|
the script's global default style \must\ be used. If an unknown style name is specified, the renderer \must\
|
|
|
|
fallback to default, and \may\ issue a warning.
|
2007-07-10 06:36:37 +02:00
|
|
|
\item User: This field is used by the program to store program-specific data in each line. Renderers
|
2007-07-11 00:09:13 +02:00
|
|
|
\should\ ignore this (but \may\ use it for application-specific extension features). This field \should\
|
|
|
|
be left blank if it's not used. Note that whatever data is stored here \must not\ contain any commas!
|
2007-07-10 06:36:37 +02:00
|
|
|
\item Content: The actual text of the line. This contains actual text and override tags. See the section
|
|
|
|
on override tags for more information.
|
|
|
|
\end{itemize}
|
|
|
|
|
|
|
|
The timestamp format is h...h:mm:ss[.s...], that is, it begins with an integer of arbitrary length
|
2007-07-10 08:59:03 +02:00
|
|
|
(up to a maximum of 4 digits) representing the number of hours, followed by a one-digit or two-digit integer
|
2007-07-11 00:09:13 +02:00
|
|
|
representing minutes, and a floating point number representing seconds. Leading zeroes in the hours field \may\
|
2007-07-11 03:41:44 +02:00
|
|
|
be ommitted. Localization is irrelevant: a period (``.'') is always used to separate the decimal point.
|
2007-07-11 00:09:13 +02:00
|
|
|
This way, 0:21:42.5 and 0000:21:42.5000 are equivalent, and both represent 0 hours, 21 minutes, 42 seconds
|
|
|
|
and 500 miliseconds.
|
2007-07-10 06:36:37 +02:00
|
|
|
|
2007-07-10 08:59:03 +02:00
|
|
|
Spaces between each field \must\ be ignored by all parsers. Any spaces at the beginning of the
|
2007-07-11 00:09:13 +02:00
|
|
|
content line \should\ be stripped by any editing program. A hard space (see the overrides section) or empty
|
|
|
|
override block should be used if space at the start of a line is truly desirable. That is, the two
|
|
|
|
following lines are syntactically identical:
|
2007-07-10 06:36:37 +02:00
|
|
|
|
|
|
|
\begin{verbatim}
|
2007-07-10 08:59:03 +02:00
|
|
|
Line: 0:2:31.57 , 0:02:34.22 , , , Hello world of {\b1}AS5{\b0}!
|
|
|
|
Line: 0:02:31.570,00:02:34.22,,,Hello world of {\b1}AS5{\b0}!
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
|
|
|
|
\subsubsection{[Styles]}
|
|
|
|
|
|
|
|
This is equivalent to the \emph{[V4 Styles]} (and subsequent variations) from the Sub Station Alpha format.
|
2007-07-11 03:41:44 +02:00
|
|
|
Like \emph{[Events]}, it has been greatly simplified when compared to the previous formats, and now
|
|
|
|
each entry contains only three fields. They are declared as:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
Style: name,parent,overrides
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
Where:
|
2007-07-10 08:59:03 +02:00
|
|
|
|
|
|
|
\begin{itemize}
|
|
|
|
\item Name: The name of this style. Style names are not case-sensitive, but \must\ be unique. A
|
2007-07-11 03:41:44 +02:00
|
|
|
script with conflicting style names \must\ be rejected by the parser. If the style name is ``Default'', it
|
|
|
|
will be used for all lines that omit the style name. If there is no ``Default'' line, the renderer
|
2007-07-10 08:59:03 +02:00
|
|
|
default is used.
|
|
|
|
\item Parent: The style from which the current style derives from. See below for more information.
|
|
|
|
Leaving this field blank means that the style derives from the renderer's default style.
|
|
|
|
\item Overrides: A list of override tags to define this style. See below.
|
|
|
|
\end{itemize}
|
|
|
|
|
|
|
|
Styles work in a very different way from the way they did on previous formats (with the notable exception
|
2007-07-11 03:41:44 +02:00
|
|
|
of ASS3, which actually implements this very same style based on this format, as ``StyleEx'').
|
2007-07-10 08:59:03 +02:00
|
|
|
Instead of setting multiple parameters across many commas, you simply specify override tags. When a line
|
|
|
|
uses a style, it's as if the overrides of the style were inserted right before the start of the line
|
|
|
|
contents.
|
|
|
|
|
|
|
|
Also, a style can inherit from another style, and define new overrides which are then appended to those
|
|
|
|
of the parent style. The parent style \must\ have been declared \emph{BEFORE} the style trying to use
|
|
|
|
it as a parent. If the parent doesn't exist or wasn't declared yet, the parser must refuse to parse the
|
2007-07-11 03:41:44 +02:00
|
|
|
script. This is important because otherwise you could get a ``inheritance loop'', where styles derive from
|
2007-07-10 08:59:03 +02:00
|
|
|
each other in a cycle.
|
|
|
|
|
|
|
|
For example, see the following \emph{[Styles]} group:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
[Styles]
|
|
|
|
Style: Default,,\fn(Arial)\fs20
|
|
|
|
Style: Speech,,\fn(Respublica)\fs24\bord2\shad2\4a#80\2c#000000
|
|
|
|
Style: Actor1,Speech,\1c#B9C5E3
|
|
|
|
Style: Actor2,Speech,\1c#FFB3CF
|
|
|
|
Style: UglinessItself,Default,\fn(Comic Sans MS)
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
In the above fragment, the first style defines the Default style that will be used on all lines that
|
|
|
|
don't set any style and the second style defines a base speech style that will be used for all actors
|
|
|
|
(note that it doesn't inherit from Default, even though Default overrode the renderer's default, that
|
|
|
|
one is still used for style definitions).
|
|
|
|
|
|
|
|
The third and fourth styles are based on the second, and simply assign different colours to it. They
|
|
|
|
will both have all properties of Speech, and only differ in primary colour. Finally, the last example
|
|
|
|
shows how to derive from the overriden default. In this case, font size would be 20 points, regardless
|
|
|
|
of renderer's default.
|
|
|
|
|
|
|
|
The two Actor styles could have been defined without a parent style as follows:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
[Styles]
|
|
|
|
Style: Actor1,,\fn(Respublica)\fs24\bord2\shad2\4a#80\2c#000000\1c#B9C5E3
|
|
|
|
Style: Actor2,,\fn(Respublica)\fs24\bord2\shad2\4a#80\2c#000000\1c#FFB3CF
|
2007-07-10 06:36:37 +02:00
|
|
|
\end{verbatim}
|
2007-07-10 05:29:54 +02:00
|
|
|
|
2007-07-10 08:59:03 +02:00
|
|
|
Since all that deriving a style from another does is append the new tags to the end of the previous,
|
|
|
|
this way of declaring styles is identical to the one above, but is more verbose.
|
2007-07-10 05:29:54 +02:00
|
|
|
|
2007-07-11 00:09:13 +02:00
|
|
|
If no Default style is defined, the renderer \must\ choose its own defaults to render the text with.
|
2007-07-11 03:41:44 +02:00
|
|
|
These are entirely arbitrary and can be set to anything, but the renderer \should\ let the user set
|
|
|
|
his own defaults. A simple Sans-Serif font with white text and black borders is recommended.
|
|
|
|
|
|
|
|
|
|
|
|
\subsubsection{[Resources]}
|
|
|
|
|
|
|
|
The new \emph{[Resources]} section can be used to store information on external file resources,
|
|
|
|
such as images and fonts. The general syntax is:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
Resource: type,name,path
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
Where:
|
|
|
|
|
|
|
|
\begin{itemize}
|
|
|
|
\item Type: Must be either ``font'' or ``image''. Any other types \must\ be ignored by the parser.
|
|
|
|
\item Name: An unique name identifying this resource. For fonts, it must correspond to the font
|
|
|
|
name, e.g., ``Verdana''. For images, it's the name that the file will be reffered as in the rest
|
|
|
|
of the script. If there is already a resource with this same name, the parser \must\ abort the
|
|
|
|
parsing.
|
|
|
|
\item Path: The location of the file relative to the subtitles. This \must\ be a relative path
|
|
|
|
for external .as5 files, or a container-specific string for AS5 multiplexed into a container.
|
|
|
|
The relative path \must\ use forward slashes and be case-sensitive, in order to avoid UNIX
|
|
|
|
compatibility issues.
|
|
|
|
\end{itemize}
|
|
|
|
|
|
|
|
|
|
|
|
\newpage
|
|
|
|
\section{Style Overrides}
|
|
|
|
|
|
|
|
\subsection{General Information on Override Tags}
|
|
|
|
As with previous formats, AS5 uses override tags to set the style for lines. Also, it uses those
|
|
|
|
same tags to set style definitions themselves (see above). Although many tags were imported from
|
|
|
|
\emph{Advanced Sub Station Alpha}, do not assume that they behave exactly the same. Some had their
|
|
|
|
behavior changed or properly defined. Also, AS5 defines many new tags in addition to the old ones.
|
|
|
|
|
|
|
|
All tags must be inserted between a pair of curly brackets (\emph{\{\}}), except on style definitions.
|
|
|
|
A pair can contain any number of override tags inside it. They should be listed one after the other,
|
|
|
|
with no spaces or any other kind of separator between them. Tags then affect all text that follows
|
|
|
|
it, unless re-overriden or reset by the \emph{\textbackslash r} tag. For example:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
{\fn(Verdana)\fs26\c#FFA040}Welcome to {\b1}AS5{\b0}!
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
In the following example, the first override block affects the entire text, but only ``AS5'' is bolded.
|
|
|
|
|
|
|
|
Some tags might begin with a \# in their names. This means that there are actually five variations
|
|
|
|
of this specific tag, the tag with \# replaced with a number from \emph{1} to \emph{4} (inclusive)
|
|
|
|
or without it altogether - in that case, the tag is assumed to mean the \emph{1} variation. Those
|
|
|
|
numbers represent the four different colours available on any given line:
|
|
|
|
|
|
|
|
\begin{itemize}
|
|
|
|
\item 1 - Primary colour, used for the main face of the text.
|
|
|
|
\item 2 - Secondary colour, used on karaoke. See the karaoke tags for more information.
|
|
|
|
\item 3 - Border colour. This is the colour of the border that outlines the text. See the \textbackslash
|
|
|
|
bord tag for more information.
|
|
|
|
\item 4 - Shadow colour. This is the colour of the shadow dropped by the text. See the \textbackslash
|
|
|
|
shad tag for more information.
|
|
|
|
\end{itemize}
|
|
|
|
|
|
|
|
So, for example, you would use \textbackslash 1c or \textbackslash c to set the primary colour, or
|
|
|
|
\textbackslash 3c to set the colour of the border. \textbackslash \#c, however, does not exist in
|
|
|
|
itself.
|
|
|
|
|
|
|
|
When a tag requires a floating point parameter, the decimal part must be specified using a period (.);
|
|
|
|
never a comma. When a tag requires a colour parameter, it is given in HTML hexadecimal code, which is
|
|
|
|
\# followed by a 6-digit hexadecimal string, where the first two digits represent the red component,
|
|
|
|
the next two the green component, and the last two the blue component (\#RRGGBB). Sub Station Alpha
|
|
|
|
style (Visual Basic hexadecimal) is not supported - if a parser finds any colour in \&HBBGGRR\& format,
|
|
|
|
it \must\ issue an error.
|
|
|
|
|
|
|
|
|
|
|
|
\subsection{Sub Station Alpha Tags}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
|
|
|
|
\subsection{Advanced Sub Station Alpha Tags}
|
|
|
|
\todo{Write me}
|
|
|
|
|
2007-07-11 00:09:13 +02:00
|
|
|
|
2007-07-11 03:41:44 +02:00
|
|
|
\subsection{AS5 Property Tags}
|
|
|
|
These tags replace the old style and dialogue settings that were rarely used and generally only
|
|
|
|
made the file more verbose and harder to read.
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash left}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash right}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash top}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash bottom}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash bordstyle}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash effect}
|
|
|
|
\todo{Write me. Is this really desirable?}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash relative}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash vertical}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
|
|
|
|
\subsection{AS5 Distortion Tags}
|
|
|
|
These are tags characterized by the fact that they distort the shape of the text itself. They
|
|
|
|
were designed to enhance the flexibility of the format while dealing with unusually-shaped
|
|
|
|
imagery.
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash distort}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash baseline}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash bls}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash fsc}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash fay}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash fax}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
|
|
|
|
\subsection{AS5 Rastering Tags}
|
|
|
|
These tags affect how the subtitles are rasterized, that is, they affect things such as
|
|
|
|
colour, blurring, etc.
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash\#vc}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash{\#blend}}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash iclip}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
\subsubsection{\textbackslash blur}
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
|
|
|
|
\subsection{AS5 Advanced Tags}
|
|
|
|
These are more advanced tags, which might prove to be fairly complex to implement. They include
|
|
|
|
things such as ruby text support (also known as furigana, when used with Japanese Kanji).
|
|
|
|
|
|
|
|
\todo{Write me}
|
|
|
|
|
|
|
|
|
|
|
|
\newpage
|
|
|
|
\section{Renderer Behaviour Specification}
|
|
|
|
\todo{Write this section}
|
|
|
|
|
|
|
|
|
|
|
|
\newpage
|
|
|
|
\section{Container Multiplexing Specification}
|
|
|
|
|
|
|
|
\subsection{Matroska}
|
|
|
|
Storage of AS5 files in Matroska files is similar to how similar formats are stored.\cite{mkv ssa}
|
|
|
|
The Codec ID used is \textsc{S\_TEXT/AS5}
|
|
|
|
|
|
|
|
First, the entire file is converted to UTF-8 (if it isn't already UTF-8). Then, all sections other
|
|
|
|
than \emph{[Events]} and \emph{[Resources]} are stored on the \emph{CodecPrivate} element. For the
|
|
|
|
\emph{[Resources]} section, each line is parsed and files are converted to Matroska file attachments.
|
|
|
|
\todo{Specify this more clearly.}
|
|
|
|
|
|
|
|
Finally, each line in the \emph{[Events]} section is read and stored each in a block. The \emph{start}
|
|
|
|
and \emph{end} fields are parsed (see the specifications on the section describing [Events]) and set
|
|
|
|
as the \emph{TimeStamp} and \emph{BlockDuration} elements. The line itself is then stored in the
|
|
|
|
following format:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
Line: readOrder,style,userData,contents
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
Where \emph{readOrder} is the number that the line had on the file. This is necessary so the file
|
|
|
|
can be demultiplexed back in its original order, since lines will be stored in chronological order
|
|
|
|
while inside the Matroska file. The remaining fields should just be copied from the original line.
|
|
|
|
|
|
|
|
|
|
|
|
\newpage
|
2007-07-10 05:06:41 +02:00
|
|
|
\addcontentsline{toc}{section}{References}
|
|
|
|
\begin{thebibliography}{1}
|
|
|
|
|
|
|
|
\bibitem{Aegisub} Rodrigo Braz Monteiro, Niels Martin Hansen, David Lamparter et al., Aegisub. Application, 2005-2007.\\
|
|
|
|
\url{http://www.aegisub.net/}
|
|
|
|
|
|
|
|
\bibitem{asa} David Lamparter, asa. Application, 2004-2007.\\
|
|
|
|
\url{http://asa.diac24.net/}
|
|
|
|
|
|
|
|
\bibitem{SSA} Kotus, Sub Station Alpha. Website, 1997-2003.\\
|
|
|
|
\url{http://web.archive.org/web/*/http://www.eswat.demon.co.uk/substation.html}
|
|
|
|
|
|
|
|
\bibitem{ASS} \#Anime-Fansubs, Advanced Sub Station Alpha.\\
|
|
|
|
\url{http://www.anime-fansubs.org}\\
|
|
|
|
\url{http://moodub.free.fr/video/ass-specs.doc}
|
|
|
|
|
|
|
|
\bibitem{VSFilter} Gabest, VSFilter. Application, 2003-2007.\\
|
|
|
|
\url{http://sourceforge.net/projects/guliverkli/}
|
|
|
|
|
|
|
|
\bibitem{ASS3} David Lamparter, Advanced Sub Station Alpha 3. Website, 2007.\\
|
|
|
|
\url{http://asa.diac24.net/ass3.pdf}
|
|
|
|
|
2007-07-11 03:41:44 +02:00
|
|
|
\bibitem{mkv} The Matroska project. Website.\\
|
2007-07-10 05:06:41 +02:00
|
|
|
\url{http://www.matroska.org/}
|
|
|
|
|
2007-07-11 03:41:44 +02:00
|
|
|
\bibitem{UTF-8} The Internet Society, RFC 3629, ``UTF-8, a transformation format of ISO 10646''. Website, 2003.\\
|
2007-07-10 05:06:41 +02:00
|
|
|
\url{http://tools.ietf.org/html/rfc3629}
|
|
|
|
|
2007-07-11 03:41:44 +02:00
|
|
|
\bibitem{UTF-16} The Internet Society, RFC 2781, ``UTF-16, an encoding of ISO 10646''. Website, 2000.\\
|
2007-07-10 05:06:41 +02:00
|
|
|
\url{http://tools.ietf.org/html/rfc2781}
|
|
|
|
|
2007-07-10 05:29:54 +02:00
|
|
|
\bibitem{Unicode BOM} Unicode, Inc, The Unicode Standard, Chapter 13. PDF, 1991-2000.\\
|
|
|
|
\url{http://www.unicode.org/unicode/uni2book/ch13.pdf}
|
|
|
|
|
2007-07-11 03:41:44 +02:00
|
|
|
\bibitem{mkv ssa} The Matroska project, specification for SSA/ASS subtitle formats. Website.\\
|
|
|
|
\url{http://www.matroska.org/technical/specs/subtitles/ssa.html}
|
|
|
|
|
2007-07-10 05:06:41 +02:00
|
|
|
\end{thebibliography}
|
|
|
|
|
|
|
|
\end{document}
|