mjuhasz / BDSup2Sub

Blu-Ray/DVD subtitle editor
Apache License 2.0
211 stars 47 forks source link

feature request: when outputting png files, also output srtx file #56

Open kaefert opened 9 years ago

kaefert commented 9 years ago

Hey there! I use your software as part of a process to get subtitles into srt text format. It would make that process easier if you could extend your xml+png output by also (or maybe depending on a switch) output a srtx file that can be used by srttool to join together the OCRed text snippets into one srt file.

The format of this srtx file should be like so:

1
00:01:01,15 --> 00:01:02,16
eng1_0001.png.txt

2
00:01:02,18 --> 00:01:06,03
eng1_0002.png.txt

3
00:01:06,05 --> 00:01:07,07
eng1_0003.png.txt

As a workaround for now I have written myself a little java processer for your xml format that outputs this srtx format (see attachment)

BDNXmlToSrtx.java.txt

optimiz commented 8 years ago

I appreciate BDSup2Sub's current capabilities and second @kaefert's request, SRTX output would be beneficial. My workaround is to export with BDSup2Sub (to get XML+PNG) and subtitle2pgm (to get the SRTX), then manipulate as necessary.

#! /bin/bash
subtitle2vobsub -p file.ps1 -o file
# Unfortunately, subtitle2pgm skips, doubles or blanks some frames.
subtitle2pgm -P -i file.ps1 -o file
# Thankfully, BDSup2Sub exports all frames correctly.
java -jar BDSup2Sub.jar -o file.xml file.idx
rename file_ file *png
sed -i 's/pgm/png/g' file.srtx
for subs in *.png; do tesseract $subs $subs; done
srttool -s -i file.srtx -o file_ready_for_editing.srt
rm file*{png,pgm,idx,xml,srtx,txt,sub}