Jump to content


Photo

HDR and Emby Theater desktop explained

Emby Theater mpv HDR tone mapping

  • Please log in to reply
21 replies to this topic

#1 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 12623 posts
  • Local time: 02:26 PM

Posted 18 August 2019 - 08:05 PM

What is HDR?

 

HDR (High Dynamic Range) is how bright or dark an image can be. Often referred to as peak luminance. This allows an image to have much brighter light and darker blacks. So if you had an image with direct sunlight above a cave opening, you would be able to view how bright the sun is without brightening the whole image and making the cave opening more grey, as opposed to the rich black that you see in its recesses. The idea being that you get a visual range closer to what your eyes would see in the real world.

 

Mastering

 

Now with such range of light, how shades of color are perceived will vary. You can see this in the real world. Try staring at a color and change the ambient light around you. You’ll see a change in the shade of color. This is natural. But with movies, the colors are deliberately configured to create a certain kind of image. This is called mastering. The same rules will apply. When they master the image, they will apply a luminance to that color to have a specific shade. These shades of color should never be changed or the image will not look correct. When these movies/images are mastered, it is done so on a reference display. These displays will have a very high peak luminance, usually 4000 -10000 nits. And the colors are mapped to that brightness. Here’s a short video that talks about it.

 

A short video talking about tone mapping

 

Your display

 

The display/TV you buy is very likely not a reference display, and will have a much lower peak luminance. Often somewhere around 800 nits. So following the above rules, when you lower the brightness that much, the shades of color are going to change. We don’t want that. So when the video is mastered and rendered, they include metadata embedded into the file, that will provide information for your display to remap the colors to where they should correctly be. This is called tone mapping. Every HDR display does this.

 

Playing HDR videos

 

Conventionally, when playing the video, the metadata is sent with it and the display will read and use it. This is referred to as ‘pass-through’. As we are talking about playing the videos on a computer, this process is more complicated. Not all operating systems support it. In the case of Windows 10, there is specific criteria that has to be met for Windows to send the metadata to your display. It has to be full screen, have exclusivity of the window etc. Windows has an internal mechanism that will enable HDR, when the criteria is met. This is what people refer to as ‘triggering’. Recent changes in Windows now allow you enable HDR manually, and to have your desktop always be in HDR10. Nvidia has taken advantage of that by turning it on an off, dynamically. This allows you to have HDR passthrough in a window. And when playback ends, it will turn it off again. This is what madVR, does.

 

mpv and HDR

 

mpv is the internal player used in Emby Theater. It is a multi-platform media player. As I mentioned, not all operating systems support HDR. So they developed their own tone mapping algorithms, to allow them all to be able to watch HDR media. We talked about your display having to tone map the colors. Instead of your display performing the tone mapping, mpv will do it through software and render the image at the desktop level. This means there will be no ‘triggering’ of HDR on your display. As mpv is computer software, it is assumed that most computer displays are not running in HDR, but instead in SDR. So the default settings are intended for SDR (bt.709 colorspace), and tone mapped to that. 

 

Here are some links to what the mpv developers are saying about HDR tone mapping and a pull request for further development of HDR passthrough.

 

https://github.com/m...mment-365338579

 

https://github.com/m...r/mpv/pull/5804

 

 

Colorspace

 

This is basically how many shades of color are supported in that environment. Also referred to as color gamut. The wider the gamut, the more shades of color. The two most common are bt.709 (SDR) and bt.2020 (HDR wide color gamut). We learned that mpv by default maps to bt.709, so to allow the use of a wide color gamut, that needs to be manually configured. This is easily done and only needs to be done, once (see HDR tone mapping with mpv).

 

Windows in HDR10

 

When using mpv to play HDR media, it is recommended to manually turn on HDR in windows and run Windows in that mode. With that enabled, you can then configure mpv to tone map to that colorspace and luminance.

 

Configuration

 

