Jump to content

Tone-mapping in transcoding HDR for playback on SDR screens??


griffindodd
Go to solution Solved by Luke,

Recommended Posts

RDHoworth

Hi,

 

That is what I hoped for and always expected from Emby. I have always expected that advanced feature such as this would require higher end hardware.

 

Regards Richard

  • Like 1
Link to comment
Share on other sites

vdatanet
5 minutes ago, softworkz said:

@vdatanet - Could you please also show the ffmpeg command lines for the examples you have posted?

Target 15 Mbps:

/usr/lib/jellyfin-ffmpeg/ffmpeg -hwaccel vaapi -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device opencl=ocl@va -hwaccel_device va -hwaccel_output_format vaapi -filter_hw_device ocl -i file:"/media/4k/Vertigo [4K UHDremux][HDR10][Castellano DTS 2.0-Ingles DTS-HD 2.0+Subs][ES-EN]/Vertigo 4Kremux2160.pctfenix.com.mkv" -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_vaapi -mpegts_m2ts_mode 1 -force_key_frames "expr:gte(t,n_forced*5)" -vf "scale_vaapi=w=1920:h=1080:format=p010:out_range=limited,hwmap,tonemap_opencl=format=nv12:primaries=bt709:transfer=bt709:matrix=bt709:tonemap=hable:desat=0:threshold=0.8:peak=100,hwmap=derive_device=vaapi:reverse=1" -copyts -avoid_negative_ts disabled -start_at_zero -b:v 14616000 -maxrate 14616000 -bufsize 29232000 -profile:v:0 high -level 41 -vsync -1 -map_metadata -1 -map_chapters -1 -threads 0 -codec:a:0 aac -ac 2 -ab 384000 -af "volume=2" -y "/var/lib/jellyfin/transcodes/fa3e834e2c806add73e8082a3623d58a.mkv"

Target 20 Mbps:

/usr/lib/jellyfin-ffmpeg/ffmpeg -hwaccel vaapi -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device opencl=ocl@va -hwaccel_device va -hwaccel_output_format vaapi -filter_hw_device ocl -i file:"/media/4k/Vertigo [4K UHDremux][HDR10][Castellano DTS 2.0-Ingles DTS-HD 2.0+Subs][ES-EN]/Vertigo 4Kremux2160.pctfenix.com.mkv" -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_vaapi -mpegts_m2ts_mode 1 -force_key_frames "expr:gte(t,n_forced*5)" -vf "scale_vaapi=w=2560:h=1440:format=p010:out_range=limited,hwmap,tonemap_opencl=format=nv12:primaries=bt709:transfer=bt709:matrix=bt709:tonemap=hable:desat=0:threshold=0.8:peak=100,hwmap=derive_device=vaapi:reverse=1" -copyts -avoid_negative_ts disabled -start_at_zero -b:v 20616000 -maxrate 20616000 -bufsize 41232000 -profile:v:0 high -level 41 -vsync -1 -map_metadata -1 -map_chapters -1 -threads 0 -codec:a:0 aac -ac 2 -ab 384000 -af "volume=2" -y "/var/lib/jellyfin/transcodes/86e0217dbb8ef1b04c497346795df794.mkv"

I think this is cause why 20 Mbps needs more power, it's scaled to a larger size and then tone mapping requires more resources.

scale_vaapi=w=2560:h=1440

 

Link to comment
Share on other sites

OK, thanks, these command lines are showing hardware accelerated tone-mapping. 

I wanted to clear this up, because you had posted this in a context where we had talked about CPU-based tone-mapping which is a very different thing.

  • Like 1
Link to comment
Share on other sites

On 1/8/2021 at 10:11 AM, Luke said:

HDR Tone mapping when transcoding will be in Emby Server 4.6. Stay tuned to the beta channel over the next week if you'd like to help test.

It's 1/25, still holding my breath...

Link to comment
Share on other sites

9 minutes ago, jfw2600 said:

It's 1/25, still holding my breath...

Ready, 3, 2, 1, BREATH
Don't hold your breath, I hear that's not good for you long term. :)

Link to comment
Share on other sites

sooty234

Will we have the choice of algorithm? Because that's using hable, which is crappy. Reinhard with a param of 0.6 is a much better choice.

Link to comment
Share on other sites

It's definitely a personal choice what you like. Reinhard is the most simplistic of the algorithms which tends to over iluminate whites and desaturate blacks, uses nonlinear contrast, which results in flattening details and degrading color accuracy.. Reinhard doesn't make use of the low dynamic range well which is why a lot of people don't like it and you lose detail. Hable preserves both dark and bright details better than reinhard, at the cost of slightly darkening everything.

Of what's built into ffmpeg I think I like mobius better then both mentioned so far as it does a better job retaining contrast and colors but it favors color accuracy over detail preservation.

But again it's personal, depends on your equipment and calibration and just personal judgement what each person likes best.

Since most of what I'd watch in 4K are cinematic movies I think if I had a choice and could lock in one tone mapping curve to use for all transcoding I'd go for ACES which I think does the best job all around and brings out the most detail.

Reinhard.thumb.png.aa305d4fb2938665cc22248ffdb04b18.pngACES.thumb.png.f16865dd8531874f2ee7434031ced665.png

Reinhard on the left & ACES on the right.

Part of the problem is different media might look better with a different tonemap filter depending on how it's authored so there will never be a "correct choice" just the choice you like best. It's always compromise compared to watching it in 4K HDR or using a professionally color corrected 1080p.

I'm not sure if you're going to have a choice in the first release or not or if everyone will be using the same filter to get some testing done. We'll find out soon enough.

 

Link to comment
Share on other sites

sooty234

The goal is to match the SDR studio mastering. You need to use that as a baseline. I'll use Tenet as an example.

