go-pgs-parser

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: Apache-2.0

README

go-pgs-parser

Golang PGS Parser

Installation

go get github.com/mbiamont/go-pgs-parser

Getting started

The parser requires you specify a SUP file's path.

More info about PGS and SUP file here: https://fileinfo.com/extension/sup

For each subtitle bitmap, it'll ask you in which file to write it.

package main

import (
	"fmt"
	"github.com/mbiamont/go-pgs-parser/pgs"
	"os"
)

func main() {
	parser := pgs.NewPgsParser()

	parser.ConvertToPngImages("./sample/input.sup", func(index int) (*os.File, error) {
		return os.Create(fmt.Sprintf("./sample/subs/input.%d.png", index))
	})
}
Save as JPG images
package main

import (
	"fmt"
	"github.com/mbiamont/go-pgs-parser/pgs"
	"os"
)

func main() {
	parser := pgs.NewPgsParser()

	parser.ConvertToJpgImages("./sample/input.sup", func(index int) (*os.File, error) {
		return os.Create(fmt.Sprintf("./sample/subs/input.%d.jpg", index))
	})
}
Output example

Extract SUP from MKV

You can extract a SUP file using ffmpeg like this:

ffmpeg -i input.mkv -map 0:s:0 -c copy input.sup -y

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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