Here’s where things are a little different to HDR passthrough. With passthrough, your display does all the rendering of the color. With mpv, it’s rendered at the desktop layer. Caution, if you calibrated your display for HDR passthrough, it likely won’t look right with mpv. If you have your display calibrated HDR passthrough, you may notice that your desktop is little brighter or not as vivid and clear. As we are using the desktop to render to, it must look like a conventional desktop. In my case, I manually configured the settings to make the colors strong (but not over-saturated), the backlight and contrast to be comfortable to look at in my viewing environment. There is no magic, just make your desktop look clear and vibrant. And if you have the option, select gamma 2.2. mpv will automatically use that transfer characteristic. If you don’t have that option, don’t worry about it.

 

I’m attaching a zip file with some files and a configuration that will give you a good start. I’m including the auto-profiles script that allows me to configure a profile specifically for HDR media. I’m using separate color profiles for SDR and HDR, with added config for HDR tone mapping. Using these color profiles, you don't need to set a colorspace.

 

  1. Download and unzip to C:\Users\YOU\AppData\Roaming
  2. In that mpv folder, you will see a folder called color profiles.
  3. Open that folder, right click on and install each file.
  4. Play a movie

 

To learn more about mpv, you can read about it here. For more detailed HDR configuration information, read HDR tone-mapping with mpv. Any questions, please ask them, there.

 

I hope this helps.

 

Happy viewing.

Attached Files

  • Attached File  mpv.zip   6.52KB   60 downloads

Edited by Doofus, 18 August 2019 - 08:40 PM.

  • SikSlayer and markyp like this

#2 gwujkiw OFFLINE  

gwujkiw

    Advanced Member

  • Members
  • 37 posts
  • Local time: 06:26 PM

Posted 19 August 2019 - 01:59 AM

After installing those color profiles, do I have to enable one of them in windows?



#3 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 12623 posts
  • Local time: 02:26 PM

Posted 19 August 2019 - 08:02 AM

No, mpv will use them directly.

#4 gwujkiw OFFLINE  

gwujkiw

    Advanced Member

  • Members
  • 37 posts
  • Local time: 06:26 PM

Posted 19 August 2019 - 10:50 AM

Okay so that all worked great.  Now that we did the initial setup and it works do you recommend any tweaks?



#5 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 12623 posts
  • Local time: 02:26 PM

Posted 19 August 2019 - 12:39 PM

Take a look at the thread I linked to.

#6 ozchef OFFLINE  

ozchef

    Advanced Member

  • Members
  • 68 posts
  • Local time: 10:26 PM

Posted 23 August 2019 - 01:07 AM

Thanks Doofus.

I have a weekend/night project

#7 lightsout OFFLINE  

lightsout

    Advanced Member

  • Members
  • 616 posts
  • Local time: 02:26 PM

Posted 25 September 2019 - 11:44 PM

Thanks for this. Confused and turning on HDR mode while tone mapping. I am under the understanding that is one or the other.

HDR mode would be for passthrough. And SDR mode would be for tone mapping.

Since tone mapping is essentially sending out the video in sdr.

At least this is how it works in madvr.

#8 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 12623 posts
  • Local time: 02:26 PM

Posted 25 September 2019 - 11:59 PM

Since tone mapping is essentially sending out the video in sdr.

 

Technically, yes, but don't confuse luminance with color gamut. While the desktop doesn't have the peak luminance that passthrough will enable, it still is in wide color gamut. Tone mapping is purely about the color, which both madVR and mpv get correct. It's the emulation of the peak luminance is the part that is tricky. mpv just provides the tools, whereas madVR bundles everything in a UI.



#9 lightsout OFFLINE  

lightsout

    Advanced Member

  • Members
  • 616 posts
  • Local time: 02:26 PM

Posted 26 September 2019 - 10:51 AM

Technically, yes, but don't confuse luminance with color gamut. While the desktop doesn't have the peak luminance that passthrough will enable, it still is in wide color gamut. Tone mapping is purely about the color, which both madVR and mpv get correct. It's the emulation of the peak luminance is the part that is tricky. mpv just provides the tools, whereas madVR bundles everything in a UI.

I guess I'm just stuck on the fact that in madvr HDR is never enabled when using passthrough. But it is recommended here.

#10 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 12623 posts
  • Local time: 02:26 PM

