Jump to content


Photo

HDR and Emby Theater desktop explained

Emby Theater mpv HDR tone mapping

  • Please log in to reply
5 replies to this topic

#1 Doofus OFFLINE  

Doofus

    Advanced Member

  • Members
  • 12062 posts
  • Local time: 06:08 AM

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   25 downloads

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

  • SikSlayer and markyp like this

#2 gwujkiw OFFLINE  

gwujkiw

    Member

  • Members
  • 22 posts
  • Local time: 09:08 AM

Posted 19 August 2019 - 01:59 AM

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



#3 Doofus OFFLINE  

Doofus

    Advanced Member

  • Members
  • 12062 posts
  • Local time: 06:08 AM

Posted 19 August 2019 - 08:02 AM

No, mpv will use them directly.

#4 gwujkiw OFFLINE  

gwujkiw

    Member

  • Members
  • 22 posts
  • Local time: 09:08 AM

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 OFFLINE  

Doofus

    Advanced Member

  • Members
  • 12062 posts
  • Local time: 06:08 AM

Posted 19 August 2019 - 12:39 PM

Take a look at the thread I linked to.

#6 ozchef OFFLINE  

ozchef

    Advanced Member

  • Members
  • 67 posts
  • Local time: 01:08 PM

Posted 23 August 2019 - 01:07 AM

Thanks Doofus.

I have a weekend/night project





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