Skip to content

Go library and command-line tools for manipulating .srt, .vtt and .ssa subtitles

License

Notifications You must be signed in to change notification settings

martinlindhe/subtitles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

GoDoc

This is a go library and command-line tools for handling .srt, .vtt and .ssa subtitles

Installation

Windows and macOS binaries are available under Releases

Or install them directly from git:

go install github.com/martinlindhe/subtitles/cmd/subber@latest

Sub-projects

  • subber command line tool for subtitles

Library example - convert srt to vtt

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())

Library example - download subtitles

f, _ := os.Open(fileName)
defer f.Close()

finder := subtitles.NewSubFinder(f, fileName, "en")
text, err := finder.TheSubDb()

License

Under MIT

About

Go library and command-line tools for manipulating .srt, .vtt and .ssa subtitles

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages