subgo
Library and CLI for working with subtitles (.srt, .ass, .webvtt, etc.)
About subgo
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.
Installation
For your go projects:
go get github.com/kianelbo/subgo@latest
For the CLI, standalone binaries are available here.
CLI Usage
subgo <input-file> [flags]
Features
| 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 |
Example
subgo eraserhead.srt --trim-before 1m --shift 300ms --remove-hi -o eraserhead.srt
Library Usage
import "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")
Supported Formats
- SRT
- ASS/SSA
- WebVTT
- SBV
- TTML
Frequently Asked Questions
What is subgo?
subgo is a Video library for the Go programming language. Library and CLI for working with subtitles (.srt, .ass, .webvtt, etc.)
How do I install subgo?
Install subgo with the Go module system using `go get kianelbo/subgo`. Check the repository for the current installation instructions.
What category does subgo belong to?
subgo is listed under Video, specifically Video.