Subgo is a modern, lightweight Go library and command-line tool for manipulating subtitle files. It provides a simple, consistent API for loading, transforming, and exporting subtitles across multiple formats.
For your go projects:
go get github.com/kianelbo/subgo@latestFor the CLI, standalone binaries are available here.
subgo <input-file> [flags]| Flag | Description |
|---|---|
-o, --output |
Output file (default: output.srt) |
-s, --shift |
Shift timing (e.g., 300ms, -1s) |
-t, --stretch |
Stretch factor (e.g., 1.05 for 5% longer) |
-c, --clamp |
Clamp negative times to zero (default: true) |
--trim-first |
Remove first n events |
--trim-last |
Remove last n events |
--trim-before |
Remove events before timestamp |
--trim-after |
Remove events after timestamp |
--remove-hi |
Remove hearing impaired annotations |
--remove-ids |
Remove events by comma-separated indices |
subgo eraserhead.srt --trim-before 1m --shift 300ms --remove-hi -o eraserhead.srtimport "github.com/kianelbo/subgo"
sub, _ := subgo.Load("input.ass")
sub = sub.Shift(300*time.Millisecond, true)
sub = sub.Stretch(1.05, 0)
sub.Save("output.srt")- SRT
- ASS/SSA
- WebVTT
- SBV
- TTML