ass-compiler
Parses and compiles ASS subtitle format to easy-to-use data structure.
Online Viewer
Installation
npm install ass-compiler
Usage
You can use parse
or compile
as your need.
import { parse, stringify, compile, decompile } from 'ass-compiler';
const text = `
[Script Info]
; ...
`;
const parsedASS = parse(text);
const stringifiedText = stringify(parsedASS);
const compiledASS = compile(text, options);
const decompiledText = decompile(compiledASS);
options
{
defaultStyle: {
Name: 'Default',
Fontname: 'Arial',
Fontsize: '20',
PrimaryColour: '&H00FFFFFF&',
SecondaryColour: '&H000000FF&',
OutlineColour: '&H00000000&',
BackColour: '&H00000000&',
Bold: '0',
Italic: '0',
Underline: '0',
StrikeOut: '0',
ScaleX: '100',
ScaleY: '100',
Spacing: '0',
Angle: '0',
BorderStyle: '1',
Outline: '2',
Shadow: '2',
Alignment: '2',
MarginL: '10',
MarginR: '10',
MarginV: '10',
Encoding: '1',
},
}
For details of data structure, please use the online viewer.