View Full Version : BDSup2Sub - convert and tweak bitmap subtitle streams (VobSub,BD-SUP,BDN XML,HD-SUP)
0xdeadbeef
20th January 2010, 12:18
You can either decide to use the sources directly or use the JAR as a library. The latter way is already used by a few applications. Also the JavaDoc for the public interfaces is already included in the JAR. I can give you an example how this works later today if you wish.
0xdeadbeef
20th January 2010, 18:57
Ok, as promised, here is an example of how to use the JAR as library. It's the complete Eclipse project which should also display online JavaDoc for the public interfaces in the Jar.
http://www.sendspace.com/file/8lvcsa
Well, indeed it's just the main class used for CLI handling which uses the JAR instead of including all the source code. Still it should suffice as example as it shows the handling of all relevant cases (that can be used via CLI).
rernst
21st January 2010, 02:17
Just pulled it down and had a quick look at it. The jar file will work just fine - all the functionality I need is there without having to modify the source that actually manipulates the streams.
Thanks again,
Vielen Dank ...
0xdeadbeef
21st January 2010, 19:36
No sweat...
gonzus
27th January 2010, 05:40
I am using BDSup2Sub to convert SUP subtitles (from a BluRay disk) into SUB subtitles, so that I can merge them into an MKV containing the transcoded BluRay movie. Thanks for the great tool!
One quick question (and apologies if it is a stupid one): I noticed you can generate a PGCEdit palette file when creating the SUP subtitle. Is this of any use for an MKV file? I use mkvmerge to add the SUP subtitle to my MKV, and did not find any place to specify a palette. Any hints?
Thanks again and best regards.
0xdeadbeef
27th January 2010, 12:28
The PGCEdit palette file really makes only sense if you export to SUP/IFO and want to load the SUP (which doesn't contain the palette) in PGCEdit.
mrbass
2nd February 2010, 04:34
I am using BDSup2Sub to convert SUP subtitles (from a BluRay disk) into SUB subtitles, so that I can merge them into an MKV containing the transcoded BluRay movie. Thanks for the great tool! Subs in mkv work great on wdtv live.
Same here finally Mac users have 100% solution for bluray to mkv to 264 with subs (still forced subs detection is an issue though with makemkv). Now that we can extract them from the ripped mkv with mkvextract included with mkvtoolnix. Thanks 0xdeadbeef for awesome cross-platform subtitle tool.
http://membo.org/i/b1/macsubsextract.png
0xdeadbeef
2nd February 2010, 18:31
It's nice to hear it works well on the Mac. The JRE implementation on the Mac was always a bit behind the ones supported by Sun directly but it seems to have caught up.
While we're at it: does anybody actually use BDSup2Sub under Linux or Solaris?
laserfan
2nd February 2010, 23:35
Is there any way to keep the "conversion options" dialog pop-up from appearing every time I open a .sup?
0xdeadbeef
3rd February 2010, 01:16
Nope.
TheSane
12th February 2010, 11:08
Is there a chance that you comment the problems on the Popcorn Hour models with the BDSup2Sup output?
Here is a discussion about this: http://www.networkedmediatank.com/showthread.php?tid=35241
Thanks.
0xdeadbeef
12th February 2010, 12:25
How could I comment on the SUB/IDX implementation of the PCH side? Probably they just don't support hires SUB/IDX.
The hires modes for SUB/IDX are of course not supported by each application/medialayer that supports SUB/IDX, as this format stems from DVD, so this is a "do at your own risk and be happy if it works" feature.
However, there's nothing that I could do to fix the implementation in other software.
TheSane
12th February 2010, 12:44
Okay thanks, im don't have deeper knowledge in the specification. Your app is still the best to create sups (from my point of view), so i think it is understandable to have it working. :)
hubblec4
13th February 2010, 17:38
Hires sub/idx works perfect with the VSfilter.dll and MediaPlayerClassic.
jelockwood
4th March 2010, 00:29
Thanks for a great tool, even if it might not (yet) do exactly what I want :)
I would like to be able to extract subtitles from a standard VIDEO_TS folder, that is a DVD. As such it does not contain a sup file. Is there anyway to do this with 4.0.0, if not could this possibly be added to a future version?
I can do this with Windows utilities, but I am trying to find a Mac solution and BDSup2Sub does run fine under Mac OS X.
While we making a wish list :) how about also providing the ability to extract subtitles from a standalone VOB file (not part of a VIDEO_TS), or an MPEG2 or H.264 file. The later might contain DVB (Digital Video Broadcasting) subtitles which are very similar to DVD subtitles. ProjectX for example can extract DVB subtitles but does not make it easy to convert to a more useful IDX/SUB format.
Edit - It seems BDSub2Sup only works with a single subtitle stream (the first) in an IDX/SUB pair of files. It says -
WARNING: Language id en(index:1) inactive -> ignored
WARNING: Language id es(index:2) inactive -> ignored
Is there anyway to get it to work with multiple streams and/or select which one to process?
An example set of files can be downloaded from http://homepage.mac.com/jelockwood/.Private/examplesubs.zip
0xdeadbeef
4th March 2010, 00:44
BDSup2Sub is a subtitle conversion tool, not a demuxer or muxer. Honestly, I don't see any chance that this will ever change.
jelockwood
4th March 2010, 22:01
BDSup2Sub is a subtitle conversion tool, not a demuxer or muxer. Honestly, I don't see any chance that this will ever change.
I (sadly) suspected this would be the case. Unfortunately TSMuxer also does not seem to support demuxing subtitles either.
PS. My second issue regarding BDSup2Sub not seemingly supporting additional languages in IDX/SUB files (which it does support) would still seem valid and need addressing.
laserfan
15th March 2010, 17:21
It's not clear to me what aspect ratio the blue background represents when an individual frame is displayed (the frame where you change position, times, flags). Indeed the frame itself appears wider than 1.77...?
I would like to be able to change the blue background, i.e. to 1.85 AR or 2.40 or 2.20 so I know how to position my subs. Is that possible?
0xdeadbeef
15th March 2010, 18:26
It's not clear to me what aspect ratio the blue background represents when an individual frame is displayed (the frame where you change position, times, flags). Indeed the frame itself appears wider than 1.77...?
I would like to be able to change the blue background, i.e. to 1.85 AR or 2.40 or 2.20 so I know how to position my subs. Is that possible?
The blue area represents the visible area as defined in the "move all" dialog's "Aspect ratio" setting. The default setting is cinemascope 21:9 (2.333:1). If you change the value there, the blue area (or the black bars - depends on how you look at it) also change in the preview panels. This even works if you don't move anything at all by pressing "Cancel" or selecting "keep X/Y position" and pressing "Move all".
laserfan
15th March 2010, 19:44
Wonderful! I had not found that dialog yet. Just what I was looking for; thanks for your help! :)
mts1
19th March 2010, 03:59
Hi.
I'm trying to use this program and it works more or less as expected :)
However, there are some areas where I either don't understand the logic or there is some problem with image conversion.
For example, I convert my subtitles to sub/idx format. The standard white text with the black shadow stays as is without any problems, but the same white text on the big black opaque rectangle becomes green on black.
Any ideas?
Thanks
0xdeadbeef
19th March 2010, 19:34
Any ideas?Thanks
Read the integrated help?
mts1
19th March 2010, 20:42
Read the integrated help?
Hmm, interesting idea.
Any particular section or just entire help?
nurbs
19th March 2010, 22:05
Hmm, interesting idea.
Any particular section or just entire help?
"Color Palettes" probably.
laserfan
19th March 2010, 22:41
Hmm, interesting idea.
Any particular section or just entire help?It might help to copy/paste the contents of the Help window into something like notepad so you can search it. Only thing worse than an un-searchable Help file is no Help file at all! ;)
mts1
19th March 2010, 23:37
Thanks guys.
I know what is the "Color Palettes". But it doubt there will be some explanation in the help why one frame is white on black and the next one is green on black. Is it just because there are too much black?
0xdeadbeef
22nd March 2010, 12:42
It might help to copy/paste the contents of the Help window into something like notepad so you can search it. Only thing worse than an un-searchable Help file is no Help file at all! ;)
There is a built-in option in the context menu (right mouse ear) to open the help with the system browser. This seems more convenient than notepad.
laserfan
22nd March 2010, 15:56
There is a built-in option in the context menu (right mouse ear) to open the help with the system browser. This seems more convenient than notepad.Hmm I thought I tried that (right-clicking) but I'll look again. :)
BTW I wanted to re-work a subtitle track recently where I had made first an .srt, then a .sup file using EasySup from deank, and finally imported to BDSup2Sub to set a couple hundred (!) "Forced" flags. It was no fun mouse-clicking the "Forced" box and then tracking-up to the "Save and advance" button at the top of the window, then down to the checkbox time & again.
I realized 200+ forced subs is an unusually high number but wondered if you'd encountered anything like it yourself as it might inspire you to move the arrows down closer to where the checkbox is. Or maybe there is an easier way to do this that I don't know about... :o
0xdeadbeef
22nd March 2010, 20:05
Hmm I thought I tried that (right-clicking) but I'll look again. :)
It's the very first option in the context menu. Should usually work. Then again, it's a feature of the Java runtime which asks the System to open the file with the default system browser. There are obviously some circumstances where it doesn't work but I guess there's nothing I could do about it.
If everything fails, you can also access the help from the Javaforge archive (http://bdsup2sub.javaforge.com/help.htm).
BTW I wanted to re-work a subtitle track recently where I had made first an .srt, then a .sup file using EasySup from deank, and finally imported to BDSup2Sub to set a couple hundred (!) "Forced" flags. It was no fun mouse-clicking the "Forced" box and then tracking-up to the "Save and advance" button at the top of the window, then down to the checkbox time & again.
I realized 200+ forced subs is an unusually high number but wondered if you'd encountered anything like it yourself as it might inspire you to move the arrows down closer to where the checkbox is. Or maybe there is an easier way to do this that I don't know about... :o
While I admire your endurance, reading the online help could have saved you some time. See chapter Conversion Dialog (http://bdsup2sub.javaforge.com/help.htm#Conversion_Dialog), under "Global forced flags".
laserfan
22nd March 2010, 21:04
While I admire your endurance, reading the online help could have saved you some time. See chapter Conversion Dialog (http://bdsup2sub.javaforge.com/help.htm#Conversion_Dialog), under "Global forced flags".
You mean this?
Global forced flags
The listbox "Force All" let's you choose whether to keep the imported forced flags or to set/clear the flags of all subtitles in the output stream.
But there were no "imported forced flags" in my .sup file--that's why I was using BDSup2Sub in the first place, to be able to set those flags, which were lost when I created the .sup from the .srt file. :confused:
Maybe I wasn't clear: the couple hundred subs I needed to "Force flag" on were dispersed among a total of >1400 total subtitles.
0xdeadbeef
22nd March 2010, 23:41
Ok, guess I mistook your post. Setting 200 flags in >1000 subs sound like some kind of torture this way or the other.
Then again, why not use the keyboard shortcuts?
1) Alt+F to set the forced flag
2) Alt+S to save
3) Alt+Right to advance to the next subtitle
Guess that would be much more convenient than using the mouse.
You could complain that there's no shortcut for save+advance, but shortcuts for non-letter characters
laserfan
23rd March 2010, 14:57
...why not use the keyboard shortcuts?
1) Alt+F to set the forced flag
2) Alt+S to save
3) Alt+Right to advance to the next subtitle
Guess that would be much more convenient than using the mouse.
I'm usually pretty good about reading docs but I did miss these; you're right they'd have helped me a lot.
You could complain that there's no shortcut for save+advance, but shortcuts for non-letter characters
Dunno that I will ever do another one this ugly, but it might be nice for a future release to use the PC kb arrow keys e.g. Up is Back, Down is Forward, Left is Save-and-Back, Right is Save-and-Forward.
Thanks for this great tool, I'm not sure how else one might go about tweaking the forced st flags. :)
dfordham
25th March 2010, 05:07
I'm trying to use BDsup2Sub from the command line. I have a BD (Iron Man) which has a small sup file with nothing but forced subs in it. If I import it using the GUI, it correctly tells me there are 37 forced subs. However, I am trying to use the following C/L:
BDSup2Sub.jar "d:\MKV Work Folder\Subtitles 3.sup" "d:\MKV Work Folder\Subtitles 3.sub" /forced
With this command line, nothing is returned. If I remove the /forced, I get the .sub file. Am I doing something wrong?
0xdeadbeef
25th March 2010, 18:20
I'm trying to use BDsup2Sub from the command line. I have a BD (Iron Man) which has a small sup file with nothing but forced subs in it. If I import it using the GUI, it correctly tells me there are 37 forced subs. However, I am trying to use the following C/L:
BDSup2Sub.jar "d:\MKV Work Folder\Subtitles 3.sup" "d:\MKV Work Folder\Subtitles 3.sub" /forced
With this command line, nothing is returned. If I remove the /forced, I get the .sub file. Am I doing something wrong?
Currently I don't see why this should not work apart from the missing "JAVA -jar" which I guess you left just better readability. I just tested a similar case with a SUP containing only 23 forced subtitles and it worked as expected:
java -jar e:\src\java\BDSup2Sub\BDSup2Sub.jar "german test 3.sup" "test 3.sub" /forced
->
Command line:
E:\src\Java\BDSup2Sub\BDSup2Sub.jar german test 3.sup test 3.sub /forced
OPTION: export only forced subtitles: ON
Target frame rate set to 25fps
Converting SUB/IDX
Loading german test 3.sup
Selected language 'German (de)' by filename
#> 1 (00:01:06.525)
...
#> 23 (01:42:06.788)
Detected 23 forced captions.
Writing test 3.sub
Decoding frame 1/23 at offset 0x0000021b
...
Decoding frame 23/23 at offset 0x0005ecbd
Writing test 3.idx
Conversion of 1 file(s) finished
Is there anything printed on the console (note: use JAVA.EXE from the CLI, not JAVAW.EXE)? An error message maybe?
If you are 100% sure that you're using the newest version, didn't mistype the filename on the console and the console output indicates that everything was ok but no subtitles were exported, then I'd need to take a look at the file.
I'd be surprised though to see that this really doesn't work as there are several GUIs that use BDSup2Sub from the CLI especially to extract only the forced subtitles.
dfordham
25th March 2010, 22:50
0x,
Thanks for responding so quickly. I seem to have wasted your time, though, as now everything seems to work as advertised.
Oh well, it was late and I'm old. That's a bad combination.
Thanks for an excellent program!
0xdeadbeef
25th March 2010, 23:05
Oh well, it was late and I'm old. That's a bad combination.
Sounds familiar ;)
No sweat...
Inspector.Gadget
28th March 2010, 18:09
Hey 0xdeadbeef, I have here the "From Hell" Blu-ray (Region A) which uses PGS subtitles that are a series of paper scroll-like images designed to display at certain points to reveal historical trivia. OCR'ing these subs is likely to be an exercise in futility. BDSup2Sub converts the image and text legibly, albeit with 5 "WARNING: multiple PDS/ODS definitions: result may be erratic" and, in recognition of the constraints of the DVD palette, in 3 shades only. Are you interested in samples of such subtitles for further research, if only as an exercise in masochism? :cool:
Edit: To clarify, my thinking is this: Such subtitles, which consist of text of some font on a detailed and shaded multi-color background, could perhaps be converted to VobSub or even BD-SUP with your tool but done in a way with extremely high contrast and color palette modification so that they become black on nearly pure white or vice versa. They could then be OCR'd by other tools and either used from there or re-converted to BD-SUP.
0xdeadbeef
28th March 2010, 18:48
Hey 0xdeadbeef, I have here the "From Hell" Blu-ray (Region A) which uses PGS subtitles that are a series of paper scroll-like images designed to display at certain points to reveal historical trivia. OCR'ing these subs is likely to be an exercise in futility. BDSup2Sub converts the image and text legibly, albeit with 5 "WARNING: multiple PDS/ODS definitions: result may be erratic" and, in recognition of the constraints of the DVD palette, in 3 shades only. Are you interested in samples of such subtitles for further research, if only as an exercise in masochism? :cool:
Though my need for masochism is limited lately and I guess you all noticed that I have much less time compared to last year, there's always a place for a weird subtitle in my freak gallery. A link via PM is welcome.
Inspector.Gadget
28th March 2010, 18:52
Sure, will send ASAP. Is the SUP demuxed with eac3to sufficient or do you need anything else from the disc? Thanks.
layman66
1st April 2010, 13:05
First let me say how marvelous a tool BDSup2Sub is. It left me speechless when I was able to convert my demuxed HD DVD sup-files directly into BD sups.
I still have some HD DVDs which don't have subtitles, but where I could rip them as SRTs from DVDs. Via Clown_SRT2XMLSUB I imported them into BDSup2 Sub. They were automatically placed close to the bottom of the screen. When I moved them up under "Edit" and "Move all captions", the subs - which hat been aligned at approx the same Y-value - started to spread (with their Y-value fluctuating by +/- 5 pixels; this happens also with tsMuxeR srt to BD sup conversion). I noticed that whenever the letter g, j, p, q or y were present, the subtitles moved up a bit. I was then able to align them again by correcting the Y-value of each subtitle individually. I now wonder - as this is not feasible wiht my next movie which has close to 2,000 subtitles - if all Y-values could be changed at once.
A new feature could allow for replacing a given Y-value by another Y-value in all subtitles which have this given value. With 5-10 replacment rounds, Y-values which were spread between 880 and 890 could for instance be aligned at 888. Alternatively, a new feature could allow for changing the Y-value of all subtitles by a given value, e.g. by -35 pixels. As a layman when it comes to programming I have no clue how difficult it would be to add such a feature. Regardeless of whether this ever comes to life, I want to thank you for all the hard work you put into this wonderful tool.
0xdeadbeef
2nd April 2010, 09:54
Well, in a nutshell you describe the problem of descenders (http://en.wikipedia.org/wiki/Descender) when aligning the lower edge of subtitles to a border.
There was a request earlier to automatically fix this by calculating a mean or median value and then aligning all subtitles to this value to eliminate the jitter. Letting aside that this gets a little more complex since there may be subtitles with 1, 2 and three or even more lines, there is one main problem with this approach: it assumes that the problem is only caused by descenders, but aligning the upper edge to a border would only shift this problem to be one of the ascenders (http://en.wikipedia.org/wiki/Ascender_%28typography%29).
While I still guess it would be possible to come up with an algorithm that automatically determines x-height of the font, number of lines and over-/undershoot for plain Latin characters, it would involve quite a lot of work and would most probably fail for special characters, Arabic fonts or whatever. This is the main reason why I didn't try to implement anything like this. The other is that I honestly don't care so much if the subtitles move up or down a little.
Which brings me back to your request. Yes, I could implement such a special feature, but no, I most probably won't. Thinking of a way to reasonably implement this in the GUI would cost me at least a hundred times more of my precious lifetime that implementing the code for it.
Some time ago, I toyed with the idea to implement scripting support for subtitle placement. Anyway, after thinking about it for some time, I realized that there would be nearly no benefit compared to exporting to XML and using a script on the XML part.
To cut a long story short: why don't you export the subtitles to XML, handle the position details there and import the result back in BDSup2Sub? If it's really about replacing y-values, a simple text editor should do. If not, a script in Perl (or whatever you prefer) script to change values within a range to a certain value would only need a few lines of code.
mrr19121970
12th April 2010, 12:51
@layman66, I'll look into this for you. Perhaps I can change the way Clown_SRT2XMLSUB decides the vertical position for you. Better to cure the problem than to try to find a workaround fix.
sporic
13th April 2010, 07:30
Can BDSup2Sub do these things:
1) Delete a particular frame?
2) Move are particular frame? For example Frame #100 to position #5?
Thanks.
mrr19121970
13th April 2010, 08:36
@layman66
The subtitles are aleady lined up in the vertical position. You can use the Vertical tolerance slider to adjust this. If you're still not happy, then you can manually chang all Y values in the XML file before opening in BDSup2SUB
<Event InTC="00:13:54:19" OutTC="00:13:58:12" Forced="False">
<Graphic Width="902" Height="178" X="509" Y="872">XML_1_1.png</Graphic>
</Event>
<Event InTC="00:13:58:14" OutTC="00:14:00:16" Forced="False">
<Graphic Width="299" Height="178" X="810" Y="872">XML_2_6.png</Graphic>
</Event>
<Event InTC="00:24:12:22" OutTC="00:24:14:07" Forced="False">
<Graphic Width="310" Height="178" X="805" Y="872">XML_3_10.png</Graphic>
</Event>
0xdeadbeef
13th April 2010, 16:56
Can BDSup2Sub do these things:
1) Delete a particular frame?
Yes, in the Edit dialog (http://bdsup2sub.javaforge.com/help.htm#Edit_Dialog) you can check/uncheck the "exclude from export" checkbox. Excluded frames are displayed with a large red cross to show that they won't be exported.
2) Move are particular frame? For example Frame #100 to position #5?
Not directly. You could however export to XML/PNG (http://bdsup2sub.javaforge.com/help.htm#Formats) and then move one "Event" block to another location (and edit the time). The result can then be imported in BDSup2Sub again.
sporic
15th April 2010, 14:53
What XML editor do use? using wordpad doesn't cut it. somehow cutting and pasting using Wordpad doesn't save formatting. Any recommendations?
0xdeadbeef
15th April 2010, 17:30
I used XML Notepad (http://www.microsoft.com/downloads/details.aspx?familyid=72d6aa49-787d-4118-ba5f-4f30fe913628&displaylang=en) from Microsoft a few times in the past, but usually I use UltraEdit for all my text file editing needs.
There are several free text editors as well of course which feature syntax highlighting etc. for XML, e.g. Programmer's Notepad (http://www.pnotepad.org/) or Notepad++ (http://notepad-plus.sourceforge.net).
If you can live without the syntax highlighting, also Notepad should do.
layman66
21st April 2010, 11:57
@ 0xdeadbeef & mrr19121970
Thanks for your suggestions! First I tried the vertical slider but to no avail. While Y-values in a specific XML-file were all the same for a given slider position, after importing the different XML-files into BDSup2Sub the subtitles were all placed at the bottom of the page, no matter what the slider position was. I don't know what happened. Maybe I chose parameters that were incompatible with BDSup2Sub. However, I then was able to export the subtiltes as XML/PGN-files. With a simple texteditor I replaced the different Y-values with one. After re-importing the edited XML-file into BDSup2Sub, the Y-values were now all the same (identical to the ones in the edited XML-file!). That was indeed quite straight forward. Dunno why I haven't thought of it myself. Thanks again to both of you! Your programs rule!
MikeEby
25th April 2010, 00:56
:thanks: to 0xdeadbeef, Your app does a great job on Avatar.
http://www.acdnow.com/anothereac3togui/AvatarForcedSub.jpg
Mike
d4eRc
25th April 2010, 21:23
Your Avatar screen looks nice, I extracted the german forced subtitle as idx/sub, but it only shows up white in VLC. It does not show up at all in mplayer (thats probably another thing - any suggestions anyway?).
Do I have to do something special about colors or do you recommend another subtitle format for mkv-Files?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.