Log in

View Full Version : Pass over HDR10+ and Dolby Vision information?


Pages : [1] 2 3 4

ShortKatz
25th January 2021, 22:02
Now that HandBrake finally has a first 10-bit pipeline, I was experimenting with converting some HDR movies. For regular HDR10 this is relatively easy. You just need to read out the HDR values with e.g. MediaInfo and than add the --master-display and --max-cll values in HandBrakes additional option box.
But, how would I do this with dynamic metadata from HDR10+ and Dolby Vision sources?

quietvoid
25th January 2021, 22:24
For HDR10+ you can extract to JSON using https://github.com/quietvoid/hdr10plus_parser
And then feed the JSON to x265: https://x265.readthedocs.io/en/master/cli.html#cmdoption-dhdr10-info

For Dolby Vision, same principle: https://github.com/quietvoid/dovi_tool#extract-rpu
Feed to x265 with: https://x265.readthedocs.io/en/master/cli.html#cmdoption-dolby-vision-rpu
Also have to specify the profile.

You'll need to figure out what profile your devices are compatible with, most likely converting to profile 8.1 is fine for most cases.
However this does not support cropped Dolby Vision encodes out of the box just yet, a modification to the code is necessary to override the metadata.

benwaggoner
26th January 2021, 01:08
And note a lot of Dolby Vision devices don't support Profile 8.1, and most sources aren't in that either. Converting between DoVi versions requires a full tone remapping, beyond the abilities of something like Handbreak.

quietvoid
26th January 2021, 02:14
And note a lot of Dolby Vision devices don't support Profile 8.1, and most sources aren't in that either. Converting between DoVi versions requires a full tone remapping, beyond the abilities of something like Handbreak.

So far most streaming devices and Android TVs have no problem with YCbCr HDR10 + Profile 8.1 compatible RPU in the same stream, the Dolby engine interprets them correctly.
It's much more compatible than profile 7, at least :)

It's just a question of unsetting some flags and then the decoder has no problem. Converting profile 5 would be a different story.

Nico8583
26th January 2021, 11:34
Hi :)
I'm interested, my TV is a Samsung Q70R so not compatible with DoVi, only HDR10+. What is the result if I recode a DoVi stream to x265 DoVi stream ? It will play as a standard HDR10 stream or it will not be compatible ?
Thank you.

benwaggoner
26th January 2021, 22:28
Hi :)
I'm interested, my TV is a Samsung Q70R so not compatible with DoVi, only HDR10+. What is the result if I recode a DoVi stream to x265 DoVi stream ? It will play as a standard HDR10 stream or it will not be compatible ?
Thank you.
If it is a Profile 8.x source, then the bitstream is in a "native" color volume and will work without the metadata, although perhaps with lower quality without the dynamic metadata.

If it's a non-backwards compatible base layer, like Profile 5, you'd need to do a full tone mapping conversion with specialized tools. That's a full format conversion, not even a straight reencode let alone a remux.

Nico8583
26th January 2021, 23:23
Thank you !
How can I know the DoVi profile version ? With MediaInfo ?
And how does it work with original Blu ray ? My TV will play it as an HDR / HDR10 stream ? I don't have any DoVi BD now so I can't try but I ask for the future.

benwaggoner
27th January 2021, 01:47
Thank you !
How can I know the DoVi profile version ? With MediaInfo ?
And how does it work with original Blu ray ? My TV will play it as an HDR / HDR10 stream ? I don't have any DoVi BD now so I can't try but I ask for the future.
MediaInfo should tell you.

And I don't think any DoVi BD titles use 8.x.

Nico8583
27th January 2021, 01:50
MediaInfo should tell you.

And I don't think any DoVi BD titles use 8.x.
Thank you so DoVi BD use profile 5 ? Or 7 ?

quietvoid
27th January 2021, 04:24
Thank you so DoVi BD use profile 5 ? Or 7 ?

Profile 7.

Nico8583
27th January 2021, 09:58
Profile 7.
Thank you so if I want to convert an DoVi BD (profile 7) to x265 DoVi file I must use profile 5, 8.1 or 8.2 because x265 supports only these profiles ?
And I must convert profile 7 to profile 8.1 so I can keep HDR10 + DoVi metadata ?
Thank you.

quietvoid
27th January 2021, 15:23
Correct. However, you can only convert profile 7 to 8.1 with the existing tools. Since they share the same HDR10 base layer.
Profile 5 conversion is much more complex.

