Jump to content

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


griffindodd
Go to solution Solved by Luke,

Recommended Posts

That CPU should easily handle most if not all HDR tone maps for a single stream.  At least it has for others.
 My 1st gen i7 at 2.8GHz is fast enough to handle a single stream tonemapped to 1080p.

For software tone mapping you can control the upper limit of resolution being converted to as well.

EDIT: but that likely wouldn't help here at all as software and Nvidia tone mapping is probably fine but only an issue with the Intel HW being used.
There is no setting for "Reinhard at 0.6".  It's just Hable, Reinhard or Mobius choices for now.

Edited by cayars
Link to comment
Share on other sites

sooty234

It's got nothing to with processing power, it's just broken. I've tested most of the options, also with the plugin, and none of it affect the output resolution I was getting. That said, I only tested in browser, so there may be some issue with that. Didn't have time to run a full battery of testing.

Emby isn't providing the tuning options but they exist. Default reinhard is 0.5, it's good, but 0.6 is just a little brighter, and I find that it's a better picture.

https://ffmpeg.org/ffmpeg-filters.html#Options-2

Link to comment
Share on other sites

vdatanet
43 minutes ago, sooty234 said:

That second picture looks like it isn't tone mapping. Reinhard at 0.6 would be what I would recommend.

I can't test this with hardware acceleration as my beta is running on an i7 6700k (Windows 10l, but software tone mapping is very far away from being useable. Aside from the color issues, it doesn't obey resolution settings at all. It always transcodes down to 720x404 or less. 

I would even go so far as to say that it even looks better without tone mapping.

Tone mapping disabled:

2070925991_Capturadepantalla2021-04-29193801.thumb.png.bd5bbf68fb19c37efd29bbd16e00954f.png

VAAPI Open CL:

emby2.jpg.8e23f98579c83310268e3e069d755807.thumb.jpg.e35f8dbde1b823e930ba0de2865abe26.jpg

Link to comment
Share on other sites

rbjtech
5 minutes ago, sooty234 said:

It's got nothing to with processing power, it's just broken. I've tested most of the options, also with the plugin, and none of it affect the output resolution I was getting. That said, I only tested in browser, so there may be some issue with that. Didn't have time to run a full battery of testing.

Emby isn't providing the tuning options but they exist. Default reinhard is 0.5, it's good, but 0.6 is just a little brighter, and I find that it's a better picture.

https://ffmpeg.org/ffmpeg-filters.html#Options-2

Have you looked at the Diagnostics plugin ?

It will allow you to modify any of the ffmpeg parameters (grabbed out the ffmpeg log) you like used during the transcoding process - using a search and replace type mechanism.

So if @softworkz is using 0.5, you should be able to replace it with 0.6 with ease.

These are only development options - so I'm not sure you can save them as global settings, but it's certainly useful for experimenting.

Capture.PNG.1d57a4a65340066d1a661cdb19a36a73.PNG

 

 

Link to comment
Share on other sites

sooty234

Yup, carlo can play around with that, I don't need to. I have other ways to test the parameters. My main issue is the output resolution.

Link to comment
Share on other sites

48 minutes ago, sooty234 said:

Emby isn't providing the tuning options but they exist. Default reinhard is 0.5, it's good, but 0.6 is just a little brighter, and I find that it's a better picture.

https://ffmpeg.org/ffmpeg-filters.html#Options-2

We actually had a lot of settings showing during alpha testing and the first round of testing with customers before releasing it to beta testing.
For CPU & Nvidia this wasn't really needed as colors looked good after we got them dialed in. The Intel portions are a bit newer and have been worked in since this has been in beta.

softworkz has recently redone some QuickSync things (not sure to what level). I don't know if this could have broken anything or not.  I don't have a machine to test QuickSync on so I haven't gotten a chance to follow the Intel tone-mapping first hand.

Link to comment
Share on other sites

sooty234

Apparently, skylake doesn't support tone mapping, so I can't test it. I tried it anyway. It wouldn't work at all. I need to test the software tone mapping more comprehensively.

I've always thought that hable was rubbish. Slightly higher color accuracy, but way too dark. It was originally designed for games, and it isn't tunable. Theoretically, mobius should be the best, but I think reinhard is a better blend. But if using software, softworkz has introduced bt.2390 which is definitely the best.

Edited by sooty234
Link to comment
Share on other sites

7 hours ago, sooty234 said:

It's got nothing to with processing power, it's just broken. I've tested most of the options, also with the plugin, and none of it affect the output resolution I was getting.

You can't adjust the output resolution when transcoding in Emby short of adjusting the bitrate on the client side (so far).  Emby will always step down the resolution if it has to in order to give you a better picture based on the bitrate it's allowed to use.

Screen shot with settings of 1080-30Mb
image.png.fdc1a07816ff6e472246e04686c99d9f.png

