View Single Post
Old 20th June 2015, 07:32   #406  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
OK, indeed, there is a problem with your SUP file. It is caused by another terrible bug in BDSup2Sub. Unfortunately, I can't do much to fix it, although I have a workaround that may work when converting it to VobSub.

The problem:

When a 2D SUP is converted to 3D, several dirrerent conversions must be made:
1. Convert the original SUB to 2D XML/PNG with BDSup2Sub: No problem.
2. Convert the 2D XML/PNG to 3D with ImageMagick (and BD3D2MK3D): No problem.
3. BD3D2MK3D analyses the PNGs to generate a 16-colours palette (used only when converting to VobSub but generated anyway).
4. Convert the 3D XML/PNG to the final 3D SUP or VobSub file with BDSup2Sub: Bug!

Conversion to 3D BD SUP:

In step 4, BDSup2Sub must convert the 3D PNGs (with white characters, a black background and a black outline) to the output subtitle format. It doesn't use the palette to convert to SUB.

There is no need to change the colours of the original PNGs, since the SUP format supports 16 millions of colours and 256 levels of transparency. In other words, BDSup2Sub should simply copy the content of the PNGs in the subtitle stream, without modifying it. But it's not what it does! For whatever reason (probably due to the semi-transparency of the shadow), it changes the colour of the shadow from pure black to grey! That's a terrible bug!

You can verify that steps 1 and 2 give perfect results by converting your SUP to 3D XML/PNG. Then load the PNG files in an image editor, and you'll see that the outline is black. Totally black. There is no problem in the 3D PNGs. However, if you load the XML/PNG stream in BDSup2Sub, the outline is "converted" to gray, without any reason to do so. That's the bug.

Unfortunately, I have absolutely no way to fix that problem with a workaround. Since there is no way to force BDSup2Sub to change its palette when it converts to SUP format (because it doesn't need a palette), the result is dependent of BDSup2Sub only, and unfortunately, with your precise input SUP stream, it fails to render the colours correctly. We have to live with that bug.

Conversion to 3D VobSub:

When the XML/PNG stream is converted to VobSub format, BDSup2Sub must reduce the 16 millions of colours of the PNGs to the 3 colours of the VobSub format. It uses normally its internal palette, but it is usually not perfect for a specific stream. Therefore, in step 3, BD3D2MK3D analyses the PNGs and tries to generate a palette that contains better colours, and it passes that palette to BDSup2Sub during step 4 to force it to use the right colours. That works usually well, but not in this case.

With this SUP stream, there are only two colours: the white of the characters (in fact a very light grey), and the pure black shared by the outline and the shadow. During its analyse, BD3D2MK3D finds the two colours. It changes the white to force the light grey used really by this SUP file, and it leaves the black alone. (The black cannot be changed anyway.) It doesn't try to change the other colours (notably the dark grey), because there is no reason to suppose that BDSup2Sub will use them. However, due to the bug explained above, it uses the dark grey for the outline instead of the black.

So, I have slightly modified the logic of the palette analysis. Now, if the dark grey is really used in the PNGs, than its colour is modified normally, and we can hope that BDSup2Sub will use it when necessary. In the case of this SUP file, there is no dark grey in the PNGs, and therefore at the end of the analysis, the dark grey colour has not been modified in the original palette. When BD3D2MK3D detects this, it assumes that the bug described above can happen, and it changes the dark grey to black. That forces BDSup2Sub to replace the wrong grey it uses for the shadow with an (almost totally) black shadow.

It seems that this method works well, and I did a few tests with other streams as well. Currently, it seems that the other streams are still well converted to VobSub, and therefore that the modification I did has not broken something.

Conclusion:

The next version of BD3D2MK3D will have a workaround for the BDSup2Sub palette bug, but it works only for the conversions to VobSub. Unfortunately, there is no way to fix the palette bug happening when converting to BD SUP.

In the meantime, it is easy to "fix" the colours of the final 3D VobSub file with BDSup2Sub. Just load the stream, go to Edit -> Edit Default DVD Palette, click on the "dark grey" slot, select black in the palette (in the lower left corner), OK the two dialogues, be sure to select "SUB/IDX" for the Output Format and export the file. (It is also possible to fix the dark grey colour by editing the original IDX file, if you prefer. Simply change the "999999" with "000000" in the line beginning with "palette:".)

Help needed:

Of course, if someone can try to fix the bug in the source code of BDSup2Sub.jar, I would be very grateful. I don't know Java and I don't have the Java programming environment, but I can explain how to fix the bug and test beta versions. Someone is interested?
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline