Giter Club home page Giter Club logo

go-pgs-parser's Introduction

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.

Save as PNG images (recommended)

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

go-pgs-parser's People

Contributors

mbiamont avatar

Stargazers

 avatar

Watchers

 avatar

go-pgs-parser's Issues

endTime of a subtitle

Hi!

I'm trying to convert PGS subtitles to SRTs with OCR but I'm unable to find a way to get the end time of a PGS subtitle.
Could you maybe give me some pointers in the right direction?

Thanks for the library btw!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.