subtitle

package
v0.8.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package subtitle turns subtitle text into WebVTT, the form players show beside a video. It reads the formats FFmpeg doesn't (YouTube's SBV, TTML and DFXP, timed lyrics), and straightens out the encodings of the ones it does. The result is only ever shown as cue text, which a browser doesn't run.

Index

Constants

View Source
const MaxInput = 32 << 20

MaxInput is the most of a subtitle file that is read. A film's subtitles are a few hundred kilobytes.

Variables

This section is empty.

Functions

func Convert

func Convert(format string, b []byte) ([]byte, error)

Convert makes WebVTT from a format ReadsItself says it can read.

func Normalize

func Normalize(b []byte) []byte

Normalize returns text as UTF-8, whatever it was written in, without a byte order mark and with plain line ends.

func ReadsItself

func ReadsItself(format string) bool

ReadsItself says Convert handles this format with no help.

func Shift

func Shift(vtt []byte, by float64) []byte

Shift moves every cue earlier by this many seconds, for a player whose clock starts that far into the film. Cues that have ended by then go; one that spans the start begins at zero.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL