Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to tone map PGS subtitles?
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:

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.
Thanks given by:
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


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.
Thanks given by: BDgeek , resolution
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.
Thanks given by:
(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.
Thanks given by: BDgeek
Hey, I tried to check this tool, but I don't see the .exe file. What am I missing here?
Thanks given by:

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:
Thanks given by: allldu
(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?
Thanks given by: allldu
@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?
Thanks given by:
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.
Thanks given by: allldu , resolution
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?
Thanks given by:

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Help] Frame-accurate subtitles theprion 3 310 2021-05-15, 11:11 PM
Last Post: Beber
  [Help] Enable default subtitles on a Blu-ray NeonBible 5 460 2020-10-15, 07:15 AM
Last Post: Doctor M
  MKVmerge and Subtitles PDB 7 1,801 2019-10-30, 04:55 PM
Last Post: PDB
  Options for Removing Burned in Subtitles bronan 1 1,120 2019-01-07, 09:28 PM
Last Post: TomArrow

Forum Jump:

Users browsing this thread: 1 Guest(s)