View Full Version : Bluray to MKV: Good option for bitmap subs?
ziphnor
27th December 2008, 19:15
I was just wondering how to embed blu ray subtitles in an MKV file (and yes, i did read the two related stickies :).
I have tried the following:
SUPRead -> HD-DVD .SUP export -> SubtitleCreator -> VobSub .idx
SUPRead -> OCR -> SRT
The first works perfectly, but the quality of the subtitles is really horrible (very pixelated ).
The second requires me to manually verify the generated subtitles which i would really like to avoid.
Is there any other way of putting bitmap subtitles into MKV files? And why exactly is it that the VobSub subs looks so bad? I realize that they are probably resized from HD to SD by SubtitleCreator and then from SD to HD during playback, but i still find it odd that they look that bad.
PS: A big thanks to everybody that works on tools such as SubtitleCreator/SUPRead/VobSub/tsmuxer etc.
Rack
28th December 2008, 03:41
Hi ziphnor,
How you've managed to convert your Blue-Ray Subtitle (.SUP) into (.idx/.sub) using this method:
SUPRead -> HD-DVD .SUP export -> SubtitleCreator -> VobSub .idx
because I've tried it, but I'm getting the following error:
Unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately.
Index was out of range. Must be non-negative and less than size of the collection.
Parameter name: index.
If I press details it will show the following:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at SubtitleCreator.SUP.ReturnStrVobSubID()
at SubtitleCreator.SUPPreviewForm.BSaveSUPClick(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
SubtitleCreator
Assembly Version: 2.0.0.0
Win32 Version: 2.0.0.0
CodeBase: file:///C:/Program%20Files/SubtitleCreator/SubtitleCreator.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
DShowNET
Assembly Version: 1.0.0.1
Win32 Version: 1.0.0.1
CodeBase: file:///C:/Program%20Files/SubtitleCreator/DShowNET.DLL
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
ListViewEx
Assembly Version: 1.0.2297.19690
Win32 Version: 1.0.2297.19690
CodeBase: file:///C:/Program%20Files/SubtitleCreator/ListViewEx.DLL
----------------------------------------
SubtitleCreator.resources
Assembly Version: 2.0.0.0
Win32 Version: 2.0.0.0
CodeBase: file:///C:/Program%20Files/SubtitleCreator/en/SubtitleCreator.resources.DLL
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
I don't know, but shouldn't there be a simple way to do it?
turbojet
28th December 2008, 12:18
Are you using the latest SubtitleCreator beta (http://sourceforge.net/project/showfiles.php?group_id=120228&package_id=151984) ?
ziphnor
28th December 2008, 12:27
Hi ziphnor,
How you've managed to convert your Blue-Ray Subtitle (.SUP) into (.idx/.sub) using this method:
SUPRead -> HD-DVD .SUP export -> SubtitleCreator -> VobSub .idx
I replied to your PM, i havent had any issue with this conversion except for the quality of the resulting subtitles.
manusse
28th December 2008, 19:01
@Rack,
Could you please send me (PM) a link to the sup file (rapidshare like) that crashes SubtitleCreator (I need the HD-DVD sup file). I'll try to have a look.
Cheers
Manusse
Rack
28th December 2008, 19:02
Are you using the latest SubtitleCreator beta (http://sourceforge.net/project/showfiles.php?group_id=120228&package_id=151984) ?
I'm using Subtitle Creator V. 2.2
In the latest beta version I couldn't find the option:
Tools -----> Manipulate SUP or VobSub
By the way, I used to have an updated version of .NET (v. 3), but I read in another thread that it is causing problems with Subtitle Creator. I'm having now .NET (v. 2), but that didn't help me much. I'm still getting the same error message.
Rack
28th December 2008, 19:07
@Rack,
Could you please send me (PM) a link to the sup file (rapidshare like) that crashes SubtitleCreator (I need the HD-DVD sup file). I'll try to have a look.
Cheers
Manusse
Thanks for your reply manusse,
I've sent you the requested file.
manusse
28th December 2008, 19:48
In the latest beta version I couldn't find the option:
Tools -----> Manipulate SUP or VobSub
See here:
http://forum.doom9.org/showthread.php?p=1159772#post1159772
cheers
Manusse
Rack
28th December 2008, 20:36
See here:
http://forum.doom9.org/showthread.php?p=1159772#post1159772
cheers
Manusse
I figured so, but when I'm trying to open the HD-DVD .SUP file it gives me the following error:
This .sub file is not a valid VobSub .sub file (this may be a MicroDVD .sub file)
I hit OK and another error message pop up:
Error reading file: C:\[path]\00011.BD.23.976.sup
manusse
28th December 2008, 20:52
This is because BD-SUP files are not supported yet.
Manussee
Rack
29th December 2008, 01:07
I've managed to convert the Blue-Ray .SUP file eventually to .idx/.sub file. It turned out that I overlooked a step that ziphnor told me about:
1. Opened SUPRead version 0.52b2
2. Under options selected "Stream Exp." as HD DVD
3. Opened the .SUP file you send me
4. Clicked "Export sup" (creates file "00011.HDDVD.23.976.sup")
5. Opened SubtitleCreator version 2.2
6. Navigated to Tools->Manipulate SUP or VobSub
7. Clicked Open Sub. and selected "00011.HDDVD.23.976.sup"
8. After waiting for the import to finish, clicked "Save sub."
and I used the latest beta version as well.
Thanks for ziphnor & manusse for their kind support.
By the way the resulting .idx/.sub is acceptable for me. Although I think it could be better :)
ziphnor
29th December 2008, 12:20
By the way the resulting .idx/.sub is acceptable for me. Although I think it could be better :)
Good to hear that you got it working.
As to the quality, it varies a bit based on the font used in the original subtitles.
I would like an answer to my original question however ( the thread seems to have been hijacked a little bit ;) Ie, Is there any better way of obtaining subtitles for inclusion in the MKV than what i have described above?
Taktaal
29th December 2008, 19:58
There is afaik no other bitmap based subtitle format with wide mediaplayer support.
quantum
30th December 2008, 05:15
Is there any other way of putting bitmap subtitles into MKV files? And why exactly is it that the VobSub subs looks so bad?
You've found the only technique that I'm aware of. The quality issue comes from downsizing HD subs to SD resolution. This is necessary because SD sub/idx is the only subtitle bitmap format recognized by HTPC software, such as Media Player Classic, VLC, etc. It also works with a few hardware players.
Otherwise you have to use SRT.
Regarding the quality, I wonder if it can be improved using a smoothing algorithm when downsizing? Maybe a softer look would be preferred to a blocky look.
Currently, only SubtitleCreator can generate the sub/idx output from an HD source, so Manusse would have to help us out with this if it is possible and if he is willing.
ziphnor
30th December 2008, 10:59
The quality issue comes from downsizing HD subs to SD resolution
I guessed as much, but there is a question of just how the down-scaling is handled.
Regarding the quality, I wonder if it can be improved using a smoothing algorithm when downsizing? Maybe a softer look would be preferred to a blocky look.
A softer look would be preferable IMO. It might not even be necessary with a smoothing algorithm as such, perhaps a better downscaling algorithm will be sufficient?
Currently, only SubtitleCreator can generate the sub/idx output from an HD source, so Manusse would have to help us out with this if it is possible and if he is willing.
It would be great if he could.
Taktaal
30th December 2008, 13:58
The main quality problem is that idx/sub doesn't support partial transparency. So no matter what you do, the edges of the letters are always going to look like crap. And for letters the edges are the only really important thing. Imo unless you use some exotic alphabet like chinese or arabic where OCR is impossible, you're better off converting to SRT.
manusse
30th December 2008, 19:43
Hi,
Let me explain the conversion process applied inside SubtitleCreator when importing HD-DVD subtitles.
First, the subtitles are opened full def by SubtitleCreator (internally). Then are then downsized to SD definition (depending on SC's config 720x480 or 720x576). The algorithm used is nearest neighbor from .NET framework because it's the fastest one and in my tests I didn't notice any visible difference with the other algorithms possible. Finally I've written an algorithm that reduces the colors to the 4 (including background) because sup and idx/sub subtitles don't support more and creates the corresponding palette. The original transparency settings are not preserved except for the background.
I don't really see how I could improve the translation because the problem comes from the 4 colors allowed by the sub/idx.
Cheers
Manusse
ziphnor
30th December 2008, 20:42
Imo unless you use some exotic alphabet like chinese or arabic where OCR is impossible, you're better off converting to SRT.
The problem is just that OCR requires that you manually verify all the subtitles. The vobsubs would have to look a lot worse for me to bother with that :)
ziphnor
30th December 2008, 20:56
I don't really see how I could improve the translation because the problem comes from the 4 colors allowed by the sub/idx.
I understand, with 4 colors and no partial transparency there really isnt much that can be done with regards to softening :)
I also noticed that the quality of the resulting vobsubs depend alot on the font used in the input. Some of the Blu rays i tried after posting actually looked pretty decent.
Regardig the scaling: Is the image scaled before or after being forced to 4 colors, and what exactly is done with any partially transparent pixels?
Btw, i might be complaining about my vobsubs, but i am in fact very happy that Subtitle creator supports creating vobsubs from HD-DVD subs! So a big thanks to you and the other developers on it:) :thanks:
manusse
30th December 2008, 21:54
Regardig the scaling: Is the image scaled before or after being forced to 4 colors, and what exactly is done with any partially transparent pixels?
As explained above the image is first being rescaled then being forced to 3 colors plus a transparent background.
The partially transparent pixels are forced to opaque.
However in most of the HD-DVD sup samples I've seen, a lot of colors are used but partial transparency is not very common. Do you confirm or do you think it's not the case?
If I would like to conserve the transparency information this would be very difficult. Let me explain why. When I reduce the colors to 3, I first look at which color of the shrunk HD-DVD sup is the darkest and which one is the brightest. I then compute an intermediate color that is the mean of those 2 colors. This will be my 3 final colors used in the SD sup (or sub/idx). Then for each pixel if it is not transparent, I test its brightness (System.Drawing.Color. : The brightness ranges from 0.0 through 1.0, where 0.0 represents black and 1.0 represents white.). If the brightness is <0.2, then I replace it by the darkest color of my palette, if the brightness is >0.7, then I replace it by the brightest color of my palette else by the mean color.
Now, if I were to conserve the transparency how would I proceed knowing that the number of input colors can be 255 which can all have their own transparency? I think this is impossible. If you have any idea on this subject I am interested.
Cheers
Manusse
quantum
31st December 2008, 00:21
As explained above the image is first being rescaled then being forced to 3 colors plus a transparent background.
The partially transparent pixels are forced to opaque.
I think the way you're doing it in regards to transparency is fine. I'd like to confirm it's 3 colors + 1 for transparency? No way to use all 4 for the sub? I'm asking because the 4th color makes a big difference for dithering. In either case, I'm putting together a few samples in Photoshop, using 3 and 4 colors. While it may not be easy to programmatically reproduce what can be done in Photoshop, some samples of what is possible may be interesting.
quantum
31st December 2008, 01:19
Here are some tests I made in Photoshop.
The original is from 1920x1080 extracted with SUPread.
http://img519.imageshack.us/img519/4274/line0029croppedsa1.png
This is resized down to 720x480 using bicubic smoother in Photoshop:
http://img201.imageshack.us/img201/716/line0029resizedbicubicsym0.png
Now this is reduced to 4 colors:
http://img156.imageshack.us/img156/3191/line00294colorqp2.gif
And 3 colors: (hope we can keep 4)
http://img71.imageshack.us/img71/5807/line00293colorrg3.gif
You can verify the above two images have 4 and 3 colors using Irfanview, or take my word for it ;-)
Note that these images have been cropped to make them postable, but the original sizes are correct and cropping does not affect the colors or quality.
quantum
31st December 2008, 01:38
...Imo unless you use some exotic alphabet like chinese or arabic where OCR is impossible, you're better off converting to SRT.
Agreed that SRT is ideal in terms of visual quality. However if bitmaps can be done with reasonable quality, then it becomes interesting as they can be done more automatically. Symbols like the music note symbol, accented characters, etc are no longer a problem. Multiple positioned subs are possible (right?). Ultimately it would be nice to have it run in a batch file.
manusse
31st December 2008, 16:49
Hi,
It's only 4 colors. As one is a transparent background, there remain only 3 for the text. You know it's old DVD specs back from 1995 or even earlier.
Cheers
Manusse
quantum
31st December 2008, 18:23
Hi,
It's only 4 colors. As one is a transparent background, there remain only 3 for the text. You know it's old DVD specs back from 1995 or even earlier.
Cheers
Manusse
Actually I think it's okay. I think the results can be similar to the 4 color sample above. The 4th transparent color is actually used in the softening when correctly applied, which I did not do in the 3 color sample.
Is there any way we can provide our own images (3 colors + transparency=4 colors total) to create the sub/idx? I know this would not be the ideal route, but it would be interesting to see what would be possible.
Both Photoshop and Irfanview offer automation routines to process large numbers of images.
manusse
1st January 2009, 20:01
Hi,
Is there any way we can provide our own images (3 colors + transparency=4 colors total) to create the sub/idx?
Look at this thread: http://forum.doom9.org/showthread.php?t=143576
Cheers
Manusse
quantum
1st January 2009, 20:58
Thanks. I'll give that a try.
For those interested, v1.2.908 of Media Player Classic Home Cinema has this in the release history (http://mpc-hc.sourceforge.net/History.html):
- Support for M2TS presentation graphics streams (only for EVR Custom and VMR9 Renderless)
I've just started playing with this. It was a pain to get it working, and I'm still working on it, but I have muxed a M2TS along with a sup file demuxed using eac3to, and it does work.
This would obviously be ideal. Of course this is for PC's only. Now if only Syabas would incorporate this into the Popcorn Hour, everything would be perfect.
saint-francis
1st January 2009, 23:18
While I agree that being able to use the original .sup would be ideal, the enormous overhead of .m2ts makes it not an option for me and probably many others.
quantum
1st January 2009, 23:31
While I agree that being able to use the original .sup would be ideal, the enormous overhead of .m2ts makes it not an option for me and probably many others.
If it can work in a M2TS, why not in a MKV? This does seem like the first support for the PGS subtitle format. Hopefully in time it can be extended to support MKV.
I'm not sure if a SUP can even be muxed into an MKV yet. My quick test with mkvmerge 2.40 did not work.
saint-francis
1st January 2009, 23:36
I'm not sure if a SUP can even be muxed into an MKV yet. My quick test with mkvmerge 2.40 did not work.
Can't be done....yet, Maybe never. I don't know. But .sup playback in .m2ts works fine. I have watched movies with subtitles directly from a BD .m2ts several times quite successfully.
quantum
1st January 2009, 23:39
...I have watched movies with subtitles directly from a BD .m2ts several times quite successfully.
Using MPC?
saint-francis
2nd January 2009, 02:01
Using MPC?
Yes.
<Inserted because the forum doesn't allow one word responses>
quantum
2nd January 2009, 05:30
Hi,
Look at this thread: http://forum.doom9.org/showthread.php?t=143576
Thanks for the help, but I'm afraid I'm at a dead end. While I could get SubtitleCreator to import my images and create a vobsub output, I could not figure out how to avoid the stretching and warping it insisted on doing to my images as they displayed in MPC. The same subs converted from HD sup using SubtitleCreator's conversion process looked normal and proportional.
Maybe I'm not understanding the basic functionality, as the program is obviously designed for much more than simple vobsub compiling, and I'm probably trying to do something unusual.
I do believe the concept is sound. From what I was able to see in my tests, a well Photoshopped subtitle image can produce very reasonable output, better than the algorithm used by SubtitleCreator in the HD sup conversion.
This is a sample transparent gif in case anyone else cares to try:
http://img363.imageshack.us/img363/9514/line0001ds3.th.gif (http://img363.imageshack.us/my.php?image=line0001ds3.gif)
I believe the image is proportional to the original 1920x1080. In my experiments with SubtitleCreator, I tried all different sizes and crops with the image, and the settings within the program. In every case, the output looked good, but it was warped or stretched in some way, to the point it was unusable.
I also think the quality of the downsampled sub might be improved in Photoshop by further tweaking the downsampling process, but I gave up as I couldn't get even the first attempt to work.
It would be nice to further these tests if a vobsub sub/idx could be compiled from consistently sized images, say 720x480 or whatever they should be. This would allow an automatic process from downsampled 1920x1080.
pattana
11th January 2009, 13:26
Any tool convert series of images( PNG ) to SUP file?
colemar
2nd August 2009, 01:32
BDSup2Sub seems to be able to convert .sup (PGS from 1080p bluray) to .sub/.idx (vobsub) with almost no loss of quality.
http://forum.doom9.org/showthread.php?t=145277
You can set the output resolution to 1920x1080.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.