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

How to tone map PGS subtitles?

17 Replies, 4213 Views

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.
(This post was last modified: 2020-09-15, 11:29 PM by BDgeek.)
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.
(This post was last modified: 2020-09-16, 08:52 PM by schorman. Edit Reason: more info )
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.
(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.
Hey, I tried to check this tool, but I don't see the .exe file. What am I missing here?

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:
(This post was last modified: 2020-09-18, 12:11 AM by BDgeek.)
(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?

@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?
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.
(This post was last modified: 2020-09-19, 01:05 AM by BDgeek.)
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?

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Help] Trouble with Subtitles kidjupiter92 4 2,632 2022-04-01, 08:43 PM
Last Post: spoRv
  Adding and editing subtitles... Bo Lero 8 962 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 1,145 2021-07-18, 06:48 AM
Last Post: BusterD
  [Help] Frame-accurate subtitles theprion 3 737 2021-05-15, 11:11 PM
Last Post: Beber
  [Help] Enable default subtitles on a Blu-ray NeonBible 5 1,276 2020-10-15, 07:15 AM
Last Post: Doctor M
  MKVmerge and Subtitles PDB 7 2,619 2019-10-30, 04:55 PM
Last Post: PDB
  Options for Removing Burned in Subtitles bronan 1 1,555 2019-01-07, 09:28 PM
Last Post: TomArrow

Users browsing this thread: 1 Guest(s)