Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Video Encoding > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 25th January 2021, 22:02   #1  |  Link
ShortKatz
Registered User
 
Join Date: Aug 2018
Location: Germany
Posts: 153
Pass over HDR10+ and Dolby Vision information?

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?
ShortKatz is offline   Reply With Quote
Old 25th January 2021, 22:24   #2  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 583
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/maste...on-dhdr10-info

For Dolby Vision, same principle: https://github.com/quietvoid/dovi_tool#extract-rpu
Feed to x265 with: https://x265.readthedocs.io/en/maste...lby-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.
quietvoid is offline   Reply With Quote
Old 1st September 2021, 04:00   #3  |  Link
Lollaskates
Registered User
 
Join Date: Feb 2021
Posts: 4
Quote:
Originally Posted by quietvoid View Post
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/maste...on-dhdr10-info

For Dolby Vision, same principle: https://github.com/quietvoid/dovi_tool#extract-rpu
Feed to x265 with: https://x265.readthedocs.io/en/maste...lby-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
Lollaskates is offline   Reply With Quote
Old 19th October 2022, 22:39   #4  |  Link
ShortKatz
Registered User
 
Join Date: Aug 2018
Location: Germany
Posts: 153
Quote:
Originally Posted by quietvoid View Post
For Dolby Vision, same principle: https://github.com/quietvoid/dovi_tool#extract-rpu
Feed to x265 with: https://x265.readthedocs.io/en/maste...lby-vision-rpu
Also have to specify the profile.
May I ask a question to this. I now extracted the RPU using
Code:
ffmpeg -i input.mkv -c:v copy -vbsf hevc_mp4toannexb -f hevc - | dovi_tool extract-rpu - -o RPU.bin
This worked nicely and gave me a 90MB file.
But how do I get the RPU into my encoded video?

First, I have tried it in HandBrake directly (which would be the perfect way). I've added
Code:
vbv-bufsize=160000:vbv-maxrate=160000:dolby-vision-profile=8.1:dolby-vision-rpu=/Filepath/RPU.bin
as additional options. But this did not work because of:
Code:
encx265: unknown option 'dolby-vision-rpu'
Then I've tried to first encode the video with HandBrake and then inject the RPU back into the final video with:
Code:
ffmpeg -i video.m4v -c:v copy -c:a copy -vbsf hevc_mp4toannexb -f hevc - | dovi_tool inject-rpu -i - --rpu-in /Filepath/RPU.bin -o final.mp4
But this did not work because of:
Code:
Error: RpuInjector: Must be a raw HEVC bitstream file
ShortKatz is offline   Reply With Quote
Old 20th October 2022, 01:00   #5  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 583
Quote:
Originally Posted by ShortKatz View Post
May I ask a question to this. I now extracted the RPU using
Code:
ffmpeg -i input.mkv -c:v copy -vbsf hevc_mp4toannexb -f hevc - | dovi_tool extract-rpu - -o RPU.bin
This worked nicely and gave me a 90MB file.
But how do I get the RPU into my encoded video?

First, I have tried it in HandBrake directly (which would be the perfect way). I've added
Code:
vbv-bufsize=160000:vbv-maxrate=160000:dolby-vision-profile=8.1:dolby-vision-rpu=/Filepath/RPU.bin
as additional options. But this did not work because of:
Code:
encx265: unknown option 'dolby-vision-rpu'
Then I've tried to first encode the video with HandBrake and then inject the RPU back into the final video with:
Code:
ffmpeg -i video.m4v -c:v copy -c:a copy -vbsf hevc_mp4toannexb -f hevc - | dovi_tool inject-rpu -i - --rpu-in /Filepath/RPU.bin -o final.mp4
But this did not work because of:
Code:
Error: RpuInjector: Must be a raw HEVC bitstream file
x265 supposedly only supports RPU files from CLI, so if Handbrake is using the library it might not be able to.
I think I've seen people use ffmpeg, but I'm not sure if it actually works.

For injecting, you need to be using the raw bitstream, it can't be piped.
So demux first, inject, remux. You also can't output in mp4, it'll just be HEVC with no container.
__________________
LG C2 OLED | GitHub Projects

Last edited by quietvoid; 20th October 2022 at 01:03.
quietvoid is offline   Reply With Quote
Old 26th January 2021, 01:08   #6  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 5,134
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.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 26th January 2021, 02:14   #7  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 583
Quote:
Originally Posted by benwaggoner View Post
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.

Last edited by quietvoid; 26th January 2021 at 02:20.
quietvoid is offline   Reply With Quote
Old 26th January 2021, 11:34   #8  |  Link
Nico8583
Registered User
 
Join Date: Jan 2010
Location: France
Posts: 851
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.
Nico8583 is offline   Reply With Quote
Old 26th January 2021, 22:28   #9  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 5,134
Quote:
Originally Posted by Nico8583 View Post
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.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 26th January 2021, 23:23   #10  |  Link
Nico8583
Registered User
 
Join Date: Jan 2010
Location: France
Posts: 851
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.

Last edited by Nico8583; 26th January 2021 at 23:27.
Nico8583 is offline   Reply With Quote
Old 27th January 2021, 01:47   #11  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 5,134
Quote:
Originally Posted by Nico8583 View Post
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.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 27th January 2021, 01:50   #12  |  Link
Nico8583
Registered User
 
Join Date: Jan 2010
Location: France
Posts: 851
Quote:
Originally Posted by benwaggoner View Post
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 ?
Nico8583 is offline   Reply With Quote
Old 27th January 2021, 04:24   #13  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 583
Quote:
Originally Posted by Nico8583 View Post
Thank you so DoVi BD use profile 5 ? Or 7 ?
Profile 7.
quietvoid is offline   Reply With Quote
Old 27th January 2021, 09:58   #14  |  Link
Nico8583
Registered User
 
Join Date: Jan 2010
Location: France
Posts: 851
Quote:
Originally Posted by quietvoid View Post
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.
Nico8583 is offline   Reply With Quote
Old 27th January 2021, 15:23   #15  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 583
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.
quietvoid is offline   Reply With Quote
Old 27th January 2021, 16:25   #16  |  Link
Nico8583
Registered User
 
Join Date: Jan 2010
Location: France
Posts: 851
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.
Nico8583 is offline   Reply With Quote
Old 27th January 2021, 17:04   #17  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 583
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.

Last edited by quietvoid; 27th January 2021 at 17:08.
quietvoid is offline   Reply With Quote
Old 27th January 2021, 19:18   #18  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 6,017
Erm, Profile 7 supports an enhancement layer, but 8.1 does not (just metadata on top of the HDR10 base)
Blue_MiSfit is offline   Reply With Quote
Old 27th January 2021, 20:17   #19  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 583
Quote:
Originally Posted by Blue_MiSfit View Post
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.
quietvoid is offline   Reply With Quote
Old 27th January 2021, 20:26   #20  |  Link
Nico8583
Registered User
 
Join Date: Jan 2010
Location: France
Posts: 851
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.
Nico8583 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.