Jump to content

Dolby Vision in mpv


generiq

Recommended Posts

generiq

I just built the latest mpv. I'm back to using my old Vizio TV, which apparently supports Dolby Vision. Anyway, just testing some Dolby Vision videos, and it looks like I now have Dolby Vision passthrough in mpv. No tone-mapping. Hardware acceleration is now implemented.

[   0.016][v][file] Opening G:\Temp Movie Library\Dolby  Vision\dolby-vision-amaze.mp4
[   0.016][d][global] config path: 'fonts' -/-> 'G:/mpv/portable_config/fonts'
[   0.016][d][osd/libass] ASS library version: 0x1502002 (runtime 0x1502002)
[   0.016][v][osd/libass] libass API version: 0x1502002
[   0.016][v][osd/libass] libass source: commit: 0.15.2-75-g0e0f9da2edc8eead93f9bf0ac4ef0336ad646ea7
[   0.016][d][file] resize stream to 131072 bytes, drop 0 bytes
[   0.016][d][file] Stream opened successfully.
[   0.016][v][demux] Trying demuxers for level=normal.
[   0.016][d][demux] Trying demuxer: disc (force-level: normal)
[   0.016][d][demux] Trying demuxer: edl (force-level: normal)
[   0.016][d][demux] Trying demuxer: cue (force-level: normal)
[   0.016][d][demux] Trying demuxer: rawaudio (force-level: normal)
[   0.016][d][demux] Trying demuxer: rawvideo (force-level: normal)
[   0.016][d][demux] Trying demuxer: mkv (force-level: normal)
[   0.016][d][demux] Trying demuxer: libarchive (force-level: normal)
[   0.016][d][demux] Trying demuxer: lavf (force-level: normal)
[   0.017][v][osd/libass] Shaper: FriBidi 1.0.12 (SIMPLE) HarfBuzz-ng 4.2.0 (COMPLEX)
[   0.017][d][global] config path: 'subfont.ttf' -/-> 'G:/mpv/portable_config/subfont.ttf'
[   0.017][d][global] config path: 'fonts.conf' -/-> 'G:/mpv/portable_config/fonts.conf'
[   0.017][v][osd/libass] Setting up fonts...
[   0.017][v][osd/libass] Using font provider directwrite (with GDI)
[   0.017][v][osd/libass] Done.
[   0.018][d][cplayer] Run command: define-section, flags=64, args=[name="input_osc", contents="", flags="default"]
[   0.018][d][cplayer] Run command: enable-section, flags=64, args=[name="input_osc", flags="allow-hide-cursor+allow-vo-dragging"]
[   0.018][d][cplayer] Run command: define-section, flags=64, args=[name="input_forced_osc", contents="", flags="force"]
[   0.018][d][cplayer] Run command: enable-section, flags=64, args=[name="input_forced_osc", flags="allow-hide-cursor+allow-vo-dragging"]
[   0.018][v][lavf] Found 'mov,mp4,m4a,3gp,3g2,mj2' at score=100 size=2048.
[   0.020][v][lavf] Found Dolby Vision config record: profile 5 level 9

 

  • Like 1
Link to comment
Share on other sites

That's great, so you're saying something has been added even in the last few weeks?

Link to comment
Share on other sites

generiq

This was the first time I've done any real testing in a while. I've have a lot of stuff going on. But this is the tail of a long process to replace vo=gpu. vo=gpu-next is an entirely rewritten vo. Dolby Vision support was added a while ago, but only for Vulkan and software decoding. Recently, d3d11 support was added and has had several developments. I'm a bit remiss on the details, I'm playing catch-up. But my results are fantastic. I'm getting what appears to be the same output that the Dolby Labs plugin does. I haven't had enough time to do a deep dive, yet. So I posted a question to see what has been developed.

https://github.com/mpv-player/mpv/issues/10122

No solid response yet. But the tone-mapped results I initially had are not the same as what I now get. There has been a lot development for vo=gpu-next. 

Link to comment
Share on other sites

generiq

Further testing. It's looking good, and hassn has pointed me to another development that will hopefully be merged soon. I posted my results in that thread.

https://github.com/mpv-player/mpv/issues/10122#issuecomment-1107552588

My display supports Dolby Vision, so on non DV displays, would be tone-mapping.

The Windows swapchain/presenter will probably handle it. We shall see...

Edited by generiq
Link to comment
Share on other sites

Thanks for sharing this. We'll double check make sure our embedded build is up to date with all of those.

Link to comment
Share on other sites

Ralph's Emby

@Luke

Was about to ask about DV in Non-DV display's and came across this post. Not sure if it's under the correct subject but will ask anyways.

