Log in

View Full Version : [DDVT Tool] Dolby Vision RPU Demuxing / Injecting / Editing.


Pages : [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

-QfG-
4th December 2021, 22:16
DDVT Tool Download Folder on MEGA.
(The tool based on quietvoids tools)

-Demuxing DV Metadata from MKVs/MP4s.
-Convert HDR10+ Metadata to DoVi Metadata (Experimental).
-Convert Profile 7/5 Metadata to Profile 8.1.
-Inject DoVi Metadata in Streams.
-Easy Delay Adjustment in Injector.
-Complete Open Source Batch Scripts!

Credits to quietvoid for his awesome tools.
Credits to Atak_Snajpera for the BorderDetect tool.


https://i.imgur.com/33IWTl9.png
https://i.imgur.com/n5LCixv.png
https://i.imgur.com/VNNQXDd.png


>> DOWNLOAD via GITHUB (https://github.com/DonaldFaQ/DDVT) <<

quietvoid
4th December 2021, 23:14
The mastering display metadata you used is correct.

For the min value, it is 10000x the float value. So 10000 * 0.0001 = 1.
Max stays the same.

-QfG-
5th December 2021, 01:17
Ok, thank you quietvoid.

-QfG-
5th December 2021, 04:13
i have created 2 little Batch scripts, one Demuxer and one Injector. With this scripts you can simply:

- Change DoVi Profile 7,5 to Profile 8
- Adding Delays (useful for Hybrid Releases)
- Convert HDR10+ Metadata to DoVi Profile 8 Metadata
- Delete HDR10+ Metadata from Videostream

https://i.imgur.com/XNprZRb.png

https://workupload.com/file/GWpvx2dzvcs

quietvoid many thanks for this awesome tools.

Nico8583
5th December 2021, 11:44
Hi,
I have a question : now if we can convert HDR10+ to DoVi, is it possible to convert DoVi to HDR10+ ?
Thanks !

quietvoid
5th December 2021, 14:48
Hi,
I have a question : now if we can convert HDR10+ to DoVi, is it possible to convert DoVi to HDR10+ ?
Thanks !

In theory it is, but there's no implementation for it.

Nico8583
5th December 2021, 20:00
Thank you, do you plan to add it later ?

quietvoid
5th December 2021, 20:03
No, I have no way to test anything related to HDR10+.

shodan5000
5th December 2021, 21:47
i have created 2 little Batch scripts, one Demuxer and one Injector.

Thank you very much! I am having an issue though. I'm testing a HDR10+ film and running it through the demuxer batch file to convert to DV. Everything seems to go just fine in the conversion and it appears to complete successfully. However, I can't find any resulting RPU.bin file. The generated folder is completely empty.

I've also tested a DV film and that process seems to work well and leaves a generated RPU.bin file.

Also, since dovi_tool is capable of converting the RPU to be profile 8.1 compatible, why is that option not available and only profile 8 is shown? Can that be added?

RanmaCanada
5th December 2021, 22:43
I hate to ask, but are there any plans to make a gui, even a basic one? This is fantastic work, seriously, it's just I am no longer comfortable with command lines in my "old" age haha (decades of AIX in my youth has taken it's toll). If I could, I would buy both you and quietvoid some pizza, or beer, or coffee, or chocolates/candy haha whatever you'd prefer!

von Suppé
6th December 2021, 09:22
Eventhough I got myself accustomed to do every step with the cli of quietvoid's tools, your scripts are welcome and handy additions. Love the drag & drop support.
Thanks, -QfG-

shodan5000
13th December 2021, 00:38
Nothing? No follow-up at all?

-QfG-
28th December 2021, 16:22
Here my newest scripts. Credits to @quietvoid for his awesome Tools. But i still have problems with the HDR10+ to DV conversion. I'm to stupid for this.

If anyone can fix the JSON script for HDR10+ converting, please tell it me.

Whats new?

I have many trouble with FFMPEG, so for MKV files i use mkvextract to demux and for mp4 files mp4box.
You can:

DEMUXER
-Extract RPU from Profile 5,7,8 and switch to profile 8.
-Erase HDR10+ Metadata during extracting.
-Crop the target RPU.

INJECTOR
-You can inject RPU into HDR Stream.
-You can discard HDR10+ Metadata in source stream.
-You can simply Edit Frames for hybrid releases.
-You can mux the raw hevc stream into mkv container (using mkvmerge) with correct DV infos.

Known Bugs:

-HDR10+ to DV Conversion will not working (JSON Script Error)

Everyone can change and fix something on the scripts without any permissions.

Newest Scripts are here:
https://1fichier.com/?6h70dlix91tsgmzaelar

Preview Pictures:

https://i.imgur.com/jrHbp7T.png
https://i.imgur.com/XZ8L4Eh.png

Also, since dovi_tool is capable of converting the RPU to be profile 8.1 compatible, why is that option not available and only profile 8 is shown? Can that be added?
If u convert the RPU in Profile 8 and inject this in an SDR Stream it is 8.2 and in an HDR Stream it is 8.1.

shodan5000
29th December 2021, 02:30
I'm just not understanding the operation here. Apologies in advance, but could you baby step the operation of this for me. I've dropped a profile 5 video onto the demuxer and it creates a folder with the newly created profile 8 RPU in it, nothing else. Now what? I have no other file except the original profile 5 video to drop onto the injector. The injector will not accept this file to operate. How exactly, in steps, do you get the new RPU injected correctly?

-QfG-
29th December 2021, 08:29
You need another HDR10 file where you can now inject the DV RPU. DV Profile 5 Videos are only DV5 without HDR Fallback.

von Suppé
29th December 2021, 13:54
:thanks: for the new scripts, -QfG-

shodan5000
29th December 2021, 18:34
You need another HDR10 file where you can now inject the DV RPU. DV Profile 5 Videos are only DV5 without HDR Fallback.

Thank you for the response. However, I'm even more confused now lol. Is it not one of the points of this program is the ability to convert profile 5 into profile 8 and then inject that?

Cilow
1st January 2022, 20:45
Yes. You need to convert the RPU File from Profile 5 to Profile 8 and then inject it back into the MKV File.
Profile 5 is DV Only, which has no Fallback to HDR10. So in case you play this File (with Profile 5) on a non-dv TV, you will have no Picture or maybe a Picture which will not shown correct.
Thats bc you need to convert it to Profile 8. Profile 8 has a Fallback to HDR and can be played on every player.

von Suppé
2nd January 2022, 21:37
Not having such a file myself, but I understand profile 5 is used for streaming services. It indeed has no backwards compatibility and uses DV's own IPTPQc2 color space.

Converting RPU from profile 5 to 8.1 and injecting it back, I wonder about what HDR10 baselayer it's injected into. Can this be any baselayer (recoded or not) from a different source, like UHDBD? In other words, is RPU interchangable between (a certain number of) profiles the video is deliverd in?

benwaggoner
3rd January 2022, 19:51
Not having such a file myself, but I understand profile 5 is used for streaming services. It indeed has no backwards compatibility and uses DV's own IPTPQc2 color space.

Converting RPU from profile 5 to 8.1 and injecting it back, I wonder about what HDR10 baselayer it's injected into. Can this be any baselayer (recoded or not) from a different source, like UHDBD? In other words, is RPU interchangable between (a certain number of) profiles the video is deliverd in?
8.1 requires a HDR-10 base layer. I doubt it matters much what the source is, as long as it is high quality and frame-synced to the Profile 5 content as long as the HDR-10 is derived from the DoVi master. If it's a different grade, metadata translation wouldn't be enough.

That said, why? Profile 5 is capable of somewhat better compression efficiency than 8.1, and is a lot more compatible. The only real advantage of 8.1 is that the file is backwards-compatible to HDR-10 displays without any DoVi support.

-QfG-
4th January 2022, 17:37
Update to v0.30. Many Bugfixes, HDR10+ to DV Conversion still working.
https://1fichier.com/?86t4gujfcl3hrv8eezw7

DV Profiles:

DV Profile 7 (UHDs [HDR BL+EL+RPU]) = Dual Layer DV Profile, FEL or MEL. Can be repacked in a single Layer stream (not official supported) via makeMKV. Single Layer mkv needs special Hard/Software for viewing in DV. Fallback to HDR: YES
DV Profile 8 (8.1[HDR BL+RPU] 8.2[SDR BL+RPU] 8.4[HLG BL+RPU]) = Single Layer Dolby Vision with Fallback to HDR if DV is not supported. Official DV Profile, can be played on every DV Player in a MP4 Container.
DV Profile 5 (WEB [HDR BL+RPU]) = Single Layer Dolby Vision without Fallback to HDR if DV is not supported. Official DV Profile, can be played on every DV Player in a MP4 Container.

Can this be any baselayer (recoded or not) from a different source, like UHDBD?

Yes, you can inject a converted Profile 8 RPU in a HDR Videostream, like UHD. The streams must be frame identical, if the stream have a delay you can set the delay with the scripts.

von Suppé
5th January 2022, 21:32
Thanks for both your answers, benwaggoner & -QfG-.

:thanks: for the new scripts

Kill3rWolf
10th January 2022, 00:14
Update to v0.30. Many Bugfixes, HDR10+ to DV Conversion still working.
https://1fichier.com/?86t4gujfcl3hrv8eezw7


Could you provide another link except 1fichier.com? 1fichier.com not working for me. Google Drive, Mega, clicknupload.cc & etc.

RanmaCanada
13th January 2022, 02:21
Could you provide another link except 1fichier.com? 1fichier.com not working for me. Google Drive, Mega, clicknupload.cc & etc.

I would suggest you use a VPN then as I just downloaded it with no problems. It's possible 1fichier might be blocked in your country.

Albano
15th January 2022, 09:12
Update to v0.30. Many Bugfixes, HDR10+ to DV Conversion still working.
https://1fichier.com/?86t4gujfcl3hrv8eezw7

DV Profiles:

DV Profile 7 (UHDs [HDR BL+EL+RPU]) = Dual Layer DV Profile, FEL or MEL. Can be repacked in a single Layer stream (not official supported) via makeMKV. Single Layer mkv needs special Hard/Software for viewing in DV. Fallback to HDR: YES
DV Profile 8 (8.1[HDR BL+RPU] 8.2[SDR BL+RPU] 8.4[HLG BL+RPU]) = Single Layer Dolby Vision with Fallback to HDR if DV is not supported. Official DV Profile, can be played on every DV Player in a MP4 Container.
DV Profile 5 (WEB [HDR BL+RPU]) = Single Layer Dolby Vision without Fallback to HDR if DV is not supported. Official DV Profile, can be played on every DV Player in a MP4 Container.



Yes, you can inject a converted Profile 8 RPU in a HDR Videostream, like UHD. The streams must be frame identical, if the stream have a delay you can set the delay with the scripts.

When I drag and drop mkv file into it, your tool close automatically.

GZZ
15th January 2022, 23:40
Did a MKV file create with MakeMKV with this HDR data:
HDR Info = [Dolby Vision, Version 1.0, dvhe.07.06, BL+EL+RPU, Blu-ray compatible / SMPTE ST 2086, HDR10 compatible]

and converted it to profile 8 and ended up with this:
HDR Info = [Dolby Vision, Version 1.0, dvhe.08.06, BL+RPU, HDR10 compatible / SMPTE ST 2086, HDR10 compatible]

The Profile 8 mkv file works and plays fine in infuse on my Apple TV 4k. Triggering the Dolby Vision logo on my LG Oled.

I though the Dolby vision layer (its the data in the RPU.bin file) would be larger then 65mb, even though its only single layer.

von Suppé
16th January 2022, 13:57
When I drag and drop mkv file into it, your tool close automatically.
You should not drag a file into the tool's window. Instead, drag your video on one of the "*.cmd" files itself.

GZZ
16th January 2022, 15:45
or just use

DDVT DEMUXER.cmd "MyFile.mkv"
DDVT INJECTOR.cmd "MyFile.mkv"

and keep all files in the same folder.

-QfG-
20th January 2022, 17:39
v0.32 Online via MEGA Folder.

-Updated Dovi_Tool.exe to v.1.45 (created by quietvoid).
-minor bugfixes.

Download in the first post.

Boulder
22nd January 2022, 09:36
I tested the extractor on one mkv file I have, but x265 complains that the RPU file contains a different number of frames compared to the video track. How can I verify this, and is it possible to find out the number of frames in the RPU?

GZZ
22nd January 2022, 12:28
v0.32 Online via MEGA Folder.

-Updated Dovi_Tool.exe to v.1.45 (created by quietvoid).
-minor bugfixes.

Download in the first post.

You should update your script by removing this part, as Dovi_tool now just replace the current layer with the new one.


REM if "%ERRORLEVEL%"=="0" (
REM %RED%
REM echo Dolby Vision Layer found.
REM echo.
REM %YELLOW%
REM echo Only HDR or SDR Streams supported.
REM echo Abort Operation now.
REM goto EXIT
REM )



also you should change this line


No Input File. Drag and Drop a file over this script or type "Dolby Vision Tool.bat <targetfile>".

to something like this:

No Input File. Use DDVT INJECTOR.cmd "YourFilename.mkv/mp4" or DDVT DEMUXER.cmd "YourFilename.mkv/mp4"

GZZ
22nd January 2022, 14:01
Anyone know what the CROP function does, I can specify a new Height and Width where the black bars are cropped out. Can anyone explain what it does ?

quietvoid
22nd January 2022, 15:43
I tested the extractor on one mkv file I have, but x265 complains that the RPU file contains a different number of frames compared to the video track. How can I verify this, and is it possible to find out the number of frames in the RPU?

Not really convenient but if you do `dovi_tool info -i RPU.bin -f 999999` it would error and print out the number of frames.

benwaggoner
23rd January 2022, 01:23
Anyone know what the CROP function does, I can specify a new Height and Width where the black bars are cropped out. Can anyone explain what it does ?
It specifies what's outside of the active image area, and doesn't get dynamic metadata or tone mapping.

Black bars are black bars, and should be presented at display black without tone mapping. Conversely a black pixel in the active image area gets treated as part of the continuous tone image, and might wind up displayed differently than a pixel of identical value in the letterbox.

GZZ
23rd January 2022, 11:28
So If I extract the RPU (no crop) and then apply it on a reencoded cropped movie, then part of the image dont get dynamic data or do I misunderstand it ?

benwaggoner
24th January 2022, 03:19
So If I extract the RPU (no crop) and then apply it on a reencoded cropped movie, then part of the image dont get dynamic data or do I misunderstand it ?
If you have a new file that simply doesn't have the letterboxing, than the active image area and the frame size are identical. You shouldn't need to change any other metadata.

-QfG-
25th January 2022, 23:20
v0.33 Online

-v0.33
*Multiple Instances Support
*Injector RAW File Support

EDIT:
v0.33a Online
-v0.33a
*Fixed bad strings if opened without file.

thx @GZZ
https://forum.doom9.org/showthread.php?p=1961946#post1961946

You should update your script by removing this part, as Dovi_tool now just replace the current layer with the new one.

The line in the injector is correct, the injector can't handle DV files, only HDR/SDR files.

Ryushin
27th January 2022, 16:28
Perhaps my mind is just addled having a cold, but reading GZZ's questions and the answers that were given to him regarding cropping still has me confused.

I have the original UHD source ripped into a MKV using MakeMKV that has the Dolby Vision stream encoded in it. I have another encode from the original source that has the letter box bars cropped out.

I would like to know if I need to use the Crop option when using the Demuxer on the original source that has the letterbox bars before using the Injector on the encoded file that does not have any letterbox bars.

BTW, big thanks for a tool that finally makes it easy to get the DV stream out so we can encode it in our own files. Now I'll have to go through all my UHD disks and find the ones that have Dolby Vision and extract it out.

Options I'd like to see to enable batching is the ability for the Demuxer to specify the output directory of RPU.bin along with perhaps naming it the same as the source file with RPU.bin as as the extension. Along those same lines having the Injector having the option of specifying the location and name of the RPU.bin. Also would be nice if the temp directory was removed after it was done.

von Suppé
28th January 2022, 20:33
@Ryushin

Yes. When extracting RPU from letterboxed source (black bars are part of video), for injecting it back in a cropped version, the crop option is required.

-QfG-
29th January 2022, 01:39
Wrong Informations. Correct answer here:
https://forum.doom9.org/showpost.php?p=1962686&postcount=45

von Suppé
29th January 2022, 10:48
how i understand the --crop function...

Source: 3840 x 2160 Letterboxed - Target 3840 x 1608 none Letterboxed = no crop switch needed
Can you tell me why no crop would be needed here? Please read from here: https://github.com/quietvoid/dovi_tool/issues/39#issuecomment-1010640787
If I understand quietvoid correctly, the crop values don't matter to dovitool. It would set the size of letterbox bars to zero.
Which does make me wonder if "undercropping" would cause issues. With undercropping I mean cropping, but not entirely removing the black bars.

-QfG-
29th January 2022, 11:47
Wrong Informations. Correct answer here:
https://forum.doom9.org/showpost.php?p=1962686&postcount=45

Ryushin
29th January 2022, 17:31
@Ryushin

Yes. When extracting RPU from letterboxed source (black bars are part of video), for injecting it back in a cropped version, the crop option is required.

how i understand the --crop function:

Source: 3840 x 2160 Letterboxed - Target 3840 x 2160 Letterboxed = no crop switch needed
Source: 3840 x 2160 Letterboxed - Target 3840 x 1608 none Letterboxed = no crop switch needed
Source: 3840 x 2160 Letterboxed - Target 1920 x 1080 Letterboxed = no crop switch needed
Source: 3840 x 2160 Letterboxed - Target 1920 x 704 none Letterboxed = crop switch needed

LOL. So some say yes to and some say no cropping. Just to get more clarification I'll ask again Github so I can know what cropping is intended for.

Boulder
29th January 2022, 17:36
My assumption is that whenever the final result doesn't have any black borders, you use the cropping option for the RPU.

quietvoid
29th January 2022, 21:23
My assumption is that whenever the final result doesn't have any black borders, you use the cropping option for the RPU.

Yes that's correct.

GZZ
29th January 2022, 22:00
Yes that's correct.


I makes sense, but how do you know how it crops the RPU?. I mean you will need to crop the end result just like the Crop function works on the RPU file. But as you dont set any crop resolution, how do you know how it cropped it ?

Ex.
Source UHD: 3840 x 2160 -> Crop RPU = Resolution ? - Reencoded and cropped movie: 3840 x 1680.

So what if the Cropped RPU has a resultion of 3840 x 1685 and the reencoded is 3840 x 1680, then its off by 5 pixel (not sure you can see that).

Wouldnt it be better if Dovi_tool took crop (Top, Bottom, Left, Right) values, so the RPU matches the Reencoded movie ?

quietvoid
29th January 2022, 22:12
I makes sense, but how do you know how it crops the RPU?. I mean you will need to crop the end result just like the Crop function works on the RPU file. But as you dont set any crop resolution, how do you know how it cropped it ?

Ex.
Source UHD: 3840 x 2160 -> Crop RPU = Resolution ? - Reencoded and cropped movie: 3840 x 1680.

So what if the Cropped RPU has a resultion of 3840 x 1685 and the reencoded is 3840 x 1680, then its off by 5 pixel (not sure you can see that).

The RPU contains active area offsets, which are set according to the size of the letterbox bars.
For example, a source file with resolution 3840x2160 might have an actual aspect ratio of 2.4 without letterbox bars, so the active area is 3840x1600.
In that case, the RPU has a L5 metadata entry with top and bottom offsets set to 280 pixels.
In playback, some devices would use this offset to apply tone mapping to the active area only.

If the RPU is "cropped", the 280 pixel offsets are set to zero. That indicates to the decoder that the video has no letterbox bars.
If the offsets were kept the same as the original, and the letterbox bars are not in the final video, then some players might overcrop the video on playback.


Wouldnt it be better if Dovi_tool took crop (Top, Bottom, Left, Right) values, so the RPU matches the Reencoded movie ?
You can already do this with the editor. The crop argument is only for convenience.

Say you have a final video of resolution 1920x1080 which contains letterbox bars. And the source is the example above, with actual active area of 3840x1600.
That means the offsets need to be halved to match the new resolution, giving us 140 pixels.

You could edit the RPU active area with this:

{
"mode": 2,
"active_area": {
"presets": [
{
"id": 0,
"left": 0,
"right": 0,
"top": 140,
"bottom": 140
}
],
"edits": {
"all": 0
}
}
}

-QfG-
29th January 2022, 23:08
Dolby_Vision_Tool_v0.34 Online:

-v0.34
*Added Options Menu (you can create Shell Extensions).
*Added info string to crop function.
*Fixed bad FPS settings by muxing in mkv.

https://i.imgur.com/MCyqYFw.png

cool advertise
30th January 2022, 00:03
You could edit the RPU active area with this:

{
"mode": 2,
"active_area": {
"presets": [
{
"id": 0,
"left": 0,
"right": 0,
"top": 140,
"bottom": 140
}
],
"edits": {
"all": 0
}
}
}


@-QfG-
Since I am not able to edit the crop values of the rpu, it would be of great use if a future version of the -QfG- tool would allow, after enabling the crop, to set the crop values (left, right, top, bottom) before creating the rpu, in order to adapt it exactly to each encoding.
And I think the left and top crop values are positive, and what to do with the right and bottom crop values? Positive or negative?
Not sure but maybe they all have to be positive (if different from 0).
And finally hdr10plus_tool.exe contained in the -QfG- tool is obsolete (1.2.1), the new version has been released (1.2.2).
By the way, great job to both of you, quietvoid and -QfG-

quietvoid
30th January 2022, 00:24
And I think the left and top crop values are positive, and what to do with the right and bottom crop values? Positive or negative?
Not sure but maybe they all have to be positive (if different from 0).

All active area offset values are positive.
They simply represent the size of the letterbox bars, in pixels.