Nico8583
27th January 2021, 16:25
OK thank you I'll try it. There are DoVi BD with profile 5 or all are profile 7 ? There is no quality difference between profile 7 or 8.1 ? Thank you.

quietvoid
27th January 2021, 17:04
All Dolby Vision UHD BDs are profile 7.

Profile 7 FEL has the potential to be better, but in most cases (and current technology) it is not noticeably so.
It is also only fully compatible on UHD BD players.
Profile 7 MEL is equivalent to profile 8.1.

You can use google to find the differences between FEL and MEL.

Blue_MiSfit
27th January 2021, 19:18
Erm, Profile 7 supports an enhancement layer, but 8.1 does not (just metadata on top of the HDR10 base)

quietvoid
27th January 2021, 20:17
Erm, Profile 7 supports an enhancement layer, but 8.1 does not (just metadata on top of the HDR10 base)

Profile 7 MEL has a useless enhancement layer, so it's pretty much the same metadata.

Nico8583
27th January 2021, 20:26
And there is no link between Dolby Vision metadata and HDR10+ metadata ? It's not possible to find a way to convert DoVi metadata informations to HDR10+ ? I don't know the structure of each file, perhaps it's stupid.

quietvoid
27th January 2021, 21:15
And there is no link between Dolby Vision metadata and HDR10+ metadata ? It's not possible to find a way to convert DoVi metadata informations to HDR10+ ? I don't know the structure of each file, perhaps it's stupid.

There are patents on converting from Dolby Vision to HDR10+ but there are no public algorithms.

benwaggoner
27th January 2021, 21:35
And there is no link between Dolby Vision metadata and HDR10+ metadata ? It's not possible to find a way to convert DoVi metadata informations to HDR10+ ? I don't know the structure of each file, perhaps it's stupid.
For Profile 8.1 DoVi, conversion to HDR10+ is theoretically possible as they both have a HDR-10 base layer. Something like ColorFront Transkoder might have, or might get that sort of functionality. But it'd have to be a company with lots of image science chops who licenses tech from both Dolby and HDR10+ LLC.

Generating new dynamic metadata based on the base layer is possible today, and should yield pretty identical results in the cases where metadata is descriptive based on analysis without specific creative intent metadata tuning. Transkoder can do that today.

Another likely scenario is to generate both HDR10+ and DoVi 8.1 metadata simultaneously, and then insert the respective metadata into the same base layer HDR10 encoded bitstream.

Nico8583
27th January 2021, 23:09
Thank you both. Is there a BD movie with DoVi and HDR10+ ? Or it's not possible ?
It should be a good thing to get a public algorithm to convert DoVi to HDR10+, I'm trying to find some informations.

SeeMoreDigital
28th January 2021, 10:42
Thank you both. Is there a BD movie with DoVi and HDR10+ ? Or it's not possible ?
It should be a good thing to get a public algorithm to convert DoVi to HDR10+, I'm trying to find some informations.Yes there are...

