Hello guest, if you like this forum, why don't you register? https://fanrestore.com/member.php?action=register (December 14, 2021) x


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to tone map PGS subtitles?
#1
After finding some on-line releases that use BD extracted subtitles (in .sup format) and tone map it to the exact same color of the UHD-BD release, I was really intrigued and eager to perform this kind of conversion.

The best solution I could find so far is this tool:
https://github.com/quietvoid/subtitle_tonemap

It's indeed an easy to use and works. The problem is that apparently it doesn't allow the user to change the tone mapping parameter. It defaults to a dark gray, while most of the original UHD-BD subtitles have a lighter shade of gray.

Since it's based on BDsup2sub, there's probably a way to do it in this program. But I couldn't really find out how. The best I could is described bellow, but when you load the .idx file it's clear that it looses quality in a way I can only describe as presentiing jaggies or stairstepping effect. 

- load a blu-ray sup file
- export it as SUP/IDX
- load the exported sup/idx file
- change the palette mode to 'Create new'
- check the colors in use under 'Edit DVD Frame Palette'
- edit the palette under 'Edit imported DVD palette'
- export it back as SUP(BD).


The subtitles from the on-line releases don't have this downside.

Has anyone performed this conversion or know how to do it? 
Any help will be much appreciated.
Reply
Thanks given by:
#2
I've got some photoshop droplets (executables) that I set up for converting between tonemapped and non-tonemapped png subtitles.  The gist of it is, that you can use Photoshop to process the images one by one in a batch process, in png format, then use BDSup2Sub to convet them back to a .sup file.

Having looked at the tool, I'm pretty sure it's not using a SUB/IDX intermediate step, because the color palette of the output is not limited in the same way that it would be in that case.  Based on the behavior, I'd say it uses BDSup2Sub to output in XML/PNG format, then it changes the color palette somehow, then it uses BDSup2Sub to output in the .SUP format again.

This tool is much, much faster than the photoshop method I've been using, so that's an improvement.  Unfortunately, I doesn't seem to allow conversion from a tonmapped source (gray) to a non-tonemapped output (white).  Also, did you notice that there is a switch that lets you change the tonemapping percentage?  The default is 60%, but I think 75% matches closer to what I see on retail UHD releases.

So, you would just use something like below to get a bit lighter output:

subtitle_tonemap.exe "path/to/subtitles" -o tonemapped -p 75


Edit:

To match the 2020 Star Wars UHD's, use "subtitle_tonemap.exe "path/to/subtitles" -o tonemapped -p 70.6" to set the white level at 180 from 255.

I should also mention that some of the officially released tonemapped subs seem to also have a slightly raised black level, but that seems more variable between titles and less important than the white levels. This tool does not seem to adjust the black level, it's just effectively a tool to darken the input subs.
Reply
Thanks given by: BDgeek , resolution
#3
Great! Thanks a lot schorman!!!

I'll try it right away. The level that Disney uses on their recent subtitles is exactly what I was trying to achieve.
Reply
Thanks given by:
#4
(2020-09-16, 10:26 PM)BDgeek Wrote: Great! Thanks a lot schorman!!!

I'll try it right away. The level that Disney uses on their recent subtitles is exactly what I was trying to achieve.

After looking through the code, I can confirm that it's simply taking each pixel and multiplying its RGB values by the percentage you give it, to effectively darken them.

It should be possible to add code that would make it possible to adjust the black level as well. I might be able to make that work.
Reply
Thanks given by: BDgeek
#5
Hey, I tried to check this tool, but I don't see the .exe file. What am I missing here?
Reply
Thanks given by:
#6
allldu,

just place the "subtitle_tonemap" downloaded file on the BDsup2sub folder and use the command line. It will create a a directory named "tonemapped" on the same folder where the output file will be placed.

Now, if what you mean is that you couldn't find the file to download, it's on the rigth side of the page under "Releases" named "0.2.0". Click there and you'll be taken to the download page. But I'll place the direct link bellow:
https://github.com/quietvoid/subtitle_to.../tag/0.2.0
Reply
Thanks given by: allldu
#7
(2020-09-17, 09:25 PM)allldu Wrote: Hey, I tried to check this tool, but I don't see the .exe file. What am I missing here?

https://github.com/quietvoid/subtitle_tonemap/releases
Reply
Thanks given by: allldu
#8
@BDgeek, @schorman - thanks guys, works like a charm! But is there a way to know what white level do the original susb have, if I wanna duplicate them with this tool?
Reply
Thanks given by:
#9
Hi allldu

schorman cracked this one also, I'll replicate his instructions bellow

"I use the eyedropper tool in photoshop to sample a pixel that I want it to match, for instance the white level of the Star Wars UHD subs came out to be 180.
I do the same thing with the Blu Ray subs I'm trying to fix. For example the Blu Ray subs for Star Wars are totally white, at 255.
Then it's just a matter of calculating the percentage: 180/255=.706 after rounding, which you need to enter as a percentage "-p 70.6".

Just to complement these instructions, on BDsup2sub you can export the subtitles in PNG format so you can load them into photoshop or just take a print screen to open it in the program.
Reply
Thanks given by: allldu , resolution
#10
Thanks @BDgeek, that makes sense, yeah. But what about HDR to SDR conversion when talking about UHD? Does the subs white level still stay correct when I take a screenshot to upload it to Photoshop?
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding and editing subtitles... Bo Lero 8 4,476 2021-09-19, 08:48 AM
Last Post: Bo Lero
  Is there any tool to edit and resynchronize Blu-ray PGS SUP subtitles? Onti 2 2,405 2021-07-18, 06:48 AM
Last Post: BusterD
  [Help] Frame-accurate subtitles theprion 3 2,229 2021-05-15, 11:11 PM
Last Post: Beber
  [Help] Enable default subtitles on a Blu-ray NeonBible 5 3,234 2020-10-15, 07:15 AM
Last Post: Doctor M
  MKVmerge and Subtitles PDB 7 4,867 2019-10-30, 04:55 PM
Last Post: PDB

Forum Jump:


Users browsing this thread: 1 Guest(s)