Skip to content

@catlabtech/webcvt-subtitle

Browser-first subtitle conversion for the webcvt ecosystem. Converts between SRT, WebVTT, ASS/SSA, MicroDVD (.sub), and MPL2 formats — pure TypeScript, no WASM, no third-party parsers.

Installation

bash
npm i @catlabtech/webcvt-subtitle

Supported formats

FormatExtParseSerializeNotes
SubRip.srtyesyesFull round-trip, HTML tags
WebVTT.vttyesyesCue settings preserved
ASS.assyesyesStyle fields parsed; text only
SSA.ssayesyesV4 styles (delegates to ASS)
MicroDVD.subyesyesFrame-based, default 23.976fps
MPL2.mplyesyesDecisecond timestamps

VobSub binary .sub files are out of scope — the parser throws a clear error when binary magic is detected.

Usage via registry

ts
import { SubtitleBackend } from '@catlabtech/webcvt-subtitle';
import { defaultRegistry, convert } from '@catlabtech/webcvt-core';

defaultRegistry.register(new SubtitleBackend());

const result = await convert(srtBlob, { format: 'vtt' });

Direct parser / serializer usage

ts
import { parseSrt, serializeVtt, parseAss, serializeSrt } from '@catlabtech/webcvt-subtitle';

// SRT → VTT
const track = parseSrt(srtText);
const vttText = serializeVtt(track);

// ASS → SRT
const track2 = parseAss(assText);
const srtText2 = serializeSrt(track2);

Source

packages/subtitle/src

MIT licensed