Studio SDR mastering. Nice and bright for an SDR TV.893336879_1TenetstudioSDRnoconfig.thumb.jpg.e2ff02884a98122bf1cdd36bf0f298c4.jpg

 

Reinhard @ default param (0.5) Notably darker (look at the blue jacket), but still fairly close to the SDR master.

982058_2Reinharddefault.thumb.jpg.49528fe95b62c31e17f8268f36e3751b.jpg

 

Reinhard with param 0.55 Closer to the SDR master.

759513644_Reinhard0_55.thumb.jpg.785807a9a6367770eabf0b950aa183df.jpg

 

Reinhard with param 0.6.

502107909_ReinhardTMP0.6.thumb.jpg.52c7a0e29784cee2d7e6449df2b572d2.jpg

 

Hable, is considerably darker than the SDR master and is not tunable.

Hable.thumb.jpg.d8f1f39d6728eb7b7622afff322841ff.jpg

 

Mobius (default params) Also darker than SDR mastering, but is tunable. 

mobius.thumb.jpg.b5c9fc86ff305964081b2451169e0cfe.jpg

 

This is why I asked if we would be given options. So that we can choose what we prefer. Giving only one option, wouldn't be a good thing.

 

Link to comment
Share on other sites

Thanks for those pics.

I agree with you looking at those pics the Reinhard looks closest for that movie in that scene to the studio version.  I think sometimes it also better to just view them as video vs just static pictures but that's pretty hard to do on a forum in a meaningful way.

We definitely will have options to choose for sure.  I just don't know if they will be there for the first round of testing as I have not seen a UI for it's setup yet. The first round could be more geared toward working out any issues with different CPU/GPUs then anything else technical wise.  I'm sure there will be some quirks with different systems/drivers that will need discovering in beta.

I've not watched this movie yet, how was Tenet?
Is it a Friday night break out the popcorn and watch movie?

Link to comment
Share on other sites

sooty234

Tenet is wonderfully complex. The critics hate it because it doesn't really explain itself. You have to pay attention and have a working knowledge of the 2nd law of thermodynamics/entropy. If you get distracted, you'll likely get lost in what's happening.

Link to comment
Share on other sites

3 hours ago, Gee1 said:

when we will se hw acc. tone mapping in an emby finial version ?

This will likely be like other releases where there are several betas with new features or fixes and after several betas are released and no issues remain it becomes the  release version.

Link to comment
Share on other sites

12 hours ago, sooty234 said:

Will we have the choice of algorithm? Because that's using hable, which is crappy. Reinhard with a param of 0.6 is a much better choice.

In the main UI we will have on/off for hw tone mapping and separate on/off for cpu tone mapping.

Algorithm selection and parameter selection will be possible via Diagnostics plugin (but no saving across restarts).

That's how it will be in the initial beta, then we will see where to go from there.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

sooty234
7 minutes ago, softworkz said:

In the main UI we will have on/off for hw tone mapping and separate on/off for cpu tone mapping.

Algorithm selection and parameter selection will be possible via Diagnostics plugin (but no saving across restarts).

That's how it will be in the initial beta, then we will see where to go from there.

That's reasonable. And I should have been more specific in my question. I meant in the final solution, and not in early beta. So once released to stable, we would have the options.

Link to comment
Share on other sites

1 minute ago, sooty234 said:

That's reasonable. And I should have been more specific in my question. I meant in the final solution, and not in early beta. So once released to stable, we would have the options.

I have already given the best answer to this - as of now:

11 minutes ago, softworkz said:

then we will see where to go from there

 

Link to comment
Share on other sites

vdatanet

Will tone mapping also be applied to thumbnails generation (as option)? HDR media thumbnails are not flashy.

Link to comment
Share on other sites

6 minutes ago, vdatanet said:

Will tone mapping also be applied to thumbnails generation (as option)? HDR media thumbnails are not flashy.

You mean when these can't be pulled down from a meta-data provider?

Link to comment
Share on other sites

vdatanet
7 minutes ago, cayars said:

You mean when these can't be pulled down from a meta-data provider?

No, chapter thumbnails:

1887177808_Capturadepantalla2021-01-26202310.thumb.png.6b84f2d5b26ecab63744f1e358e9f202.png

Look at Groot tone mapped:

1038803501_Capturadepantalla2021-01-26202805.png.355e1b8a70e8533824c546ec878e6b81.png

Edited by vdatanet
  • Like 1
Link to comment
Share on other sites

Ahh, ok, that's something we'll have to likely evaluate after the Tone Mapping gets some testing but should be possible.

Link to comment
Share on other sites

arrbee99

Bit pointless but I made them now (and I don't like to miss out on stuff)...

HDR -

435547419_EmbychapterthumbnailsHDR.thumb.JPG.bf00c1bd109019a03aab15e1de2723cd.JPG

non HDR -

1104930866_EmbychapterthumbnailsnonHDR.thumb.JPG.db34e0808856babaddd9604b01366b09.JPG

 

Link to comment
Share on other sites

RanmaCanada
On 19/01/2021 at 01:26, RDHoworth said:

Again, why are we getting hung up on what hardware is needed? If we have the hardware, then we should be able to use it, if not, then that feature would not be available. Many people who use Emby are enthusiasts who want the best in Home Cinema, and not just cater to the lowest common denominator. Many users have used GPU acceleration for many years, and it is clear that this provides far more efficient transcoding capabilities than CPU only. 

if they had the best in Home Cinema they would not need this.  4k should never be transcoded, EVER.  People should honestly have 2 separate libraries and only give access to those users who can direct play 4k content.  That is my PERSONAL informed opinion.  

  • Like 3
  • Thanks 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...