Software/Hardware: Tower PC w/Windows 10 Pro (whatever it's the latest version), Emby Server/Premier + Emby Theater, CPU -> AMD 3700x, GPU Radeon RX 590, Ram 32 Gig 3600 Cl 18, connected into my Projector: BenQ HT3550 (4K/HDR) HDMI 2.0.

Situation: Sometime ago I got a Movie in HDR 10Plus + also have the same one in HDR, payed both to compare and/or if I can see any differences and really enjoyed how my Projector tone mapped the HDR 10Plus better then the HDR, I know I wont see the differences in color (HDR 10Plus) but it just play's smoother, if I can explain myself. Seems, my Projector like to have the extra data from the HDR 10Plus, it will know what to do or how to tone map it.

The other day, acquired a new 4K Movie but I have only 2 options, DV or 10 Bit SDR, so no HDR at all. If I understood correct about DV, it is mostly the same as HDR 10Plus, so Emby Theater should be able to play it but only in HDR, as my Projector it is Not DV certified but it is not the case, I'm getting the Green/Pink/Purple pop = cannot play DV Movie.

Question: am I missing something ? it is possible to play the DV Movie as HDR only, same way I can with HDR 10Plus ?

If Yes how ?

Hoping I'll be able to get the same goodies I have with HDR 10Plus, etc.

Any information or if I'm wrong, please enlighten me, will be appreciated.

Apologies for my ignorance, it's my 1st time attempting to use and learn about DV.

Edited by Ralph's Emby
Link to comment
Share on other sites

generiq

With the current Theater build, no, it doesn't support DV. It's why I made this post. The player used in Theater has been updated to support DV, but it has not yet been introduced to Theater.

There is no reason to think that tone-mapping HDR10+ is easier than HDR10. In fact, the tone mapping is most likely using the HDR10 component of HDR10+. HDR10+ and DV use dynamic metadata. This makes possible the change of the range per scene/frame. Tone-mapping each change would be more difficult.

13 minutes ago, Ralph's Emby said:

Question: Is it possible to play the DV Movie as HDR only?

This will be the outcome of the updates I have mentioned above. ffmpeg does not yet support dynamic metadata. Until it does, that metadata can't be forwarded. So the Windows swapchain/presenter will map it as HDR10, provided your computer is running HDR. Though, in technicality, even mapping it to RGB 8 bit (as it does now), it is still mapped to a Higher Dynamic Range. Less colors but still a high peak brightness. That's what the PR is about, allowing the ability to set the colorspace to different widths of gamut. In testing, I can rudimentally expand/map to a wide gamut, but it isn't ideal. And you also need to specify the peak luminance, as that will also be part of the above Pull Request. But generally, the picture quality is very good, even though it's only 8 bit. There is also an option to strip the DV metadata, and let the player do everything.

Link to comment
Share on other sites

generiq

That PR just got merged into libplacebo. When I get a chance, I'll rebuild mpv and see what goes on...

  • Thanks 2
Link to comment
Share on other sites

Ralph's Emby

Thanks,

For Windows 10, seems I still need to manually set HDR to keep implementing HDR ?

Little lost when stated "MS will follow the display settings", if I understood correct, (i.e.) in my case my display it's my BenQ Projector and for HDR it's set to Auto, therefore switching to HDR if the input signal it's also an HDR, etc.

I'm using AMD GPU, so I guess no Vulcan and should always go for d3d11, correct ?

I was hoping I can use eventually madVR for all my movies and files (especially HDR) but jeeb said something about madVR issues, what is the problem ?

What settings should I follow and where in Windows, I'll need to go to set any rules ?

Link to comment
Share on other sites

generiq

The simple truth is that there is no auto switching between SDR and HDR. Microsoft has killed it. If you use an old enough version of Windows 10 and use an old enough GPU driver, then the possibility of auto switching might exist. But that's a terrible idea. Jeeb states 'If you want HDR, you should always have your display configured as HDR through Windows settings.' Turn it on, and leave it on. The Windows presenter along with the player, will be responsible for providing the correct color mapping. That's what jeeb has/is working on, and tying it into hassn's libplacebo.

  • Thanks 1
Link to comment
Share on other sites

generiq

To more adequately explain. HDR has little to do with the colorspace, it is predominantly about how bright or dark the picture can be. HDR is brighter and darker than SDR. Color is denoted by the '10' in HDR10, meaning 10 bit color depth. So this would require a wider range of color (bt.2020). This requires enabling HDR in Windows. Now it becomes about color management. With HDR enabled, the colorspace can still be set to sRGB. This is what jeeb is referring to with libplacebo's 'hint' and switching automatically. So in essence, you'll have sRGB in HDR.

Does that make more sense?

Link to comment
Share on other sites

Ralph's Emby

If I want HDR (currently) I will go to Windows Display settings and enable HDR + also change my GPU Display output from RGB 4:4:4 to YCbCr 4:2:2 or 4:2:0. My DLP Projector uses a color wheel filter to achieve "up to" 99% DCI-P3. The HDR signal will activate the color wheel filter + change the lamp output, to max out the lumen's needed for HDR.

Concern: if I leave HDR turned on all the time via Windows's Display Settings, it will leave also my Projector under HDR mode all the time, if I'm following you. This will be bad.

It's nice to know Windows may offer with HDR enabled, sRBG color space for SDR and able to up or offer rec2020 when it's needed but how it can tell my Projector to turn off the color filter, when it's SDR but HDR it's enabled at the same time ?

I guess for now just keep the basics and toggle the HDR on or off when it's needed, also when I turn on HDR, my Display color goes to hell, until I play the move and set "full screen"

Do appreciated all this information and the time you're taking to explain.

Link to comment
Share on other sites

generiq

If this works as jeeb intends, your projector should be just fine. mpv will automatically switch between srgb /sRGB and pq / bt.2020. The transfer characteristics are also important. In sRGB under Windows' HDR should have a peak of 203 nits and not the high peak of HDR (1000, 4000, 10000). With the same color gamut of bt.709. But I need to see what it's actually doing...

  • Like 1
Link to comment
Share on other sites

generiq

And you should probably never used RGB 4:4:4. No video uses that, so you'll be forcing a color change. Leave it at YCbCr 4:2:2.

Link to comment
Share on other sites

generiq

Well, that last PR is a bust. target-trc=srgb is being used for everything. Which is perfect for SDR stuff, but HDR stuff is being tone-mapped by the player. That said, mpv tone-maps really well. I almost didn't notice, if it weren't for the target-peak being so low. vo=gpu is just fine. I'm sure they'll give it a tweak... hopefully soon.

Edited by generiq
Link to comment
Share on other sites

generiq

Well, due to being short on time, I was hasty, and missed something important. I needed to add the command :

target-colorspace-hint=yes

This works as expected. 

For DV, the target-peak is too low (if you're in HDR mode). Creating an SDR auto-profile and adding a target-peak value to match your display, appears to correct it. Even though it isn't SDR, it's being read as bt.709, so this is a workaround.

Link to comment
Share on other sites

generiq

You can see here, from my log.

[   0.252][v][vo/gpu-next] New swap chain configuration received from hint: format: R10G10B10A2_UNORM, color space: RGB_FULL_G22_NONE_P709.

You can see that it's set to 10 bit color depth, but the primaries read as bt.709. 

But later, is reconfigured to bt.2020

[   0.295][v][vo/gpu-next] New swap chain configuration received from hint: format: R10G10B10A2_UNORM, color space: RGB_FULL_G2084_NONE_P2020.

 

Edited by generiq
Link to comment
Share on other sites

generiq

So Luke, if you implement this, you'll need to add the 'target-colorspace-hint=' option to the UI. And for people running windows in HDR, for Dolby Vision you should add this as an auto-profile, with the peak value suitable for your display. I set it to 700.

[DV]
profile-cond=p["video-params/primaries"]=="bt.709"
target-peak=

 

Edited by generiq
  • Thanks 1
Link to comment
Share on other sites

On 5/7/2022 at 3:39 PM, generiq said:

So Luke, if you implement this, you'll need to add the 'target-colorspace-hint=' option to the UI. And for people running windows in HDR, for Dolby Vision you should add this as an auto-profile, with the peak value suitable for your display. I set it to 700.

[DV]
profile-cond=p["video-params/primaries"]=="bt.709"
target-peak=

 

To the UI, or just always set it to yes?

Link to comment
Share on other sites

generiq
14 hours ago, Luke said:

To the UI, or just always set it to yes?

You should make it optional. If they are not running Windows in HDR, it would be best to set is to 'no'. Unless you can automate Theater to detect if Windows is in HDR and set 'yes' automatically? If HDR is enabled, then it needs to be 'yes'.

Link to comment
Share on other sites

13 hours ago, generiq said:

You should make it optional. If they are not running Windows in HDR, it would be best to set is to 'no'. Unless you can automate Theater to detect if Windows is in HDR and set 'yes' automatically? If HDR is enabled, then it needs to be 'yes'.

Yea if it's that simple then we can just handle it without a UI option.

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...