This is a go library and command-line tools for handling .srt, .vtt and .ssa subtitles
Windows and macOS binaries are available under Releases
Or install them directly from git:
go install github.com/martinlindhe/subtitles/cmd/subber@latest
- subber command line tool for subtitles
import "github.com/martinlindhe/subtitles"
in := "1\n" +
"00:00:04,630 --> 00:00:06,018\n" +
"Go ninja!\n" +
"\n" +
"1\n" +
"00:01:09,630 --> 00:01:11,005\n" +
"No ninja!\n"
res, _ := subtitles.NewFromSRT(in)
// Output: WEBVTT
//
// 00:04.630 --> 00:06.018
// Go ninja!
//
// 01:09.630 --> 01:11.005
// No ninja!
fmt.Println(res.AsVTT())
f, _ := os.Open(fileName)
defer f.Close()
finder := subtitles.NewSubFinder(f, fileName, "en")
text, err := finder.TheSubDb()
Under MIT