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.

 

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

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th September 2022, 14:06   #381  |  Link
panni
Registered User
 
Join Date: Jun 2022
Posts: 5
This is how the source HDR MKV looks:
Frame rate mode : VFR
Frame rate : 23.951 fps

This is after injecting the RPU (with mux in MKV):
Frame rate mode : CFR
Frame rate : 25.000 fps
panni is offline   Reply With Quote
Old 8th September 2022, 15:32   #382  |  Link
von Suppé
Registered User
 
von Suppé's Avatar
 
Join Date: Dec 2013
Posts: 639
Mkv container doesn't really carry a header for "FPS", but for "default duration" instead. Therefore, "VFR 23.951 fps" could indeed be MediaInfo's misinterpretation of "regular CFR 23.976 fps" video. Which could be caused by some flawed timestamps.
Maybe a two-step is worth a try here. First remux the source HDR video (without RPU) using MKVToolNix with "Default duration/FPS" set to 24000/1001p. Drop that result on the DDVT_INJECTOR.
von Suppé is offline   Reply With Quote
Old 8th September 2022, 22:07   #383  |  Link
panni
Registered User
 
Join Date: Jun 2022
Posts: 5
Quote:
Originally Posted by von Suppé View Post
Mkv container doesn't really carry a header for "FPS", but for "default duration" instead. Therefore, "VFR 23.951 fps" could indeed be MediaInfo's misinterpretation of "regular CFR 23.976 fps" video. Which could be caused by some flawed timestamps.
Maybe a two-step is worth a try here. First remux the source HDR video (without RPU) using MKVToolNix with "Default duration/FPS" set to 24000/1001p. Drop that result on the DDVT_INJECTOR.
That worked, thank you so much!
panni is offline   Reply With Quote
Old 9th September 2022, 04:36   #384  |  Link
GodzilaAvenger
Registered User
 
GodzilaAvenger's Avatar
 
Join Date: Jul 2022
Posts: 123
Quote:
Originally Posted by GodzilaAvenger View Post
Is there a way to add delay (positive or negative) to HDR10+ metadata, similar to what can be done for DV?

I wrote the following Python script for adding positive or negative delay to HDR10+ metadata. Let me know if I missed anything, or if there is a better way of doing this.

@-QfG-: when injecting HDR10+ metadata into a file that already has one, is the previous one completely overwritten? Or should I first remove the previous one, then inject the new one?

Code:
import argparse
import json
import copy

# Parse the input arguments.

parser = argparse.ArgumentParser()

parser.add_argument('-i', '--input', nargs = '?', default = 'HDR10Plus.json', help = 'input HDR10+ JSON file')
parser.add_argument('-d', '--delay', nargs = '?', type = int, default = 0, help = 'desired delay (in number of frames)')
parser.add_argument('-o', '--output', nargs = '?', default = 'HDR10PlusEdited.json', help = 'output HDR10+ JSON file')

args = parser.parse_args()

with open(args.input, 'r') as hdr10plus:
    # Load the input file data.
    print("Reading the input file...")
    
    data = json.load(hdr10plus)
    
    print("Done!\n")
    
    if args.delay > 0:
        print("Applying delay...")
        
        # Add delay to SceneFrameIndex for each frame of the first scene.
        for i in range(data["SceneInfoSummary"]["SceneFrameNumbers"][0]):
            data["SceneInfo"][i]["SceneFrameIndex"] += args.delay
            
        # Add delay to SequenceFrameIndex of each frame.
        for frame in data["SceneInfo"]:
            frame["SequenceFrameIndex"] += args.delay
        
        # Duplicate the first frame, then correct SceneFrameIndex and SequenceFrameIndex.
        for i in range(args.delay):
            data["SceneInfo"].insert(0, copy.deepcopy(data["SceneInfo"][0]))
            data["SceneInfo"][0]["SceneFrameIndex"] -= 1
            data["SceneInfo"][0]["SequenceFrameIndex"] -= 1
            
        # Add delay to SceneFrameNumbers for the first scene.
        data["SceneInfoSummary"]["SceneFrameNumbers"][0] += args.delay
        
        # Add delay to SceneFirstFrameIndex of every scene apart from the first one.
        for i in range(1, len(data["SceneInfoSummary"]["SceneFirstFrameIndex"])):
            data["SceneInfoSummary"]["SceneFirstFrameIndex"][i] += args.delay
            
        print("Done!\n")
        
    elif args.delay < 0:
        print("Applying delay...")
        
        # Remove frames from the beginning. Note the SceneId and SceneFrameIndex of the first
        # remaining frame.
        del data["SceneInfo"][:-args.delay]
        
        frameZero = data["SceneInfo"][0]["SceneFrameIndex"]
        sceneZero = data["SceneInfo"][0]["SceneId"]
        
        # Add delay to SequenceFrameIndex of each frame and correct SceneId.
        for frame in data["SceneInfo"]:
            frame["SceneId"] -= sceneZero
            frame["SequenceFrameIndex"] += args.delay
            
        # Correct SceneFrameIndex for each frame of the first scene.
        for i in range(data["SceneInfoSummary"]["SceneFrameNumbers"][sceneZero] - frameZero):
            data["SceneInfo"][i]["SceneFrameIndex"] -= frameZero
            
        # Remove SceneFrameNumbers of any scene that has been removed, correct the value for the
        # first remaining scene.
        del data["SceneInfoSummary"]["SceneFrameNumbers"][:sceneZero]
        data["SceneInfoSummary"]["SceneFrameNumbers"][0] -= frameZero
        
        # Remove SceneFirstFrameIndex of any scene that has been removed, add delay to every
        # remaining scene apart from the first one.
        del data["SceneInfoSummary"]["SceneFirstFrameIndex"][1:sceneZero + 1]
        
        for i in range(1, len(data["SceneInfoSummary"]["SceneFirstFrameIndex"])):
            data["SceneInfoSummary"]["SceneFirstFrameIndex"][i] += args.delay
        
        print("Done!\n")

