Manipulate subtitles in GO (.srt, .ssa/.ass, .stl, .ttml, .vtt (webvtt), teletext, etc.)
Manipulate subtitles in GO (.srt, .ssa/.ass, .stl, .ttml, .vtt (webvtt), teletext, etc.)
This is a Golang library to manipulate subtitles.
It allows you to manipulate srt, stl, ttml, ssa/ass, webvtt and teletext files for now.
Available operations are parsing, writing, applying linear correction, syncing, fragmenting, unfragmenting, merging and optimizing.
To install the library:
go get github.com/asticode/go-astisubTo install the CLI:
go install github.com/asticode/go-astisub/cmd/astisub WARNING: the code below doesn't handle errors for readibility purposes. However you SHOULD!
…If astisub has been installed properly you can:
convert any type of subtitle to any other type of subtitle:
astisub convert -i example.srt -o example.ttml
apply linear correction to any type of subtitle:
astisub apply-linear-correction -i example.srt -a1 1s -d1 2s -a2 5s -d2 7s -o example.out.srt
fragment any type of subtitle:
astisub fragment -i example.srt -f 2s -o example.out.srt
merge any type of subtitle into any other type of subtitle:
astisub merge -i example.srt -i example.ttml -o example.out.srt
optimize any type of subtitle:
astisub optimize -i example.srt -o example.out.srt
unfragment any type of subtitle:
astisub unfragment -i example.srt -o example.out.srt
sync any type of subtitle:
astisub sync -i example.srt -s "-2s" -o example.out.srtNo open issues yet, or sync has not completed.