Golang PGS Parser
go get github.com/mbiamont/go-pgs-parser
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))
})
}
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))
})
}
You can extract a SUP file using ffmpeg like this:
ffmpeg -i input.mkv -map 0:s:0 -c copy input.sup -y