Posted 26 September 2019 - 12:14 PM

I guess I'm just stuck on the fact that in madvr HDR is never enabled when using passthrough. But it is recommended here.


You aren't getting passthrough with madVR? There's an mpv test build that enables passthrough, if you use it as an external player.

#11 lightsout OFFLINE  

lightsout

    Advanced Member

  • Members
  • 616 posts
  • Local time: 02:26 PM

Posted 26 September 2019 - 12:35 PM

You aren't getting passthrough with madVR? There's an mpv test build that enables passthrough, if you use it as an external player.

I can use passthrough yes. And when that happens it of course enables HDR on the TV.

But when using madvr for tone mapping HDR is never enabled. Which I would assume should be the same with MPV. I've always understood it to be one or the other.

#12 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 12623 posts
  • Local time: 02:26 PM

Posted 26 September 2019 - 01:20 PM

I can use passthrough yes. And when that happens it of course enables HDR on the TV.

But when using madvr for tone mapping HDR is never enabled. Which I would assume should be the same with MPV. I've always understood it to be one or the other.


Ah, yes, old skool. It's such an unforgiving set of parameters. I'm certain that the future will be better. Especially with an increasing variation of 'HDR'. Just look at Dolby vision. It's entirely different to HDR10. The color primaries are bt.709. This is just the beginning of better things to come :)
  • lightsout likes this

#13 gwujkiw OFFLINE  

gwujkiw

    Advanced Member

  • Members
  • 37 posts
  • Local time: 06:26 PM

Posted 02 October 2019 - 01:32 AM

Got a couple questions.

 

In the mpv.conf file.

 

I see dither-depth=10 towards the top of the config which I think is for SDR material. 

 

My TV only supports 10bit dithering at 30hz or below in SDR and 8bit dithering at 60hz in SDR.  Should I change this setting at all in the config file?

 

 

In the HDR Section there is this:

 

video-sync=audio 

 

What is the benefit of having this set to audio vs vdrop?  Will it hurt to have this set as vdrop? 

What does the "auto setting" in Emby typically select audio or vdrop?  I have refresh rate switching enabled.

In emby theatre itself this setting is set to auto is that okay?

 

Oh and when you watch standard SDR 1080p content in Emby Theatre, am I correct to turn off the Windows HDR toggle or should it be enabled for watching both SDR and HDR content in Emby when I am using the these profiles.

 

Sorry about all the questions.


Edited by gwujkiw, 02 October 2019 - 01:56 AM.


#14 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 12623 posts
  • Local time: 02:26 PM

Posted 02 October 2019 - 11:01 AM

Ok, you've got a few different things going on there. First, HDR at 30Hz. That sounds like either a wrong/bad HDMI or your receiver doesn't support that or isn't set up correctly. Unless you're talking about a dither setting on your display. If that's the case, you should only use one or the other. The dither depth is set that way to dither SDR 8bit with your display in HDR. If you're using refresh rate switching, and nothing you watch is above 30Hz, then just leave your display in HDR. If you want to play something above 30Hz in HDR, disable dithering on your display and apply it in the mpv.conf.

video-sync=audio is the default, I accidentally left that in there after doing some testing. You can take that out and just set it to auto.

If you want to turn HDR on and off, then only use the HDR profile.

Hopefully Luke will the HDR option for external players soon, then you can use that and not worry about any of this, if you go in that direction.

#15 gwujkiw OFFLINE  

gwujkiw

    Advanced Member

  • Members
  • 37 posts
  • Local time: 06:26 PM

Posted 02 October 2019 - 05:09 PM

Ok, you've got a few different things going on there. First, HDR at 30Hz. That sounds like either a wrong/bad HDMI or your receiver doesn't support that or isn't set up correctly. Unless you're talking about a dither setting on your display. If that's the case, you should only use one or the other. The dither depth is set that way to dither SDR 8bit with your display in HDR. If you're using refresh rate switching, and nothing you watch is above 30Hz, then just leave your display in HDR. If you want to play something above 30Hz in HDR, disable dithering on your display and apply it in the mpv.conf.