with open(args.output, 'w') as edited:
    # Write the output file data.
    print("Writing the output file...")
    
    json.dump(data, edited, indent = 2, separators=(", ", ": "))
    
    print("Done!\n")

Last edited by GodzilaAvenger; 9th September 2022 at 04:46.
GodzilaAvenger is offline   Reply With Quote
Old 9th September 2022, 15:06   #385  |  Link
LV8
Registered User
 
Join Date: Sep 2022
Posts: 3
Quote:
Originally Posted by GodzilaAvenger View Post
I wrote the following Python script for adding positive or negative delay to HDR10+ metadata. Let me know if I missed anything, or if there is a better way of doing this.

@-QfG-: when injecting HDR10+ metadata into a file that already has one, is the previous one completely overwritten? Or should I first remove the previous one, then inject the new one?

Code:
import argparse
import json
import copy

# Parse the input arguments.

parser = argparse.ArgumentParser()

parser.add_argument('-i', '--input', nargs = '?', default = 'HDR10Plus.json', help = 'input HDR10+ JSON file')
parser.add_argument('-d', '--delay', nargs = '?', type = int, default = 0, help = 'desired delay (in number of frames)')
parser.add_argument('-o', '--output', nargs = '?', default = 'HDR10PlusEdited.json', help = 'output HDR10+ JSON file')

args = parser.parse_args()

with open(args.input, 'r') as hdr10plus:
    # Load the input file data.
    print("Reading the input file...")
    
    data = json.load(hdr10plus)
    
    print("Done!\n")
    
    if args.delay > 0:
        print("Applying delay...")
        
        # Add delay to SceneFrameIndex for each frame of the first scene.
        for i in range(data["SceneInfoSummary"]["SceneFrameNumbers"][0]):
            data["SceneInfo"][i]["SceneFrameIndex"] += args.delay
            
        # Add delay to SequenceFrameIndex of each frame.
        for frame in data["SceneInfo"]:
            frame["SequenceFrameIndex"] += args.delay
        
        # Duplicate the first frame, then correct SceneFrameIndex and SequenceFrameIndex.
        for i in range(args.delay):
            data["SceneInfo"].insert(0, copy.deepcopy(data["SceneInfo"][0]))
            data["SceneInfo"][0]["SceneFrameIndex"] -= 1
            data["SceneInfo"][0]["SequenceFrameIndex"] -= 1
            
        # Add delay to SceneFrameNumbers for the first scene.
        data["SceneInfoSummary"]["SceneFrameNumbers"][0] += args.delay
        
        # Add delay to SceneFirstFrameIndex of every scene apart from the first one.
        for i in range(1, len(data["SceneInfoSummary"]["SceneFirstFrameIndex"])):
            data["SceneInfoSummary"]["SceneFirstFrameIndex"][i] += args.delay
            
        print("Done!\n")
        
    elif args.delay < 0:
        print("Applying delay...")
        
        # Remove frames from the beginning. Note the SceneId and SceneFrameIndex of the first
        # remaining frame.
        del data["SceneInfo"][:-args.delay]
        
        frameZero = data["SceneInfo"][0]["SceneFrameIndex"]
        sceneZero = data["SceneInfo"][0]["SceneId"]
        
        # Add delay to SequenceFrameIndex of each frame and correct SceneId.
        for frame in data["SceneInfo"]:
            frame["SceneId"] -= sceneZero
            frame["SequenceFrameIndex"] += args.delay
            
        # Correct SceneFrameIndex for each frame of the first scene.
        for i in range(data["SceneInfoSummary"]["SceneFrameNumbers"][sceneZero] - frameZero):
            data["SceneInfo"][i]["SceneFrameIndex"] -= frameZero
            
        # Remove SceneFrameNumbers of any scene that has been removed, correct the value for the
        # first remaining scene.
        del data["SceneInfoSummary"]["SceneFrameNumbers"][:sceneZero]
        data["SceneInfoSummary"]["SceneFrameNumbers"][0] -= frameZero
        
        # Remove SceneFirstFrameIndex of any scene that has been removed, add delay to every
        # remaining scene apart from the first one.
        del data["SceneInfoSummary"]["SceneFirstFrameIndex"][1:sceneZero + 1]
        
        for i in range(1, len(data["SceneInfoSummary"]["SceneFirstFrameIndex"])):
            data["SceneInfoSummary"]["SceneFirstFrameIndex"][i] += args.delay
        
        print("Done!\n")

