SSA/ASS Subtitles

SSA stands for Sub Station Alpha. It's the file format used by the popular subtitle editor, SubStation Alpha. This format is widely used by fansubbers.

It allows you to do some advanced display features, like positioning, karaoke, style managements...

For detailed information on SSA/ASS, see the SSA specs. It includes an SSA specs description and the avanced features added by ASS format (standing for Advanced SSA). Because SSA and ASS are so similar, they are treated the same here.

Like SRT, this format is text based with a particular syntax.

A file consists of 4 or 5 parts, declared ala INI file (but it's not an INI !)

The first, "[Script Info]" contains some information about the subtitle file, such as it's title, who created it, type of script and a very important one : "PlayResY". Be carefull of this value, everything in your script (font size, positioning) is scaled by it. Sub Station Alpha uses your desktops Y resolution to write this value, so if a friend with a large monitor and a high screen resolution gives you an edited script, you can mess everything up by saving the script in SSA with your low-cost monitor.

The second, "[V4 Styles]", is a list of style definitions. A style describe how will look a text on the screen. It defines font, font size, primary/.../outile colour, position, aligment etc ...

For example this :

Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
Style: Wolf main,Wolf_Rain,56,15724527,15724527,15724527,4144959,0,0,1,1,2,2,5,5,30,0,0

The third, "[Events]", is the list of text you want to display at the right timing. You can specify some attribute here. Like the style to use for this event (must be defined in the list), the position of the text (Left, Right, Vertical Margin), an effect. Name is mostly used by translator to know who said this sentence. Timing is in h:mm:ss.cc (centisec).

Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: Marked=0,0:02:40.65,0:02:41.79,Wolf main,Cher,0000,0000,0000,,Et les enregistrements de ses ondes delta ?
Dialogue: Marked=0,0:02:42.42,0:02:44.15,Wolf main,autre,0000,0000,0000,,Toujours rien.

"[Pictures]" or "[Fonts]" part can be found in some SSA file, they contains UUE-encoded pictures/font but those features are only used by Sub Station Alpha, i.e. no filter (Vobsub/Avery Lee Subtiler filter) use them.

Now, how are they stored in matroska ?

  • All text is converted to UTF-8
  • All the headers are stored in CodecPrivate ( Script Info and the Styles list)
  • Start & End field are used to set TimeStamp and the BlockDuration element. the data stored is :
  • Events are stored in the Block in this order: ReadOrder, Layer, Style, Name, MarginL, MarginR, MarginV, Effect, Text (Layer comes from ASS specs ... it's empty for SSA.) "ReadOrder field is needed for the decoder to be able to reorder the streamed samples as they were placed originally in the file."
  • Here is an example of an SSA file.

    [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: Wolf's rain 2
    Original Script: Anime-spirit Ishin-francais
    Original Translation: Coolman
    Original Editing: Spikewolfwood
    Original Timing: Lord_alucard
    Original Script Checking: Spikewolfwood
    ScriptType: v4.00
    Collisions: Normal
    PlayResY: 1024
    PlayDepth: 0
    Wav: 0, 128697,D:\Alex\Anime\- Fansub -\- TAFF -\Wolf's Rain\WR_-_02_Wav.wav
    Wav: 0, 120692,H:\team truc\WR_-_02.wav
    Wav: 0, 116504,E:\sub\wolf's_rain\WOLF'S RAIN 02.wav
    LastWav: 3
    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: Default,Arial,20,65535,65535,65535,-2147483640,-1,0,1,3,0,2,30,30,30,0,0
    Style: Titre_episode,Akbar,140,15724527,65535,65535,986895,-1,0,1,1,0,3,30,30,30,0,0
    Style: Wolf main,Wolf_Rain,56,15724527,15724527,15724527,4144959,0,0,1,1,2,2,5,5,30,0,0

    [Events]
    Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
    Dialogue: Marked=0,0:02:40.65,0:02:41.79,Wolf main,Cher,0000,0000,0000,,Et les enregistrements de ses ondes delta ?
    Dialogue: Marked=0,0:02:42.42,0:02:44.15,Wolf main,autre,0000,0000,0000,,Toujours rien.

    Here is what would be placed into the CodecPrivate element.

    [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: Wolf's rain 2
    Original Script: Anime-spirit Ishin-francais
    Original Translation: Coolman
    Original Editing: Spikewolfwood
    Original Timing: Lord_alucard
    Original Script Checking: Spikewolfwood
    ScriptType: v4.00
    Collisions: Normal
    PlayResY: 1024
    PlayDepth: 0
    Wav: 0, 128697,D:\Alex\Anime\- Fansub -\- TAFF -\Wolf's Rain\WR_-_02_Wav.wav
    Wav: 0, 120692,H:\team truc\WR_-_02.wav
    Wav: 0, 116504,E:\sub\wolf's_rain\WOLF'S RAIN 02.wav
    LastWav: 3
    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: Default,Arial,20,65535,65535,65535,-2147483640,-1,0,1,3,0,2,30,30,30,0,0
    Style: Titre_episode,Akbar,140,15724527,65535,65535,986895,-1,0,1,1,0,3,30,30,30,0,0
    Style: Wolf main,Wolf_Rain,56,15724527,15724527,15724527,4144959,0,0,1,1,2,2,5,5,30,0,0

    And here are the two blocks that would be generated.

    Block's timecode: 00:02:40.650
    BlockDuration: 00:00:01.140

    1,,Wolf main,Cher,0000,0000,0000,,Et les enregistrements de ses ondes delta ?

    Block's timecode: 00:02:42.420
    BlockDuration: 00:00:01.730

    2,,Wolf main,autre,0000,0000,0000,,Toujours rien.