The Blu-ray Forum has a constantly updated list of HDR10+ movies (https://forum.blu-ray.com/showthread.php?t=300877) (there are currently only around 50). If you click on a movie cover you'll be able to find out which movies are also encoded with Dolby Vision.

Here's a few to get you started: -

1917 (https://www.blu-ray.com/movies/1917-4K-Blu-ray/259242/) [With FEL Dolby Vision]
Birds of Prey (And The Fantabulous Emancipation of One Harley Quinn) (https://www.blu-ray.com/movies/Birds-of-Prey-And-the-Fantabulous-Emancipation-of-One-Harley-Quinn-4K-Blu-ray/260459/) [With MEL Dolby Vision]
Jaws (https://www.blu-ray.com/movies/Jaws-4K-Blu-ray/265299/) [With FEL Dolby Vision]
The Shining (https://www.blu-ray.com/movies/The-Shining-4K-Blu-ray/238513/) [With MEL Dolby Vision]
The Wizard Of Oz (https://www.blu-ray.com/movies/The-Wizard-of-Oz-4K-Blu-ray/242165/) [With MEL Dolby Vision]

I bought 'Birds Of Prey' a few weeks ago, which offers MEL Dolby Vision and HDR10+. But there are some FEL Dolby Vision and HDR10+ releases too ;)


Cheers

Nico8583
28th January 2021, 13:30
Thank you, I'll look to buy one of them ;)

ShortKatz
28th January 2021, 19:23
Wow, thanks to all of you for all suggestions. I will give this a try. On the long run it seems it is planned that HandBrake simply passthru all mastering display / content light / dynamic metadata.

RanmaCanada
28th January 2021, 20:09
Wow, thanks to all of you for all suggestions. I will give this a try. On the long run it seems it is planned that HandBrake simply passthru all mastering display / content light / dynamic metadata.

If it does, that would be fantastic.

ShortKatz
29th January 2021, 18:56
If it does, that would be fantastic.

At least for mastering display / content light metadata there is a PR. I've tested it and it works nicely for me.

Stacey Spears
31st January 2021, 22:55
Thank you both. Is there a BD movie with DoVi and HDR10+ ? Or it's not possible ?
It should be a good thing to get a public algorithm to convert DoVi to HDR10+, I'm trying to find some informations.

Yes, 2018 Robin hood has both. When you put both into the same encoded file, then you may not have a choice which version you see. I think one defaults to HDR10+.

I have both on my disc, but in separate encodes. My next disc will also have SL-HDR2 (Advanced HDR by Technicolor).

SeeMoreDigital
31st January 2021, 23:22
Yes, 2018 Robin hood has both. When you put both into the same encoded file, then you may not have a choice which version you see. I think one defaults to HDR10+.Robin Hood!!! That's a terrible movie. And yes it does default to HDR10+ when played in an OPPO coupled with an HDR10+ and Dolby Vision capable television, such as the 2020/21 Panasonic or Philips models :eek:


Cheers

ShortKatz
9th February 2021, 22:57
By the way, if somebody is interested to give this a try. The latest HandBrake snapshot build now supports 10bit HDR10 (if all filters are disabled and the output codec is 10bit) and passthru of all mastering display / content light metadata. I used it to encode my Wonder Woman UHD Blu-ray for a test.

Lollaskates
1st September 2021, 04:00
For HDR10+ you can extract to JSON using https://github.com/quietvoid/hdr10plus_parser
And then feed the JSON to x265: https://x265.readthedocs.io/en/master/cli.html#cmdoption-dhdr10-info

For Dolby Vision, same principle: https://github.com/quietvoid/dovi_tool#extract-rpu
Feed to x265 with: https://x265.readthedocs.io/en/master/cli.html#cmdoption-dolby-vision-rpu
Also have to specify the profile.

You'll need to figure out what profile your devices are compatible with, most likely converting to profile 8.1 is fine for most cases.
However this does not support cropped Dolby Vision encodes out of the box just yet, a modification to the code is necessary to override the metadata.

Sorry, new to handling DV - Ive got a DV profile 7 MKV , (BL+EL+RPU) that i'm trying to encode with x265. In your instructions above, you mention extracting the RPU and then feeding it to x265.

Am I extracting the RPU as-is and then feeding it to x265 and specifying profile 8.1? or am I using that same tool to convert the RPU from profile 7 to profile 8.1 and then feeding it to x265 while specifying profile 8.1?

Thanks

quietvoid
1st September 2021, 13:22
You would have to convert the RPU to profile 8, and "crop" if necessary for your encode.
The command would look like this:
dovi_tool -m 2 -c extract-rpu

If not cropping AND downscaling, then it gets more complicated since you have to edit the RPU itself..

Lollaskates
2nd September 2021, 00:34
You would have to convert the RPU to profile 8, and "crop" if necessary for your encode.
The command would look like this:
dovi_tool -m 2 -c extract-rpu

If not cropping AND downscaling, then it gets more complicated since you have to edit the RPU itself..

Thanks! For me just encoding it as-is, no cropping or downscaling.

Cheers

LazyNcoder
5th September 2021, 11:51
You would have to convert the RPU to profile 8, and "crop" if necessary for your encode.
The command would look like this:
dovi_tool -m 2 -c extract-rpu

If not cropping AND downscaling, then it gets more complicated since you have to edit the RPU itself..

Let me get this straight. If there is no cropping, should we still use the crop switch?

I want to encode a bluray which has both HDR10+ and DV

for the HDR10+ part, I did it with hdr10plus_parser.exe
Since I heard you cannot crop the video on HDR10+, I didn't crop it.

Now, I want to include both HDR10+ and DV just like the source

Should I use the crop switch?


My plan is to feed both json and rpu to x265
Is this the correct way?

I'd be thankful if any one can help me with this.

Also, does -m 2 convert the profile to 8.1 or 8.2??

What switches should I enable for the DV on x265?

quietvoid
5th September 2021, 14:07
Let me get this straight. If there is no cropping, should we still use the crop switch?

I want to encode a bluray which has both HDR10+ and DV

for the HDR10+ part, I did it with hdr10plus_parser.exe
Since I heard you cannot crop the video on HDR10+, I didn't crop it.

Now, I want to include both HDR10+ and DV just like the source

Should I use the crop switch?


My plan is to feed both json and rpu to x265
Is this the correct way?

I'd be thankful if any one can help me with this.

Also, does -m 2 convert the profile to 8.1 or 8.2??

What switches should I enable for the DV on x265?

You can absolutely crop with HDR10+, and resizing the image as well.

In summary for Dolby Vision...

Source video 2160p with letterbox bars:
encoded as 2160p with letterbox bars: don't use crop.
encoded as 2160p and cropped (no more letterbox bars): use crop.

encoded as 1080p with letterbox bars: you need to edit the active area to set the final letterbox bars size as offsets, see documentation (https://github.com/quietvoid/dovi_tool/blob/main/editor.md).
encoded as 1080p and cropped: use crop.


If you encode HDR10 video (from a HDR10 profile 7 source, such as UHD BD), you should convert to profile 8.1 (which is Dolby Vision w/ HDR10 backwards compatibility)
So that would be mode 2.

In x265, you would add these for Dolby Vision: --dolby-vision-profile 8.1 --dolby-vision-rpu RPU.bin
However if you're not setting VBV rates, x265 will warn you.

And for HDR10+, it's recommended to only add: --dhdr10-info metadata.json

Hopefully this clears up some confusion.

LazyNcoder
5th September 2021, 20:08
You can absolutely crop with HDR10+, and resizing the image as well.

In summary for Dolby Vision...

Source video 2160p with letterbox bars:
encoded as 2160p with letterbox bars: don't use crop.
encoded as 2160p and cropped (no more letterbox bars): use crop.

encoded as 1080p with letterbox bars: you need to edit the active area to set the final letterbox bars size as offsets, see documentation (https://github.com/quietvoid/dovi_tool/blob/main/editor.md).
encoded as 1080p and cropped: use crop.


If you encode HDR10 video (from a HDR10 profile 7 source, such as UHD BD), you should convert to profile 8.1 (which is Dolby Vision w/ HDR10 backwards compatibility)
So that would be mode 2.

In x265, you would add these for Dolby Vision: --dolby-vision-profile 8.1 --dolby-vision-rpu RPU.bin
However if you're not setting VBV rates, x265 will warn you.

And for HDR10+, it's recommended to only add: --dhdr10-info metadata.json

Hopefully this clears up some confusion.

First of all, thank you for being so humble. Couldn't have more respect for someone like you.

So, is there anything needed when we crop a HDR10+ video? something like -c switch with DV? Nothing? Just crop it like a regular video and it's fine?

I did everything you said but I get this error everytime:
Error: fwrite() call failed when writing frame: 3, plane: 1, errno: 32
Output 45 frames in 38.79 seconds (1.16 fps)

Video encoding using x265 failed with exit code: -1073741819 (0xC0000005)

-----------

I figured out this is about empty VBV parameteres.

After adding --vbv-bufsize 20000 --vbv-maxrate 20000 to the command like, the problem goes away but the results has missing DV in it. It's just a HDR10+ video as media info states.

The source is:
"Dolby Vision, Version 1.0, dvhe.07.06, BL+EL+RPU, Blu-ray compatible / SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible"

The result(with --dolby-vision-profile 8.1 --dolby-vision-rpu "E:\1.bin"
"SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible"

Any suggestions?

quietvoid
5th September 2021, 20:16
There's nothing to do for the HDR10+ metadata, it's supposed to be compatible for any resolution.

For MediaInfo to detect Dolby Vision, you need to mux the video to a compatible container.
MKVToolNix version 58 and newer supports this.

Does the x265 log mention if it worked successfully?
It should say this: VES muxing with Dolby Vision RPU file successful in x265

LazyNcoder
7th September 2021, 10:58
There's nothing to do for the HDR10+ metadata, it's supposed to be compatible for any resolution.

For MediaInfo to detect Dolby Vision, you need to mux the video to a compatible container.
MKVToolNix version 58 and newer supports this.

Does the x265 log mention if it worked successfully?
It should say this: VES muxing with Dolby Vision RPU file successful in x265

Thank you very much. I checked the hevc before muxing to MKV. After muxing it, mediainfo shows the DV.

But there is one other thing. I noticed the info on the source:
Dolby Vision, Version 1.0, dvhe.07.06, BL+EL+RPU

But on the encoded file it's:
Dolby Vision, Version 1.0, dvhe.08.06, BL+RPU

Is this OK? I mean the "EL" is missing on the encoded file. I don't know what that is anyways :D

Again, thank you

quietvoid
7th September 2021, 13:08
But there is one other thing. I noticed the info on the source:
Dolby Vision, Version 1.0, dvhe.07.06, BL+EL+RPU

But on the encoded file it's:
Dolby Vision, Version 1.0, dvhe.08.06, BL+RPU

Is this OK? I mean the "EL" is missing on the encoded file. I don't know what that is anyways :DYes it's normal, only profile 7 requires the EL (enhancement layer), which is a separate video track.

Boulder
7th September 2021, 14:15
So is it possible to downscale the normal video to 1440p or 1080p and then combine it with the DV data when encoding?

quietvoid
7th September 2021, 14:23
So is it possible to downscale the normal video to 1440p or 1080p and then combine it with the DV data when encoding?

It should work fine, there's only more steps involved if there are still letterbox bars in the content.

Boulder
7th September 2021, 17:14
It should work fine, there's only more steps involved if there are still letterbox bars in the content.

I never leave the black bars there, I always crop them before denoising and downscaling. So this would be just a case of running dovi_tool -m 2 -c extract-rpu to get the RPU file for the x265 encoding part?

quietvoid
7th September 2021, 17:20
So this would be just a case of running dovi_tool -m 2 -c extract-rpu to get the RPU file for the x265 encoding part?
Yes, normally.

Balling
11th September 2021, 11:17
You can just use ffmpeg -i file.mp4 -strict unofficial file.mp4

You can also change mp4 brand with -brand.

That will preserve DoVi sidedata and will play on LG TVs, triggering Dolby Vision icon.

DoVi support commit needed: https://github.com/FFmpeg/FFmpeg/commit/b8243b3edfe91dcd74621edd5fd4f5f95b7bf8f3

Nico8583
12th October 2021, 14:58
Yes it's normal, only profile 7 requires the EL (enhancement layer), which is a separate video track.
Hi,
Another question about that.
MakeMKV can make a single track profile 7 with BL+EL+RPU but profile 7 is a separate tracks ?! How can it do that ? Is it a real supported format ?Thanks !

SeeMoreDigital
12th October 2021, 15:05
MakeMKV can make a single track profile 7 with BL+EL+RPU but profile 7 is a separate tracks ?! How can it do that ? Is it a real supported format ?Thanks !
Such muxes no longer conform to 'Profile 7'...

quietvoid
12th October 2021, 15:16
Hi,
Another question about that.
MakeMKV can make a single track profile 7 with BL+EL+RPU but profile 7 is a separate tracks ?! How can it do that ? Is it a real supported format ?Thanks !

It just adds the second track NALUs as type 63 (regular HEVC NALUs) and type 62 (RPU). All of this is added after every slice in the BL (HDR10 stream).

Such muxes no longer conform to 'Profile 7'...

Not quite, it is still conformant as a "Combo Dolby Vision stream in a single Dolby Vision PID".
Combo Dolby Vision stream containing the BL, EL and RPU substreams
or BL and RPU substreams shall be carried as a regular AVC/HEVC
stream using the T-STD model.

SeeMoreDigital
12th October 2021, 15:20
Not quite, it is still conformant as a "Combo Dolby Vision stream in a single Dolby Vision PID".Surely our friends over at Dolby have created a new profile number for such muxes ;)

quietvoid
12th October 2021, 15:21
Another profile isn't necessary, this is just another way to carry the information.

SeeMoreDigital
12th October 2021, 15:30
Another profile isn't necessary, this is just another way to carry the information.That does surprise me. It's not like Dolby to make things simple!

Nico8583
12th October 2021, 18:02
Thanks for these informations. So what is the better way to keep DoVi ? Profile 7 like MakeMKV ? And do you think it could be possible to add this way to DoVi tool ? Thanks.

quietvoid
12th October 2021, 18:30
Thanks for these informations. So what is the better way to keep DoVi ? Profile 7 like MakeMKV ? And do you think it could be possible to add this way to DoVi tool ? Thanks.

MakeMKV would still be the simplest way, since it supports both discs and existing dual track MKVs.
Maybe one day dovi_tool can mux both tracks, but it would probably only support the raw streams as input.