oxideav-ass
Pure-Rust ASS / SSA subtitle codec and container — parser and writer
for Advanced SubStation Alpha (.ass) and SubStation Alpha (.ssa)
text subtitle files. Zero C dependencies.
Part of the oxideav framework but usable standalone.
Installation
[]
= "0.1"
= "0.1"
= "0.1"
= "0.0"
= "0.0"
Quick use
ASS is a text format rather than a bitstream, so "decode" means parsing
event lines + style metadata and "encode" means formatting back out to
the same text form. The container opens one .ass / .ssa file and
emits one packet per Dialogue: event; the codec on either side
converts packets to the shared SubtitleCue IR (from oxideav-core).
use CodecRegistry;
use ContainerRegistry;
use Frame;
let mut codecs = new;
let mut containers = new;
register_codecs;
register_containers;
let input: = Boxnew;
let mut dmx = containers.open?;
let stream = &dmx.streams;
let mut dec = codecs.make_decoder?;
loop
# Ok::
Direct parse / write
If you just want the text format without the codec+container pipeline:
let track = parse?;
let out_bytes = write;
Format conversion
Direct ASS / SRT and ASS / WebVTT conversion helpers are exposed — they parse into the shared IR and re-emit in the target format.
let ass = srt_to_ass?;
let srt = ass_to_srt?;
let vtt = ass_to_webvtt?;
let ass = webvtt_to_ass?;
Feature coverage
What the parser understands and preserves on round-trip:
[Script Info]— header key/value pairs captured as track metadata; comment lines (;/!) preserved inside extradata.[V4+ Styles]and[V4 Styles]—Format:-aware per-Style:decode of name, font, size, primary / outline / back colours (&HAABBGGRRwith ASS alpha inversion), bold / italic / underline / strikeout flags (including SSA's-1for true), alignment (both ASS\anand legacy SSA numpad schemes), margins, outline, and shadow widths.[Events]—Format:-aware;Dialogue:lines decode toSubtitleCuewith start, end, style reference, and styled segments.Comment:events are dropped.- Override tags inside dialogue text —
\b,\i,\u,\s,\cand\1c(primary colour),\fn,\fs,\pos(x,y),\an,\k/\kf/\ko(karaoke timing markers), and\r(reset inline state). Unknown tags (\fad,\move,\clip,\t, etc.) survive parsing as opaque pass-through so round-trip keeps them intact, even when mixed with tags the parser does interpret. \Nhard line break,\hhard space,\nsoft break.- ASS timestamp format
H:MM:SS.cc(centiseconds). - Commas inside the
Textfield are preserved (the CSV splitter stops at the per-format column count).
Out of scope for this crate:
[Fonts]/[Graphics]UU-encoded attachments are parsed around (their lines are not copied into the re-emitted output).- Full visual rendering (draw commands
\p, animated\t, 3D rotations) — these remain as raw override blocks, available to a downstream renderer.
Codec / container IDs
- Codec:
"ass"; media typeSubtitle, intra-only, lossless. - Container:
"ass", matches.assand.ssaby extension and probes the[Script Info]header magic.
License
MIT — see LICENSE.