Dolby Vision now possible through MP4 Mux.

Please post here for issues related to UHD discs
RESET_9999
Posts: 2406
Joined: Mon Aug 05, 2019 7:12 pm

Re: Dolby Vision now possible through MP4 Mux.

Post by RESET_9999 »

I'm trying to understand the editor.

What would be the script if I have to add 24 frames in the beginning and remove the last 2 frames at the end ( or should I be removing 26 frames since I'm delaying the metadata 24frames??)

I tried this but it doesn't work. Please fix my stupidity lol

Code: Select all

{
    "remove": [
        "167703-167704"
    ],
	"duplicate": [
		{
			"source": 0,
			"offset": 24,
			"length": 10
		}
	]
}


Also, what would be the script if I want to remove 24 frames in the beginning and add 10 frames at the end?

this?

Code: Select all

{
    "remove": [
        "0-23"
    ],
    "duplicate": [
        {
            "source": last_frame - 1,
            "offset": last_frame - 1,
            "length": 11
        }
    ]
}
Sorry for my English.
G5 / AM6B+ / Denon 7.2.4
DoVi_Scripts
DoVi Playback Devices
manuelrn
Posts: 12
Joined: Fri May 22, 2020 10:39 pm

Re: Dolby Vision now possible through MP4 Mux.

Post by manuelrn »

RESET_9999 wrote:
Fri Jul 23, 2021 10:26 pm
I'm trying to understand the editor.

What would be the script if I have to add 24 frames in the beginning and remove the last 2 frames at the end ( or should I be removing 26 frames since I'm delaying the metadata 24frames??)

I tried this but it doesn't work. Please fix my stupidity lol

Code: Select all

{
    "remove": [
        "167703-167704"
    ],
	"duplicate": [
		{
			"source": 0,
			"offset": 24,
			"length": 10
		}
	]
}
I think you need to swap the values of offset and length (length 24 and offset 10).
In fact, I suppose that the ideal would be to add the new frames after the frame that is taken as a sample (source), and not after frame 10 (length 24 and offset 0).

Regards!
Manixx2020beyound
Posts: 127
Joined: Thu Oct 08, 2020 5:19 pm

Re: Dolby Vision now possible through MP4 Mux.

Post by Manixx2020beyound »

RESET_9999 wrote:
Fri Jul 23, 2021 1:50 pm
quietvoid wrote:
Fri Jul 23, 2021 12:45 pm
Thanks for this.
To me there seems to be a slight tint change (so maybe whitebalance difference).
Would be pretty complicated to tell if it's just because the HDR10 version was encoded differently.


I asked @manix to provide lldv capture sample with his Shogun, this will be a more accurate way of comparing the colors/tint.
Bitrate increase looks Amazing with the Rpu
U can see a difference a huge diff to me along with the hdr black bars.
Star Wars is like a whole new movie lol
chros
Posts: 102
Joined: Sun Sep 20, 2020 8:36 am

Re: Dolby Vision now possible through MP4 Mux.

Post by chros »

RESET_9999 wrote:
Fri Jul 23, 2021 10:26 pm
What would be the script if I have to add 24 frames in the beginning and remove the last 2 frames at the end ( or should I be removing 26 frames since I'm delaying the metadata 24frames??)
Not sure about removing part (good question), but duplicating metadata of frame 26 in the beginning should look like this:

Code: Select all

"duplicate": [
		{
			"source": 25,
			"offset": 0,
			"length": 25
		}
	]
RESET_9999 wrote:
Fri Jul 23, 2021 10:26 pm
Also, what would be the script if I want to remove 24 frames in the beginning and add 10 frames at the end?
Something like this:

Code: Select all

{
    "remove": [
        "0-23"
    ],
    "duplicate": [
        {
            "source": frame_count - 1,
            "offset": frame_count - 1,
            "length": 11
        }
    ]
}
chros
Posts: 102
Joined: Sun Sep 20, 2020 8:36 am

Re: Dolby Vision now possible through MP4 Mux.

Post by chros »

chros wrote:
Fri Jul 23, 2021 9:27 pm
So I created a fake DoVi ts (with tsmuxer) after extracting the hevc stream from mkv and injecting a mode3 converted rpu from profile5 stream (tricky part was to find the exact framenumbers).
The result (260 MB, up for a week) is only played back as DoVi via Oppo, but HDR10 from Kodi-firestick and Plex (on LG) didn't recognised it: not sure why.

That's what I did:
extract rpu from profile 5 hevc dovi:

Code: Select all

dovi_tool extract-rpu video.hevc
edit and convert the extracted rpu to proper frame count and profile 8.1:

Code: Select all

{
  "mode": 3,
  "remove": [
      "0-32245"
  ]
}

Code: Select all

dovi_tool editor -i RPU.bin -j edit.json --rpu-out RPU_mode3_4.bin
add rpu into hdr10 hevc:

Code: Select all

dovi_tool inject-rpu -i video.hevc --rpu_in RPU_mode3_4.bin
I tried to create an mp4 with mp4muxer (2020.03.06.) from the above files, but now everything plays it back as hdr10, even the Oppo:

Code: Select all

mp4muxer.exe --dv-profile 8 --input-file injected_output.hevc --input-file audio.ac3 --dv-bl-compatible-id 1 --output-file 1try.mp4
@quietvoid, do you know why?
ragico
Posts: 265
Joined: Fri Feb 15, 2019 1:09 am

Re: Dolby Vision now possible through MP4 Mux.

Post by ragico »

Hope that @quietvoid will make an easy tool to be used by ignorant people like me as @Yusesope did for his tools.
Thank you.
quietvoid
Posts: 377
Joined: Sun Apr 19, 2020 4:15 pm

Re: Dolby Vision now possible through MP4 Mux.

Post by quietvoid »

I just pushed a new version to fix the "Soul 2020" DoVi RPU parsing once converted to profile 8.
You can find it here: https://github.com/quietvoid/dovi_tool/ ... /tag/0.3.5

Played Soul a bit with a sample and there were some noticeable brightness adjustments at scene changes.
Maybe because of the different black bars, I'd have to test more. This was simply mode 3 and removing the first 40 frames.

chros wrote:
Sat Jul 24, 2021 11:43 am
I tried to create an mp4 with mp4muxer (2020.03.06.) from the above files, but now everything plays it back as hdr10, even the Oppo:

Code: Select all

mp4muxer.exe --dv-profile 8 --input-file injected_output.hevc --input-file audio.ac3 --dv-bl-compatible-id 1 --output-file 1try.mp4
@quietvoid, do you know why?
No, I'm not sure since I haven't used MP4 in a while. I can't remember if profile 8 ever worked.
I'll try your files and see.


ragico wrote:
Sat Jul 24, 2021 11:45 am
Hope that @quietvoid will make an easy tool to be used by ignorant people like me as @Yusesope did for his tools.
Thank you.
If you mean including batch scripts and things like FFmpeg, then no it's not going to happen.
The tool is already a cross platform executable, so there's no other dependency required.
Last edited by quietvoid on Sat Jul 24, 2021 4:49 pm, edited 5 times in total.
quietvoid
Posts: 377
Joined: Sun Apr 19, 2020 4:15 pm

Re: Dolby Vision now possible through MP4 Mux.

Post by quietvoid »

chros wrote:
Fri Jul 23, 2021 9:27 pm
So I created a fake DoVi ts (with tsmuxer) after extracting the hevc stream from mkv and injecting a mode3 converted rpu from profile5 stream (tricky part was to find the exact framenumbers).
The result (260 MB, up for a week) is only played back as DoVi via Oppo, but HDR10 from Kodi-firestick and Plex (on LG) didn't recognised it: not sure why.
Your .ts file and when I remux it as MKV both play in DoVi on my Firestick with Kodi.
chros
Posts: 102
Joined: Sun Sep 20, 2020 8:36 am

Re: Dolby Vision now possible through MP4 Mux.

Post by chros »

quietvoid wrote:
Sat Jul 24, 2021 3:42 pm
Your .ts file and when I remux it as MKV both play in DoVi on my Firestick with Kodi.
Thank for checking, still not here :( Also when I drag the ts file into recent mkvtoolnix, the mkv file also plays back as hdr10 with Kodi. (When I removed other files from the directory, Plex finally recognizes the ts file and plays it back as DoVi.)
Which Kodi version do you use? I have Kodi19DV-Final-libbluray-aarch32.apk from here (end of Feb 2021).
And yesterday when I switched on the Firestick after couple of weeks, there was an OS update again (I hate those), maybe that's why ? (Profile 5 mp4 files are still fine.)

But since you have a working sample, you can try out playing it back on your 2018 LG, from Firestik+Kodi and from Plex to be able to compare? Plex should be fine without issues, but if my guess is right, you should see heavy banding / posterization from Firestick+Kodi (meaning it only triggers player-led).
RESET_9999
Posts: 2406
Joined: Mon Aug 05, 2019 7:12 pm

Re: Dolby Vision now possible through MP4 Mux.

Post by RESET_9999 »

quietvoid wrote:
Sat Jul 24, 2021 3:17 pm
I just pushed a new version to fix the "Soul 2020" DoVi RPU parsing once converted to profile 8.
You can find it here: https://github.com/quietvoid/dovi_tool/ ... /tag/0.3.5

Played Soul a bit with a sample and there were some noticeable brightness adjustments at scene changes.
Maybe because of the different black bars, I'd have to test more. This was simply mode 3 and removing the first 40 frames.
thank you!
we definitely have a different version because on mine the frame difference is 56 and there is no black bars mismatch
I'll give it a go later but last night i watched 30 minutes of something else and there was absolutely no brightness jump. it looked amazing actually.

I'm able to remove / add frames at the start of the video with the json edits but I still don't understand how to add or remove frames at the end, every time i get ''error expected value'' ...SMH I'm stupid...
chros wrote:
Sat Jul 24, 2021 11:43 am
I tried to create an mp4 with mp4muxer (2020.03.06.) from the above files, but now everything plays it back as hdr10, even the Oppo:

Code: Select all

mp4muxer.exe --dv-profile 8 --input-file injected_output.hevc --input-file audio.ac3 --dv-bl-compatible-id 1 --output-file 1try.mp4
@quietvoid, do you know why?
is this version the latest one? because the new version doesnt work for me as well .. you have to use the very first version of the mp4muxer.

this one: https://drive.google.com/file/d/1yZ1EgB ... sp=sharing
Sorry for my English.
G5 / AM6B+ / Denon 7.2.4
DoVi_Scripts
DoVi Playback Devices
quietvoid
Posts: 377
Joined: Sun Apr 19, 2020 4:15 pm

Re: Dolby Vision now possible through MP4 Mux.

Post by quietvoid »

RESET_9999 wrote:
Sat Jul 24, 2021 5:27 pm
thank you!
we definitely have a different version because on mine the frame difference is 56 and there is no black bars mismatch
I'll give it a go later but last night i watched 30 minutes of something else and there was absolutely no brightness jump. it looked amazing actually.

I'm able to remove / add frames at the start of the video with the json edits but I still don't understand how to add or remove frames at the end, every time i get ''error expected value'' ...SMH I'm stupid...
I was just testing so didn't bother syncing the RPU properly, just tried to get the same length. That's probably why there was slight flicker.
This is what my JSON would look like:

Code: Select all

{
    "mode": 3,
    "active_area": {
        "crop": true,
        "presets": [
            {
                "id": 0,
                "left": 0,
                "right": 0,
                "top": 276,
                "bottom": 276
            }
        ],
        "edits": {
            "0-144684": 0
        }
    },
    "remove": [
        "0-55"
    ],
    "duplicate": [
        {
            "source": 144627,
            "offset": 144627,
            "length": 16
        }
    ]
}
I'm not sure if changing the black bars makes a difference, but Dolby Vision metadata often has odd numbered offsets (275 instead of 276).
Played the same sample and it looked perfect.
There's a slight frame freeze in the middle of it. Not sure what happened there. Happens when playing in HDR10 as well, so maybe the inject did something..

Also, when adding duplicated metadata, the process is done after removing. So that's something to keep in mind as well.


chros wrote:
Sat Jul 24, 2021 4:48 pm
quietvoid wrote:
Sat Jul 24, 2021 3:42 pm
Your .ts file and when I remux it as MKV both play in DoVi on my Firestick with Kodi.
Thank for checking, still not here :( Also when I drag the ts file into recent mkvtoolnix, the mkv file also plays back as hdr10 with Kodi. (When I removed other files from the directory, Plex finally recognizes the ts file and plays it back as DoVi.)
Which Kodi version do you use? I have Kodi19DV-Final-libbluray-aarch32.apk from here (end of Feb 2021).
And yesterday when I switched on the Firestick after couple of weeks, there was an OS update again (I hate those), maybe that's why ? (Profile 5 mp4 files are still fine.)

But since you have a working sample, you can try out playing it back on your 2018 LG, from Firestik+Kodi and from Plex to be able to compare? Plex should be fine without issues, but if my guess is right, you should see heavy banding / posterization from Firestick+Kodi (meaning it only triggers player-led).
I'm using my own build of Kodi, but it uses nightly so v20 N * and FFmpeg 4.4
I looked at the sample on both the TV's player and Firestick but there's not much difference for me.
The most noticeable thing is that the Firestick has worse near black gradients on the fade out of the Doom Patrol logo, so it shows as a black blob moving.
RESET_9999
Posts: 2406
Joined: Mon Aug 05, 2019 7:12 pm

Re: Dolby Vision now possible through MP4 Mux.

Post by RESET_9999 »

quietvoid wrote:
Sat Jul 24, 2021 6:00 pm

I was just testing so didn't bother syncing the RPU properly, just tried to get the same length. That's probably why there was slight flicker.
yep, it for sure is the reason why it flickers. The bluray Vigilante dv metadatas are clearly out of sync and when I watched it, I was amazed at how dynamic DV really is. There's a brightness changes literally every scene and sometimes, even on camera view changes.

Thank you for your JSON script, that's all I needed to understand how it works :D
Sorry for my English.
G5 / AM6B+ / Denon 7.2.4
DoVi_Scripts
DoVi Playback Devices
chros
Posts: 102
Joined: Sun Sep 20, 2020 8:36 am

Re: Dolby Vision now possible through MP4 Mux.

Post by chros »

quietvoid wrote:
Sat Jul 24, 2021 6:00 pm
I looked at the sample on both the TV's player and Firestick but there's not much difference for me.
The most noticeable thing is that the Firestick has worse near black gradients on the fade out of the Doom Patrol logo, so it shows as a black blob moving.
So, you don't see banding/posterization? That's promising ... :)
quietvoid wrote:
Sat Jul 24, 2021 6:00 pm
I'm using my own build of Kodi, but it uses nightly so v20 N * and FFmpeg 4.4
This must be it then, can you share your apk? Thanks
quietvoid
Posts: 377
Joined: Sun Apr 19, 2020 4:15 pm

Re: Dolby Vision now possible through MP4 Mux.

Post by quietvoid »

chros wrote:
Sat Jul 24, 2021 6:31 pm
This must be it then, can you share your apk? Thanks
I'm not sure if it's going to be a different package, so backup first..
https://mega.nz/file/MdETXSAR#vPtlIY-nm ... NcRsZLlTyk

Apparently my injected Soul video is corrupted near (if not directly) at a seamless branching boundary. Looking into it..
Edit: Seems to be caused by the source video being extracted by FFmpeg.
No corruption in the source when using mkvextract.
RESET_9999
Posts: 2406
Joined: Mon Aug 05, 2019 7:12 pm

Re: Dolby Vision now possible through MP4 Mux.

Post by RESET_9999 »

quietvoid wrote:
Sat Jul 24, 2021 6:58 pm
Apparently my injected Soul video is corrupted near (if not directly) at a seamless branching boundary. Looking into it..
Edit: Seems to be caused by the source video being extracted by FFmpeg.
No corruption in the source when using mkvextract.
do you think if it could be possible to add an option to ignore the frame count and inject whatever you feed it? Do the few last frames really matter?
As long as the rpu is in sync with the BL at the start, it should be fine right? of course the default mode should stay as it is right now (frame count must match) but if you could just add a parameter like --ignore-framecount , that would save a lot of calculation.
Sorry for my English.
G5 / AM6B+ / Denon 7.2.4
DoVi_Scripts
DoVi Playback Devices
Post Reply