video-sync=audio is the default, I accidentally left that in there after doing some testing. You can take that out and just set it to auto.

If you want to turn HDR on and off, then only use the HDR profile.

Hopefully Luke will the HDR option for external players soon, then you can use that and not worry about any of this, if you go in that direction.

Okay first when I say hdr at 30hz I mean if I toggle windows 10 into HDR mode and then switch the refresh rate it lets me change to all the different refresh rates my tv can display still. My receiver is a denon x3300w and it absolutely supports hdr as does my Samsung tv with uhd color on.

The dither stuff I saw was in the windows graphics settings where it shows your current settings such as RGB, resolution, current refresh rate, etc.... my Samsung tv is a bit older so I think it only supports 4K hdr with RGB 8bit dithering. Which is kinda not full hdr from what I read.

Finally the reason I don’t want to have HDR toggled on all the time is because I do a lot of other things in windows such as web browsing listening to music, etc.. and if hdr is on that stuff doesn’t look good. So that’s good advice to switch to just using the hdr section of the conf file.

Lastly on the video-sync setting does it hurt to us display-resample vs audio? Or should audio always be preferred.

Thanks again.

Edited by gwujkiw, 02 October 2019 - 05:19 PM.


#16 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 12623 posts
  • Local time: 02:26 PM

Posted 02 October 2019 - 05:49 PM

If when in HDR, your various UIs don't look correct, then the display isn't calibrated correctly. Mine looks exactly the same in SDR as it does in HDR (but a little brighter).

For video sync, that's only to synchronize the video and audio. So if you aren't experiencing desync, I wouldn't worry about it. But if you want to make sure, and you use audio bitstreaming, then set it to vdrop.

#17 gwujkiw OFFLINE  

gwujkiw

    Advanced Member

  • Members
  • 37 posts
  • Local time: 06:26 PM

Posted 02 October 2019 - 05:59 PM

I calibrated my tv for tv programming but I don’t think I ever calibrated windows what’s the best way to do what your taking about?

#18 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 12623 posts
  • Local time: 02:26 PM

Posted 02 October 2019 - 05:59 PM

And don't use any dithering. I just use that for 8bit stuff in a 10bit environment.

#19 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 12623 posts
  • Local time: 02:26 PM

Posted 02 October 2019 - 06:01 PM

I calibrated my tv for tv programming but I don’t think I ever calibrated windows what’s the best way to do what your taking about?


Unless you can eyeball it, you'll need a colorimeter or spectrometer. I recently bought an i1 Display Pro

#20 mrfaulk OFFLINE  

mrfaulk

    Advanced Member

  • Members
  • 219 posts
  • Local time: 11:26 PM

Posted 22 October 2019 - 10:46 PM

If when in HDR, your various UIs don't look correct, then the display isn't calibrated correctly. Mine looks exactly the same in SDR as it does in HDR (but a little brighter).

 

how does windows explorer and web browsers look, the same as sdr? i know that all display are different, but can you share your display settings?

 

also, a couple of more questions for clarification:

 

- mpv tonemaps hdr to sdr.
- windows 10 desktop can be set to hdr (enabled).
- using the mpv player, do sdr movie files look the same with or without hdr enabled in windows?
- using the mpv player, do hdr movie files look the same with or without hdr enabled in windows?
- is there such a thing as tonemapping sdr to hdr using mpv's config file?
 

Recent changes in Windows now allow you enable HDR manually, and to have your desktop always be in HDR10. Nvidia has taken advantage of that by turning it on an off, dynamically. This allows you to have HDR passthrough in a window. And when playback ends, it will turn it off again. This is what madVR, does.

so by enabling hdr in windows the os will passthrough hdr metadata to the display? but mpv intercepts the hdr file metadata and tonemaps it to sdr before it's sent to the display? is that correct? if that's the case, as far as the display is concerned, the hdr file will look the same regardless if hdr is enabled or not? and the only thing that enabling hdr in windows does is alert the display that the desktop is set to hdr which trigger's the display's hdr logo? is that right?

 

 

thanks @Doofus!







Also tagged with one or more of these keywords: Emby Theater, mpv, HDR, tone mapping

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users