Awesome Go

subgo

CategoryVideo
SubcategoryVideo
Stars0

Library and CLI for working with subtitles (.srt, .ass, .webvtt, etc.)

About subgo

Go Reference codecov

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

FlagDescription
-o, --outputOutput file (default: output.srt)
-s, --shiftShift timing (e.g., 300ms, -1s)
-t, --stretchStretch factor (e.g., 1.05 for 5% longer)
-c, --clampClamp negative times to zero (default: true)
--trim-firstRemove first n events
--trim-lastRemove last n events
--trim-beforeRemove events before timestamp
--trim-afterRemove events after timestamp
--remove-hiRemove hearing impaired annotations
--remove-idsRemove 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.

← Back to Video