Log in

View Full Version : PGStoBDN tool


Rectal Prolapse
8th March 2012, 05:13
Here is my contribution - a command-line tool that will take a sup (PGS) file from eac3to and generate PNGs and a BDN (XML) file.

Link to full source code and the binary here:

http://dl.dropbox.com/u/1156664/PGStoBDN-source-with-binary-libraries-20120311.rar

The binary is in the Release directory under the PGStoBDN\Release directory, called PGStoBDN.exe.

It is compiled under Visual Studio 2010, and includes the zlib and lpng projects for convenience. You might need to adjust the include and library directories in your project to get them to compile and link. Also, I used the Boost 1.47 C++ library, but should be easy to get working with the latest boost.

This tool follows the Blu-ray PGS specification more closely than the other tools (including BDSup2Sub) so should work with PGS streams that have 2 graphical object regions. Also, it *should* work on PGS streams that make use of palette effects, although I cannot test this as I am not aware of any Blu-rays that use this. It should work nicely on fansubbed remuxed Blu-rays that make use of those multi-regions anyways.

Usage:


F:\>F:\Projects\PGStoBDN\Release\PGStoBDN.exe --help
Allowed options:
--help produce help message
--version print version number
--original output PNG images in the original size
(suitable for OCR)
--fullpng output 1920x1080 PNG images (NOT
IMPLEMENTED) [DEFAULT]
--nobdnfixtimes do not divide BDN times by 1.001 (BDN
output only)
--bdnfixtimes divide BDN times by 1.001 (BDN output
only) [DEFAULT]
--framerate arg frame rate [DEFAULT: 29.97]
--input-file arg input file
--output-filename-prefix arg output filename's prefix
--forcedsubs make all subtitles forced
--forcedonly only output forced subtitles
--dropframes flag all subtitle times as drop frames
(BDN output only)
--nopng don't generate any PNGs
--enhancecontrast make all pixels with Y < 140 black, and
pixels with Y >= 140 white (easier to
OCR). Also forces background to black.
--enhancecontrastthreshold arg (=140) changes the default threshold value for
the --enhancecontrast option.


NOTE: Not all options have been implemented yet, like the enhance ones.

MOTIVATION: I plan to use the engine I wrote (using the Flavor A/V description language) to replace the one in MPC-HC - which also has problems with multiregion PGS and palette effects. I wrote this tool as a proof of concept. Hopefully in the next few months MPC-HC will have first-class Blu-ray subtitle rendering, instead of the rudimentary (and incorrect) rendering it does now! :cool:

This tool should be a good compliment to BDSup2sub - the BDN and PNGs generated by PGStoBDN can be used to generate IDX/SUB or even SUP files for use in your own Blu-ray remuxes, for example.

Do what you want with the source code - I just want it out there! You can give me credit if you like, however. :)

Rectal Prolapse
8th March 2012, 05:15
Attached here is only the binary for PGStoBDN.

Rectal Prolapse
8th March 2012, 07:51
Oh one more thing... the PNGs are output using the standard video levels range of 16-235. I really should add an option for levels expansion 16-235 -> 0-255.

Rectal Prolapse
8th March 2012, 08:55
Ok, I added a --pclevels and --videolevels option now. It seems to work! Above posts changed with new source and exe.

Nikse555
11th March 2012, 10:54
Nice - I'll give it a try :)

Edit: One minor issue - the actual image file names and the image file names in the xml file do not match

Rectal Prolapse
11th March 2012, 19:52
whoops

Rectal Prolapse
11th March 2012, 19:56
For now you can use "sub" as the output filename as a workaround. You will get sub.xml and sub_nnn.pngs in the xml, which should match the generated files, I think..

Rectal Prolapse
11th March 2012, 20:02
Nikse, give this a try:

http://www.mediafire.com/?9mhf2z18q4m46hj

Binary included in the top Release directory, source updated. Let me know if this fixes it.

Nikse555
11th March 2012, 20:45
Xml image file names are fine now :)

Cropped pictures would be nice too.

Rectal Prolapse
12th March 2012, 00:08
Thanks for the feedback! It may be a couple of weeks before I can get to it - it was on my TODO list hehe (hard part is finding the proper BDN syntax to hand multiregion commands - need that for import to scenarist).

Rectal Prolapse
5th April 2012, 23:37
Updated the link - hopefully dropbox is more "permanent".

KSSW
9th June 2024, 07:12
Does the PGStoBDN source code exist

tormento
14th June 2024, 13:18
Anybody that still has the archive, could upload somewhere?

AYColumbia
15th February 2025, 03:29
I just asked about a tool similar to this in another thread. Any chance of the code being made available on GitHub? Looks like the last link from 2012 is not available. The link for just the binary is there but it's not working properly as broken link has the xml file fix. Would appreciate the fixed version if someone would be kind enough to provide it.

Emulgator
15th February 2025, 23:35
Wayback machine has it still:
https://web.archive.org/web/20160606165525/https://dl.dropboxusercontent.com/u/1156664/PGStoBDN-source-with-binary-libraries-20120311.rar

AYColumbia
16th February 2025, 00:38
Wayback machine has it still:
https://web.archive.org/web/20160606165525/https://dl.dropboxusercontent.com/u/1156664/PGStoBDN-source-with-binary-libraries-20120311.rar
Haha, thanks "Mr. Peabody" :)