Professional Documents
Culture Documents
Readme
Readme
Timing
======
The post-decimal part of Sub Station Alpha timings are in hundredths of a
second, not pictures. Times in SMPTE format need to be modified before being
placed in an SSA script.
Although it is not recommended, you can place multiple dialogue events in
a script that have the same start time. The filter will handle them in the
order that they appear in the script, resolving collisions in favor of events
occurring earlier in the file.
SSA timing correction (ramping) is not supported. If you find SSA timing
corrections in an existing script, you will need to manually skew the timings
in the actual dialogue lines instead. (This assumes that the timings in the
script coincide with those in your video source, which is actually pretty
unlikely given the timing accuracy of consumer video and audio capture
devices.)
Positioning
===========
The subtitler filter is designed to properly render scripts that were
originally intended for subbing with a genlock, i.e. titles composed for
full screen rendering. As a result, it attempts to imitate SSA positioning
as closely as possible and then scales the result to the video window.
Although the SSA script format uses pixel values for positioning, subtitler
interprets these in terms of the original script's screen size. The screen
size is denoted by a PlayResY: header at the top of SSA version 4 scripts:
[Script Info]
; This is a Sub Station Alpha v4 script.
; For Sub Station Alpha info and downloads,
; go to http://www.eswat.demon.co.uk/
; or email kotus@eswat.demon.co.uk
Title: <untitled>
Original Script: <unknown>
Collisions: Normal
PlayResY: 480
PlayDepth: 0
Subtitler assumes a 5:4 aspect ratio for PlayResY:1024 (1280x1024)
and a 4:3 aspect ratio for all other resolutions. Font sizes are also scaled
down by the same factor as the margins. If PlayResY: is absent, as it will
be in version 2 scripts, the subtitler will instead interpret margins and
font sizes directly, which is probably not appropriate.
Text escapes
============
The following character pairs are specially interpreted by the subtitler:
\n soft return (manual wordwrap)
\N hard return
These are nonstandard and supported only by the subtitler:
\h nonbreakable space (160)
\! VirtualDub version string
\\ backslash
\{ open brace
Note that the filter will discard single backslashes that would begin
illegal escapes, whereas SSA displays them. This incompatibility is
intentional. SSA's handling of backslashes outside of style overrides makes
some text combinations impossible, such as actually displaying "\n." You
can do this with the filter with \\n.
Style overrides
===============
Text within braces {} is considered to be part of a style override; these
are used to modify the display of text by modifying parameters beyond what
the style would normally prescribe. Subtitler supports the following style
overrides:
\a Alignment {\a4}top
\b Bold {\b1}bold{\b0}
\c Color {\c&Hffff00;}cyan{\r}
\fs Font size {\fs100}big text
\fn Font name {\fnCourier}typewriter
\fe Font encoding {\fe2}l{\fe0} bulletted item
\i Italics {\i1}sit!!!!{\i0}
\k Karaoke {\k20}I {\k50}can't {\k50}sing
\K Smooth karaoke (extension) {\K100}AAAAAAAAAAaaaaaaaaa!!!!!
\q Wrap control (extension) {\q1}I like EigoAnim style.
\r Reset style overrides {\fs20}oops {\r}...aahhh...
See the SSA4 script format documentation for better descriptions of these
overrides. Text escape characters, such as \n, are not processed inside
of style override sets.
Font encodings
==============
By default, ANSI_CHARSET encoding is used unless overridden with the encoding
setting in the style or with the {\fe} override. You will need to specify
a different code page if the character you want is not in the standard
printable 8-bit set. Some useful encodings are:
ANSI_CHARSET 0
DEFAULT_CHARSET 1
SYMBOL_CHARSET 2
SHIFTJIS_CHARSET 128
HANGEUL_CHARSET 129
HANGUL_CHARSET 129
GB2312_CHARSET 134
CHINESEBIG5_CHARSET 136
OEM_CHARSET 255
Whether or not a given character set is available depends mainly on the font;
if you are running Windows NT/2000, Character Map can be used to check since
it supports Unicode on that platform. Arial in particular, supports a large
number of encodings. Note that a change in character set can result in a
change of font, if the current font doesn't support the encoding but another
font in the system does.
Double-check the subtitler's output if you are using a double-byte character
set (DBCS), such as Shift-JIS, since the word-wrapping hasn't been
extensively checked for DBCS compatibility although it should work fine.
Space alignment
===============
Adding spaces at the beginning or end of dialogue lines or around \N's to
push text on-screen won't work with the filter, since it trims whitespace off
the ends of each processed line during word wrapping. If you must force
space at the ends, use nonbreakable spaces (\h or Alt-0160). Spaces are not
collapsed in the middle of a line.
Alignment overrides
===================
Alignment overrides {\a} are supported, but multiple \a's in the same dialogue
line should be avoided. The reason is that SSA4 interprets multiple alignment
overrides differently in its full-screen renderer than in its preview window.
As a result,
abc{\a3}def{\a1}
renders on the left in the script editor and on the right onto tape. Subtitler
imitates the full-screen renderer and always uses the first alignment override
it finds.
It is not possible to use two alignments in the same subtitle -- the entire
subtitle always uses one particular alignment.
Antialiasing
============
Subtitler antialiases all fonts by default at an 8x8 setting, i.e. it renders
*all* glyphs at eight times normal size and reduces it down. The result is
crisp, high-quality text. You can turn off font antialiasing by disabling the
advanced rasterizer, but beware that a number of features will stop working if
you disable it: borders will be forced to one pixel, scrolls and banners will
not work, and no shadows will be drawn.
Karaoke
=======
Karaoke is the highlighting of text in response to a song, so that others can
sing along to it. Apply this feature with caution, since many people shouldn't
be allowed to sing in the first place.
Activate karaoke by specifying {\k} or {\K} style overrides in the text:
{\k50}This takes half a second {\K100}This takes a second
The number indicates the hundredths of seconds it should take to highlight the
text; {\k} snaps the text on like SSA, while {\K} gradually highlights from
the left. In both cases, text is changed from the secondary style color to
the active color, which is the primary style color unless overridden.
You do not need to ensure that the sum of the \k tags adds up to the event
length. If the total karaoke time is too short, the event will simply be
displayed fully highlighted for the remainder, and if it is too long, it is
cut off. The "Karaoke" event type in the dialogue line is also unnecessary,
so you may apply other events to the karaoke line if you wish and both effects
will take place.
A {\k0} or {\K0} tag acts as a brickwall to karaoke since it caps the end of
the last karaoke string and activates immediately to the primary color once
the time has passed. Subtitler tracks karaoke even in the same override, so
{\K50\K50} pauses for half a second and then runs the next string of text for
another half second.
Fast reload
===========
The subtitler always reloads the script whenever it is reinitialized by
VirtualDub, which is at the beginning of any preview or save, and after some
menu commands (mostly those that change the filter chain or input video).
This means that you can edit the script in SSA or Notepad, and see the changes
in the next preview without having to modify any settings.
Using Sub Station Alpha in wave timing mode to time against AVI
===============================================================
The most efficient way to create scripts for subtitler is to use SSA's wave
timing mode, which allows you to quickly generate script timings from a sound
file. You can create the wave file necessary to do this by copying it out
of the source video file in VirtualDub. However, the current version of
SSA at this time (4.08) does not accept stereo or 16-bit WAV files. To
generate a WAV file of the correct format:
* Change the audio mode to Full Processing Mode.
* Make sure the audio compression setting is set to PCM (uncompressed).
* In Audio > Conversion, select 8-bit and mono.
* Use File > Save WAV to create the WAV file.
You need to do this with the final video source and settings that you are
going to use to subtitle -- your range settings and cuts must be the same,
or the WAV file will not match the video fed into subtitler. VirtualDub
1.4.6 and earlier save both range settings and cuts into .vcf files, so
the Load/Save Processing Settings commands will allow you to preserve these
should you need to close VirtualDub between the Save WAV and final Save AVI
operations. Another way to handle this problem is to create a batch job
for the final process when you do the Save WAV -- subtitler will reload
the script from the specified filename when the job actually executes.
Incidentally, you can cut/copy/paste from dialogue text in SSA by right-
clicking on the text pane.
Saturated colors
================
Highly saturated colors such as deep red should be avoided, particularly if
you are going to output the result to composite video or compress the result
with a low-bandwidth codec. The reason is that sharp color edges are poorly
handled by the luminance/chrominance encoding in both cases. You will get
better results if you use less saturated colors and ensure that your border and
text colors are far apart in brightness; yellow on black is a popular choice,
and mild green is also used.
[V4 Styles]
===========
Subtitler determines whether a script is in SSA v2 or v4 format by the
presence of the [V4 Styles] group marker. The only difference in the
filter's behavior between V2 and V4 mode is that the BorderStyle entry in the
style is assumed to be absent in V2 mode, whereas it is skipped in V4 mode.
If you find that your outline, shadow, alignment, margins, and encoding
values in your style entries are being interpreted incorrectly, make sure
the [V4 Styles] marker is present above them.
Known issues
============
Due to a bug in VirtualDub 1.3d, this filter cannot be used in frameserver
mode with that version. The bug was first fixed in VirtualDub 1.4.
Special thanks to paQ, who found a number of bugs in earlier releases
and helped immensely in the development of this filter.
Contact
=======
Please email comments, bug reports, and suggestions to
<phaeron@virtualdub.org>. I can't guarantee that I'll be able to respond,
but I'll do what I can. The website for this filter is the same as the
VirtualDub website -- http://www.virtualdub.org/.
Have fun!
-- Avery Lee <phaeron@virtualdub.org>
March 3, 2002
Changelog
=========
Version 2.3:
* Fix for addressing error in rasterizer that caused all subtitles to be
off by one pixel, and the filter to occasionally crash. Thanks to gabest
for finding this one.
* Added some quick optimizations to the rasterizer to boost curve
rasterization speed -- basically, the old fist/fistp trick. Too lazy
to code a proper Bezier subdivision rasterizer.
----------------------------------
Version 2.2:
* Fix for crash on {...}\n construct.
* Fixed rasterizer to handle the case where a font outline has a linear
Bezier curve, i.e. the curve is actually a line, and avoid dividing by
zero.
----------------------------------
Version 2.1:
* Added workarounds for the limitations of 16-bit GDI, which caused severe
wordwrap and rasterization failures in some cases. Windows 95/98 sucks.
* Did some work to try to make the filter DBCS clean. Backslashes and
open braces are no longer interpreted in the trailing bytes of text when
DBCS encodings are active.
* You can now escape open braces (\{) to display them.
* All text is now converted to Unicode before display. This allows CJK text
to display on SBCS platforms with the appropriate IE support installed.
* Word wrap behavior is now adjustable on a per-item basis, and \n works
as a line break if word wrapping is disabled.
* Relaxed the syntax restrictions for time fields; in particular, the
0:00:00:00 syntax in the SSA script document is now allowed, even though
it's different from the 0:00:00.00 syntax used by SSA4. SSA itself doesn't
care what separators you use.
* Changed the ordering of fields in the Scroll Up effect to Scroll Up;d;y;y
to match SSA.
----------------------------------
Version 2.0:
* New antialiased font rasterizer working directly off of Bezier curve
outlines. Much, much faster and can support arbitrary rotation, scaling,
and shearing transforms, although these capabilities are not yet used.
* Added support for the Banner and Scroll up effects.
* Added karaoke. The hacks that people were forced to do for karaoke in
V1.3b were too embarrassingly bad for me to let this go.
* I accidentally disabled font caching in the last release. Whoops.
This only really speeds up the non-antialiased (i.e. sucky) mode,
so no big deal.
* Dialogue line sorting now checks the order lines are submitted to
break ties. Before, the sort was not stable, which meant that
two lines that had the same start time essentially appeared in
random order, and you couldn't tell which would end up on top
if the lines collided. Now, two events with the same start time
always issue to the collision handler in-order, so the second
event always collision resolves against the first.
* Font encodings other than ANSI_CHARSET are now supported thanks
to Karel Suhajda, both in styles and in the {\fe} style override.
The wordwrapping code is likely not DBCS clean, however, so this
may not work with some encodings like Shift-JIS. (I can't test
this, since both my computer and my brain are configured for US
English.)
----------------------------------
Fixed in version 1.3b:
* Fixed a critical smart wordwrapping problem. The smart wrapping works
by crunching the margins until an extra line drops out. If the
subtitler encountered a dialogue line like:
w\Nw\Nw
it hung in a loop because none of the lines would ever wrap. The
filter now stops smart wrapping when this occurs.
----------------------------------
Fixed in version 1.3a:
* Fixed some memory leaks and stability issues.
----------------------------------
Fixed in version 1.3:
* Style overrides did not always work properly, because subtitler skipped
too many characters after the first override.
* After word-wrapping, all lines from a dialogue line were left-justified
relative to each other, even though the whole was justified correctly.
* \n (soft break) was accepted as a line break, but \N (hard break) was
not.
* Outlines could overlap text if style overrides were used in between
non-whitespace characters (i.e. err{\i1}or).
----------------------------------
Fixed in version 1.2:
* Style name checking ignores leading *'s.
----------------------------------
Fixed in version 1.1:
* Subtitles work past one hour.