with open(args.output, 'w') as edited:
    # Write the output file data.
    print("Writing the output file...")
    
    json.dump(data, edited, indent = 2, separators=(", ", ": "))
    
    print("Done!\n")
Hi, I'm quite new to this DoVi hybrid world but would it be possible to implement this in the tool?

Last edited by LV8; 9th September 2022 at 17:46.
LV8 is offline   Reply With Quote
Old 9th September 2022, 22:00   #386  |  Link
-QfG-
QfG Group Germany
 
-QfG-'s Avatar
 
Join Date: Oct 2018
Location: Germany
Posts: 246
i test the script with any files, if it works well, i will add it.
-QfG- is offline   Reply With Quote
Old 11th September 2022, 11:48   #387  |  Link
von Suppé
Registered User
 
von Suppé's Avatar
 
Join Date: Dec 2013
Posts: 639
@-QfG-

I've read back the recent issue @panni mentioned. Am I correct when I think that in your scripts, you don't force mkvmerge with setting --default-duration header to proper value?
If so, wouldn't it be a good idea to always do this?
von Suppé is offline   Reply With Quote
Old 11th September 2022, 18:02   #388  |  Link
-QfG-
QfG Group Germany
 
-QfG-'s Avatar
 
Join Date: Oct 2018
Location: Germany
Posts: 246
Quote:
set "duration="
SETLOCAL ENABLEDELAYEDEXPANSION
if "!FRAMERATE!"=="23.976" set "duration=--default-duration 0:24000/1001p --fix-bitstream-timing-information 0:1"
if "!FRAMERATE!"=="24.000" set "duration=--default-duration 0:24p --fix-bitstream-timing-information 0:1"
if "!FRAMERATE!"=="25.000" set "duration=--default-duration 0:25p --fix-bitstream-timing-information 0:1"
if "!FRAMERATE!"=="30.000" set "duration=--default-duration 0:30p --fix-bitstream-timing-information 0:1"
if "!FRAMERATE!"=="48.000" set "duration=--default-duration 0:48p --fix-bitstream-timing-information 0:1"
if "!FRAMERATE!"=="50.000" set "duration=--default-duration 0:50p --fix-bitstream-timing-information 0:1"
if "!FRAMERATE!"=="60.000" set "duration=--default-duration 0:60p --fix-bitstream-timing-information 0:1"
Quote:
%MKVMERGEpath%" --output ^"%TARGET_FOLDER%\%HEADER_FILENAME%.mkv^" --no-video ^"^(^" ^"%~1^" ^"^)^" --language 0:und --compression 0:none !duration! ^"^(^" ^"%TARGET_FOLDER%\%HEADER_FILENAME%.hevc^" ^"^)^" --track-order 1:0
Of course i do this.

Quote:
VFR 23.951 fps
is not a valid framerate, for exotic framerates you must set this manually.

Last edited by -QfG-; 11th September 2022 at 18:04.
-QfG- is offline   Reply With Quote
Old 12th September 2022, 19:28   #389  |  Link
Sergio
Registered User
 
Sergio's Avatar
 
Join Date: Sep 2022
Posts: 1
Hello,

Thank you very much for your tools, it will save me a lot of time,
i used to do everything manually with dovi tool from quietvoid,
i mainly use for a little more than 1 year the p5_to_p81.json to make
a dv-hdr compatible for my Lg tv, I then used mp4muxer and
ffmpeg to convert to mp4 and add the subtitles.

I wanted to test by curiosity the conversion mkv to mp4 (DDVT Tool-v0.48c),
it works very well but just for information, the country of the secondary languages
as well as the subtitles do not correspond any more to the country of the mkv and are put in English,
as if it were by default.
Sergio is offline   Reply With Quote
Old 13th September 2022, 22:56   #390  |  Link
NeverExists
Registered User
 
