VSFilter (TextSub & VobSub)

Abstract

author: Gabest
version: 2.32
download: Project: guliverkli
category: Subtitle (source) Plugins
requirements:

Description

The format of the subtitles can be *.sub, *.srt, *.ssa, *.ass, etc. (ssa = Sub Station Alpha).

syntax: TextSub("C:\My Folder\MY subFile.XXX") or VobSub("C:\My Folder\MY subFile.XXX")

examples:

mpeg2source("F:\From_hell\from_hell.d2v")
VobSub("F:\From_hell\VTS_01_0.sub")
mpeg2source("F:\From_hell\from_hell.d2v")
TextSub("F:\From_hell\fh_ned.srt")

bug: You will see a small rectangle where the subs are put (if you look closely). More info can be found here.

remark: The package contains two dll's. The Unicode release can be used with W2k or higher, the other one is for W98 users (W98 doesn't support unicode natively).

More information (by Ernst Pechй)

SubRip

Subtitles on a DVD are saved as small pictures, not as text - but the TextSub filter needs a textfile.
They are all stored inside the VOB file, each language with a separate stream, you have to select the desired stream first.
Then you convert these pictures to plain text with the OCR (optical character recognition) of this tool.
You have to teach the program each character once (you can save these maps for later use) - it works really good, so you won't spend that much time.

There are many subtitle formats, but most do not contain formatting information.
So it is a good choice to use the "SSA" format, which contains the format in the file, too.

VSFilter.DLL

This contains the AviSynth TextSub function, which basically takes a textfile as input and paints the subtitles from this textfile on the video clip. It has the following quite simple syntax:
TextSub ("path\filename.ext" [,  charset [,  fps]])
So typically you only write

TextSub ("your_file.ssa")

Besides SSA (Sub Station Alpha) TextSub can deal with SRT (SubRip), SUB (MicroDVD), PSB (PowerDivx), SMI (SAMI), ASS (Advanced Substation Alpha).

To override the default style you can use a second file named e.g. "your_file.ssa.style" (the first file + ".style") which must be in SSA or ASS syntax an contains only formatting information (makes only sense when NOT using SSA/ASS).

Most SSA commands are ignored, as they are not really useful here.

SubResync

If you want to adjust the format of your subtitles (color, position and so on) you can do it with this tool - of course you can simply edit the SSA file if you know the syntax.

SSA syntax

If you want to set the format manually here is the basic SSA syntax.
You must strictly obey the syntax else the line or the whole file will be rejected.
Those entries which are definitely used by TextSub are written bold.

A line beginning with a ";" (semicolon) is treated as a comment line.

Each line starts with a line desriptor, which describes the entry type.

First a little example:

[Script Info]
; This is a Sub Station Alpha v4 script.
;
ScriptType: v4.00
Collisions: Normal
PlayResX: 720
PlayResY: 576
Timer: 100.0000
[V4 Styles]
         Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline,
                 \  Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
         Style: Style1,Arial,32,&Hffffff,&H000000,&H404040,&H404040,0,0,1,2,0,2,30,30,40,0,0
         Style: Default,Arial,18,&Hffffff,&H00ffff,&H000000,&H000000,-1,0,1,2,3,2,20,20,20,0,1
[Events]
         Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
         Dialogue: Marked=0,0:02:12.69,0:02:13.92,Style1,Comment,0000,0000,0000,,San Francisco, 1876
         Dialogue: Marked=0,0:07:23.37,0:07:24.96,Style1,Comment,0000,0000,0000,,Er ist unverschдmt.
         Dialogue: Marked=0,0:07:25.13,0:07:28.28,Style1,Comment,0000,0000,0000,,So ist es hier.\NDas Land einfacher Krдmerseelen.

There are (typically three) sections in the file:

Script Info

This section contains headers and general information about the script.
The line that says "[Script Info]" must be the first line in a v4 script.

v4 Styles

This section contains all Style definitions required by the script. Each "Style" used by subtitles in the script should be defined here.

Any of the the settings in the Style, (except shadow/outline type and depth) can overridden by control codes in the subtitle text.

The fields which appear in each Style definition line are named in a special line with the line type "Format:". The Format line must appear before any Styles - because it defines how SSA will interpret the Style definition lines. The field names listed in the format line must be correctly spelled! The fields are as follows:

Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding

The format line allows new fields to be added to the script format in future, and yet allow old versions of the software to read the fields it recognises - even if the field order is changed.

Events

These contain the subtitle text, their timings, and how it should be displayed. Quite all features are supported by TextSub.
The fields which appear in each Dialogue line are defined by a Format: line, which must appear before any events in the section. The format line specifies how SSA will interpret all following Event lines. The field names must be spelled correctly, and are as follows:

Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text

The last field will always be the Text field, so that it can contain commas. The format line allows new fields to be added to the script format in future, and yet allow old versions of the software to read the fields it recognises - even if the field order is changed.

$Date: 2004/08/17 20:31:19 $