Here's the same movie with the bitrate cranked up a bit and no resolution cap
image.png.dfc2454c15e5a23649cfb065297841cc.png

You can set a resolution cap for software tone mapping via the Diagnostic Plugin.  Once set this applies through restarts and for all users and software tone maps

image.png.c4b2eadd2e8dd886a3d23c13972f68a9.png

Edited by cayars
Link to comment
Share on other sites

sooty234

Good lord! Do I really have to take your hand and walk you through every detail? Yes, I know that. You're exasperating! Sit quietly and listen. So, while in my LAN, on a machine with a 10G NIC, I launch a web browser I set the limit to something like 1080 4Mb/s, it transcodes to less than 1Mb/s and around 720x404. Got it now?

Link to comment
Share on other sites

Actually you don't have it and don't understand what it's doing.  This is real-time transcoding not 2 pass encoding you can set and let do it's thing with a full set of optimizations and big look ahead.  This is dynamic and not a conversion but a real-time transcode that has to run fast as multiple transcodes can be in process fighting for the same resources.

You're not setting a target but an upper limit for starters, so all you specified is a max resolution of 1080 and max bitrate of 4Mb. Emby still has to figure out what the best resolution it can use for that media based on the bitrate it can use which of course is influenced by the audio, subs and the codecs involved.

If you take something that was in HEVC and it's converting to AVC it's going to need 2 to 2.5 times the bitrate of the original file to hold the quality.  If it can't do that it will use a smaller resolution which means less overall bits needed so what is available is used for quality at that resolution. etc  For software encoding Emby will err on the small side to try and keep as much CPU reserved as possible.

If you want it to look better try 1080-6 or 1080-8 and give the real-time transcoder an opportunity to have a higher upper boundary it can use.  For GPU encodes it's a bit different and generally better resolution wise as the resources on the CPU and far less important and the transcode processes are offloaded. The bitrate however is still a major factor and if to low will create sort of macro blocking where you typically won't get that with a CPU transcode as the resolution can be smaller giving more of the bitrate to scene changes then just the canvas.

BTW, that's an extreme example.

This is not a handbrake type conversion where you set target points. 

 

  • Like 1
Link to comment
Share on other sites

sooty234

Ugh! As usual, you make lots of wrong assumptions. Setting an upper limit or setting no limit... Changing any settings, has the same result. Carlo...please don't make me berate you again. I'm trying to be calm, but I hate you... I really do. Just stop trying to help me. Just don't talk to me, anymore. Children should be seen an not heard.  

To the adults, is there possiblity a limit imposed due to software transcoding, that supercedes the standard bandwidth options? It does work, but the picture is crap due to over compression. I thought that something like that might be implemented because of testing???

Link to comment
Share on other sites

PontusN
43 minutes ago, sooty234 said:

Ugh! As usual, you make lots of wrong assumptions. Setting an upper limit or setting no limit... Changing any settings, has the same result. Carlo...please don't make me berate you again. I'm trying to be calm, but I hate you... I really do. Just stop trying to help me. Just don't talk to me, anymore. Children should be seen an not heard.  

To the adults, is there possiblity a limit imposed due to software transcoding, that supercedes the standard bandwidth options? It does work, but the picture is crap due to over compression. I thought that something like that might be implemented because of testing???

First of all, tune it all the way down the attitude... Second of all, please provide some logs.

Link to comment
Share on other sites

sooty223,  these are limits not targets, EOS.
I'm trying to make sure other members in the forum don't think things work the way you described because they do not.

There are app/clients limits that can be set, such as a limit on resolution and bitrate (NOT a target). 
There is OSD limits that can be changed for specific media as well while playing.

On the server there is a global bitrate limit that will apply to all internet streams.  There is also a limit to how many streams can be used.
On the server at the user profile level there is a limit for number of streams that can be used as well as stream bitrate limit.

With diagnostic plugin there can be a limit to what resolution is used for software tone mapping.

All of these LIMITS are taken into consideration as well as the format of the media when deciding how the media is played or if a limit forces a transcode.
Again these are not targets.

If you have a problem or issue just follow the standard procedure to report it

We can usually tell by the logs if something isn't configured correctly to give the expected outcome or if any of these many limits are what's influencing what you see.
Of course if something doesn't work as designed or has a bug it can be discussed and fixed.

Edited by cayars
Link to comment
Share on other sites

1 hour ago, sooty234 said:

Setting an upper limit or setting no limit... Changing any settings, has the same result. Carlo...please don't make me berate you again.

Do you now understand why this isn't true?

Link to comment
Share on other sites

niallobr

Good info guys thanks. Probably a silly question, I guess bt.2390 isn’t possible with hwa transcoding? Seems to be the most accurate looking option. To be honest the CPU performance with software is okay on my system for a single stream and its nice you can tweak the resolution limit so not a major dealbreaker.

