Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Subtitles

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th March 2012, 04:13   #1  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 433
PGStoBDN tool

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/PGSt...s-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:

Code:
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!

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.

Last edited by Rectal Prolapse; 5th April 2012 at 23:34. Reason: Updated link to latest.
Rectal Prolapse is offline   Reply With Quote
Old 8th March 2012, 04:15   #2  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 433
Attached here is only the binary for PGStoBDN.
Attached Files
File Type: rar PGStoBDN.rar (110.2 KB, 61 views)

Last edited by Rectal Prolapse; 8th March 2012 at 07:54.
Rectal Prolapse is offline   Reply With Quote
Old 8th March 2012, 06:51   #3  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 433
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 is offline   Reply With Quote
Old 8th March 2012, 07:55   #4  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 433
Ok, I added a --pclevels and --videolevels option now. It seems to work! Above posts changed with new source and exe.
Rectal Prolapse is offline   Reply With Quote
Old 11th March 2012, 09:54   #5  |  Link
Nikse555
Registered User
 
Join Date: Feb 2004
Location: Mars
Posts: 221
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

Last edited by Nikse555; 11th March 2012 at 10:19.
Nikse555 is offline   Reply With Quote
Old 11th March 2012, 18:52   #6  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 433
whoops
Rectal Prolapse is offline   Reply With Quote
Old 11th March 2012, 18:56   #7  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 433
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 is offline   Reply With Quote
Old 11th March 2012, 19:02   #8  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 433
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.
Rectal Prolapse is offline   Reply With Quote
Old 11th March 2012, 19:45   #9  |  Link
Nikse555
Registered User
 
Join Date: Feb 2004
Location: Mars
Posts: 221
Xml image file names are fine now

Cropped pictures would be nice too.
Nikse555 is offline   Reply With Quote
Old 11th March 2012, 23:08   #10  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 433
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 is offline   Reply With Quote
Old 5th April 2012, 23:37   #11  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 433
Updated the link - hopefully dropbox is more "permanent".
Rectal Prolapse is offline   Reply With Quote
Reply

Tags
bdn, blu-ray, pgs, xml

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:51.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.