quietvoid / hdr10plus_tool

CLI utility to work with HDR10+ in HEVC files.
MIT License
301 stars 33 forks source link

An option to set delay? #41

Closed boohboot closed 2 years ago

boohboot commented 2 years ago

Hey man, thats an amazing tool you've created. I want to ask, Is there a possibility to set a delay? Its seems like my meta data kicks in too early by less then a second. Im trying to create an hybrid movie with metadata from web-dl. I had to trim the video so both sources would start at the same frame and it did work but it wasnt enough since hevc cant be cropped presicly if im not mistaken, is there somthing else I can try?

quietvoid commented 2 years ago

Just edit the JSON to duplicate metadata. Should be straight forward in Python or anything else.

I don't plan on adding any editing features, since the file is readable and the metadata can easily be manipulated.

boohboot commented 2 years ago

Does this represent 1 frame? In order to create a delay of half a second do I need to insert 12 of these? { "BezierCurveData": { "Anchors": [ 102, 205, 307, 410, 512, 614, 717, 819, 922 ], "KneePointX": 0, "KneePointY": 0 }, "LuminanceParameters": { "AverageRGB": 0, "LuminanceDistributions": { "DistributionIndex": [ 1, 5, 10, 25, 50, 75, 90, 95, 99 ], "DistributionValues": [ 0, 0, 100, 0, 0, 0, 0, 0, 0 ] }, "MaxScl": [ 0, 0, 0 ] }, "NumberOfWindows": 1, "TargetedSystemDisplayMaximumLuminance": 400, "SceneFrameIndex": 0, "SceneId": 0, "SequenceFrameIndex": 0 }, { "BezierCurveData": { "Anchors": [ 102, 205, 307, 410, 512, 614, 717, 819, 922 ], "KneePointX": 0, "KneePointY": 0 }, "LuminanceParameters": { "AverageRGB": 0, "LuminanceDistributions": { "DistributionIndex": [ 1, 5, 10, 25, 50, 75, 90, 95, 99 ], "DistributionValues": [ 0, 0, 100, 0, 0, 0, 0, 0, 0 ] }, "MaxScl": [ 0, 0, 0 ] }, "NumberOfWindows": 1, "TargetedSystemDisplayMaximumLuminance": 400, "SceneFrameIndex": 1, "SceneId": 0, "SequenceFrameIndex": 1

boohboot commented 2 years ago

There seems to to be 2 sry. Are these 2 frames?

quietvoid commented 2 years ago

Frames are the objects in the SceneInfo array.

boohboot commented 2 years ago

Yeah that's where I took it from.

boohboot commented 2 years ago

My goodness, its was off by 40ms which equals to 1 frame LOL. Thanks for the help and keep up the good work.

Anuskuss commented 4 months ago

Sorry for necroing but I also need to delay some metadata. I understand that I need to duplicate the first entry in SceneInfo nth times but don't I also need to delay each entry in SceneInfoSummary/SceneFirstFrameIndex by n? Also don't I need to recalculate SceneInfoSummary/SceneFrameNumbers, or at least the first entry? What about SceneInfo/0/SequenceFrameIndex? Is it allowed to have the same index multiple times or do I need to add n to each entry after my clones? Could you provide a proper tutorial please?

quietvoid commented 4 months ago

Depends on what you do with the JSON. For encoding, only the entries in SceneInfo are relevant.

For use with other tools that use the first/total frames, they must be recalculated.

Anuskuss commented 4 months ago

Is encoding the same as injecting? Because that's what I wanna do: I extracted the HDR10+ metadata from one source and am trying to inject it into a DV source, but I do need to delay it. So you're saying duplicating entries in SceneInfo and then injecting will do?

quietvoid commented 4 months ago

For injecting you just need to duplicate the entries in SceneInfo. It uses the metadata in the order of the array.

Anuskuss commented 4 months ago

Okay thanks for the info. Would still prefer an "official" way but I might write a little script for myself only.

Anuskuss commented 4 months ago

Wrote the script and verified metadata.json (it's correct) but I got

Error: Invalid PPS index

after injecting. Why?

quietvoid commented 4 months ago

I have no idea what commands you're running, how do you expect me to know what's going on?

Anuskuss commented 4 months ago

Okay this doesn't seem to be related to the original issue so I'm going to open a new one.