Join Date: Jul 2022
Posts: 22
Quote:
Originally Posted by -QfG- View Post
Yes it is. But only if the MKV includes a profile 7 single layer HEVC file.

if you have a "REMUX" of an UHD, simply use the Demuxer and check the Options for Saving BL and EL (you can turn off RPU extracting, not needed for this operation). now you can Build a UHD with this, for example with TS-Muxer.



Thanks for this info quietvoid

I can add Apple DoVi Injection in future Updates.
How is the Apple Dovi injection coming along? Would love to see this as well.
NeverExists is offline   Reply With Quote
Old 19th September 2022, 08:43   #391  |  Link
NeverExists
Registered User
 
Join Date: Jul 2022
Posts: 22
Any word?
NeverExists is offline   Reply With Quote
Old 24th September 2022, 02:49   #392  |  Link
NeverExists
Registered User
 
Join Date: Jul 2022
Posts: 22
Has this been abandoned?
NeverExists is offline   Reply With Quote
Old 24th September 2022, 06:31   #393  |  Link
GodzilaAvenger
Registered User
 
GodzilaAvenger's Avatar
 
Join Date: Jul 2022
Posts: 123
Dude, chill... it's volunteer work so it's done when it's done. The project is open source (though not updated in a few months) so feel free to fork it and make the changes you need.
GodzilaAvenger is offline   Reply With Quote
Old 2nd October 2022, 17:38   #394  |  Link
RanmaCanada
Registered User
 
Join Date: May 2009
Posts: 333
Quote:
Originally Posted by NeverExists View Post
Any word?
The author said they CAN, not they will.

If you want something specific done by them, donate to their cause if they have a link on their github. All open source projects are done in the author's "spare" time, and money always helps to ensure they have more "spare: time as they can then dedicate more time to the project instead of real life things.
RanmaCanada is offline   Reply With Quote
Old 3rd October 2022, 01:06   #395  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,828
The Apple DoVi HLG + dynamic metadata profile was largely created by Apple, not Dolby. I imagine it could be harder to find documentation or reference code. Plus it's only testable on Apple devices AFAIK.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 4th October 2022, 21:11   #396  |  Link
Lucius Snow
Registered User
 
Join Date: Oct 2003
Posts: 157
I'm back on this topic. Thank you for the XML -> RPU conversion support!

I'm trying to make a Blu-Ray with a Dolby Vision stream. Profile 7 is required for this. However, when converting the XML generated by DaVinci to the RPU binary, the software mentions it as a Profile 8.1. That's the same whatever the CMU I use (2.9 or 4.0).

DDVT Tools converts from 7 to 8.1 but not the opposite. What should I do?

At the moment, I can only achieve Blu-Ray UHD HDR authoring with HDR10.

Thanks.
Lucius Snow is offline   Reply With Quote
Old 4th October 2022, 21:53   #397  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 574
Quote:
Originally Posted by Lucius Snow View Post
I'm trying to make a Blu-Ray with a Dolby Vision stream. Profile 7 is required for this.
There currently isn't a public/free solution for authoring UHD Blu-ray compatible profile 7, as it requires a second HEVC stream aligned with the base HDR10 video.
__________________
LG C2 OLED | GitHub Projects
quietvoid is online now   Reply With Quote
Old 4th October 2022, 22:15   #398  |  Link
rwill
Registered User
 
Join Date: Dec 2013
Location: Berlin, Germany
Posts: 379
Quote:
Originally Posted by quietvoid View Post
There currently isn't a public/free solution for authoring UHD Blu-ray compatible profile 7, as it requires a second HEVC stream aligned with the base HDR10 video.
Well if one uses x265 one could disable scenecut detection and adaptive B-Frames, like run a fixed GOP structure, and 2 streams with the same picture count will be aligned? Am I missing something?
rwill is offline   Reply With Quote
Old 4th October 2022, 22:43   #399  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 574
Quote:
Originally Posted by rwill View Post
Well if one uses x265 one could disable scenecut detection and adaptive B-Frames, like run a fixed GOP structure, and 2 streams with the same picture count will be aligned? Am I missing something?
It's probably possible that way, but suboptimal.
__________________
LG C2 OLED | GitHub Projects
quietvoid is online now   Reply With Quote
Old 4th October 2022, 23:04   #400  |  Link
Lucius Snow
Registered User
 
Join Date: Oct 2003
Posts: 157
I wonder how a profile 7 can be generated if the color grading softwares themselves deliver 8.X profiles. There might exist a 8.X to 7 converter somewhere, no? Maybe in DEE which costs $500 per year?
Lucius Snow 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 11:51.


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