View Single Post
Old 3rd July 2013, 18:19   #1  |  Link
eeeeeric
Registered User
 
Join Date: Jun 2013
Posts: 1
bdnxml2srt - python script for conversion

Hey guys,

I was looking for a PGS to SRT solution that would work for multiple OSes, so I decided to come up with my own. I hope this helps some people out.

First, convert the PGS to BDN XML using bdsup2sub++ (http://forum.doom9.org/showthread.php?t=167051) Be sure to set the correct language when outputting, as the script reads that information when performing OCR.

Then use this script to convert that to SRT. It uses tesseract for OCR so you'll need that installed too (and somewhere in your PATH).

http://eeeeeric.github.io/bdnxml2srt/

Code:
usage: convert.py [-h] -i INPUT [-o OUTPUT] [-f] [-b] [-l]

Convert BDN XML subtitle to SRT format

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        BDN XML input file
  -o OUTPUT, --output OUTPUT
                        Output file, or '-' for stdout (default), without SRT
                        extension.
  -f, --forced-only     Only output subtitles marked as forced
  -b, --no-ocr          Don't use tesseract to OCR. Generates template SRT.
  -l, --label-language  Insert language code before extension, e.g.
                        output.eng.srt Combine with setting the output file to
                        the empty string to achieve e.g. eng.srt
Cheers
eeeeeric is offline   Reply With Quote