Edited by niallobr
Link to comment
Share on other sites

I don't think I've seen any bt.2390 testing done to be honest.
Do you have any media that would benefit from this yet?

Link to comment
Share on other sites

sooty234
9 hours ago, cayars said:

Do you now understand why this isn't true?

Hands up who wants me to fill in the blanks.

Edited by CBers
Removed potentially offensive content.
Link to comment
Share on other sites

CBers
4 hours ago, sooty234 said:

Hands up who wants me to fill in the blanks.

No need for this type of post, no matter how frustrated you are at getting your point across. 

 

  • Like 1
Link to comment
Share on other sites

PenkethBoy
14 hours ago, sooty234 said:

I can't test this with hardware acceleration as my beta is running on an i7 6700k (Windows 10l, but software tone mapping is very far away from being useable. Aside from the color issues, it doesn't obey resolution settings at all. It always transcodes down to 720x404 or less. 

not seeing this with software tone mapping (6700k) - getting 1280by720 and works fine if you have your settings correct with 1080-8 - with browser - probably limited by size of browser window

using hw tone mapping (nvidia) get the same result - just a few fps quicker

  • Like 1
Link to comment
Share on other sites

niallobr
9 hours ago, cayars said:

I don't think I've seen any bt.2390 testing done to be honest.
Do you have any media that would benefit from this yet?

I had a look at Edge of Tomorrow and with the various Extra-T - OpenCL options enabled the scenes look very green/desaturated, whereas with bt.2390 it looks much more like the direct play version with HDR, so I would see all media as benefitting from bt.2390, if that's what you meant?

Reinhard Extra-T - OpenCL (HW - VAAPI)

IMG_5465-2.jpg.955f74b0fa0f78ab85e826ef28985ab2.jpg

It's immediately obvious at the start of the film when the sky in the Warner Bros. intro looks green rather than blue.

bt.2390 (Software)

IMG_5463.jpg.31f84923d19917358e5bdf2370fcee07.jpg

 

 

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

rbjtech

I believe there are some scaling issues that don't make immediate sense.

I am able to reproduce the said issue - and overwrite it if using the substitution.

On a s/w only transcode - if I choose 1080p@6Mbit/sec - I get a 1280x720 scale (720p), if I choose 1080p@5Mbit/sec - I get a 720x404 scale.

If I use the option to overwrite this - I get 720p @ 5Mbit - which obviously looks substantially better.

>>>>>>  DIAGNOSTIC OPTIONS ACTIVE !!!
Warning CommandLineOptions.SearchText: Original:  Actual: -filter_complex "[0:0]scale@f1=width=720:height=404
Warning CommandLineOptions.ReplaceText: Original:  Actual: -filter_complex "[0:0]scale@f1=width=1280:height=720

I guess there is a matrix somewhere where the bitrate/scaling is taken into consideration - I get this, but imo it's probably being too aggressive @ these bitrates and I would personally  drop it down to 720x404 @ maybe 2Mbit or even 1Mbit, not 5.

But I'm sure @softworkz will be along shortly to educate us all on why this is done. :)

edit - on why the selected bitrate is not being met - then this is the usual h264 encoding preset vs CQ values debate.  If you want to use all the bandwidth you have, then select a 'faster' preset and maybe lower the CRF.  I can always hit or get very close to 5Mbit/sec (in our example) selecting a Super or Ultra Fast Preset.   

Auto will try and balance the quality - and if it can get you the same quality with a lower bitrate (at the expensive of CPU), it will.  

 

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

vdatanet

Another example, differences are usually more pronounced when there are predominant yellow colors. VAAPI OpenCL:

opencl.thumb.jpg.1ecb2045bb74564ad8aa93c2a1fb3d8e.jpg

 

Plex VAAPI OpenCL. It is not perfect for my taste, the color is a bit saturated, perhaps the ideal would be somewhere in between:

 

anotherone.thumb.jpg.d839cd46d9f8ab66af626041ddfe76eb.jpg

Link to comment
Share on other sites

Hi guys,

I thought we would be more or less done with these things.

But if there's demand, I can bring back those tweaking parameters that we had during the initial testing.

One word regarding the "Native VAAPI Tone Mapping": This doesn't provide any parameters. It relies on the parameters that are coded inside the video stream. There are certain ways to do this and ffmpeg currently isn't able to decode all of them. That's the reason why it might not always give good results. Also, results may vary depending on which CPU generation you have, because internally, they have different implementations for this. For the newer CPU's (Icelake, Tigerlake and above) it's done with 3D Look-Up Tables, the older ones (starting from Kaby Lake are using CMetal GPU shader implementations, even older gens: no native tm).

sw

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

This might be a good thing to help adjust/tune the Intel side of things a bit better and allow some experimentation to see what potentially works best.

  • Like 1
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...