quietvoid / dovi_tool

dovi_tool is a CLI tool combining multiple utilities for working with Dolby Vision.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve active area edits in RPU Editor

manuelrn opened this issue · comments

It would be nice to update the edits inside active_area to support replacing a L5 metadata with another L5 metadata.

This would be helpful and very useful for videos that have a variable aspect ratio, for example videos with IMAX scenes.

I mean to do something similar to this:

{
	"active_area": {
		"presets": [
			{
				"id": 0,
				"left": 0,
				"right": 0,
				"top": 138,
				"bottom": 138
			},
			{
				"id": 1,
				"left": 190,
				"right": 190,
				"top": 0,
				"bottom": 0
			}
		],
		"edits": {
			"0, 0, 276, 276": 0,
			"380, 380, 0, 0": 1
		}
	}
}

This way the user would not have to go through the effort of manually searching for all the scenes with different aspect ratios and making a range of frames list of all the scenes.

Thanks and regards!

P.S. If this is finally implemented, it would be ideal if there is also an internal counter that counts each time an L5 metadata is replaced, and once the whole process is finished, a summary is displayed showing the number of times each L5 metadata replacement has been applied.

This would be so that we can check and make sure that all frames have been replaced and there was not some scene that had different L5 metadata (for example "0, 0, 276, 277" instead of "0, 0, 276, 276").

@quietvoid can confirm this, but I am pretty sure you can already do this, "replacing a L5 metadata with another L5 metadata". I am confused by your example, with 4 values provided per edit, instead of a range of frames as required in current syntax. It's also unclear how you're proposing to avoid manually searching for variable L5 scenes through a change in dovi_tool editor either. For a real-world example, I recently worked in with a very complex video containing a number of scenes with different framing, and this is the .json I used to make L5 metadata edits:

{
  "mode": 0,
  "active_area": {
    "presets": [
      {
        "id": 0,
        "left": 970,
        "right": 968,
        "top": 277,
        "bottom": 277
      },
            {
        "id": 1,
        "left": 480,
        "right": 480,
        "top": 277,
        "bottom": 277
      },
                  {
        "id": 2,
        "left": 478,
        "right": 478,
        "top": 277,
        "bottom": 277
      },
                  {
        "id": 3,
        "left": 478,
        "right": 480,
        "top": 277,
        "bottom": 277
      },
                  {
        "id": 4,
        "left": 802,
        "right": 802,
        "top": 277,
        "bottom": 277
      },
                  {
        "id": 5,
        "left": 830,
        "right": 830,
        "top": 277,
        "bottom": 277
      },
                  {
        "id": 6,
        "left": 803,
        "right": 841,
        "top": 277,
        "bottom": 277
      },
                  {
        "id": 7,
        "left": 823,
        "right": 827,
        "top": 277,
        "bottom": 277
      },
                  {
        "id": 8,
        "left": 807,
        "right": 841,
        "top": 277,
        "bottom": 277
      },
                  {
        "id": 9,
        "left": 749,
        "right": 749,
        "top": 277,
        "bottom": 277
      },
                  {
        "id": 10,
        "left": 820,
        "right": 888,
        "top": 292,
        "bottom": 296
      },
                  {
        "id": 11,
        "left": 827,
        "right": 873,
        "top": 290,
        "bottom": 289
      },
                  {
        "id": 12,
        "left": 829,
        "right": 873,
        "top": 286,
        "bottom": 289
      }
    ],
    "edits": {
      "2702-4991": 0,
      "20277-20389": 6,
      "21075-21182": 7,
      "21183-21365": 8,
      "21366-21675": 9,
      "21676-21750": 8,
      "21751-21855": 10,
      "21856-21935": 8,
      "21936-21992": 11,
      "21993-22058": 12,
      "22059-22127": 8,
      "74164-74548": 1,
      "74681-74745": 2,
      "74746-74784": 3,
      "74785-75242": 4,
      "75358-76033": 4,
      "122358-122626": 5
    }
  }
}

You can quite easily just export the RPU as JSON and script something that will output the existing L5 metadata ranges.
So it's not really something that needs to be in dovi_tool.

I'd also rather extend the export subcommand to allow output of different things such as scene cuts, L5 ranges, etc.

@quietvoid That would be a fantastic addition to the export subcommand. If you decide to implement it, I'd definitely find it useful in my scripting. Appreciate your efforts.

I've refactored export to allow setting what data to export. Currently it supports 3 options:

  • all: Exports the list of RPUs as a JSON file
  • scenes Exports the frame indices at which scene_refresh_flag is set to 1
  • level5: Exports the video's L5 metadata in the form of an editor config JSON

Maybe there are other relevant exports that could be useful, but this is all I could think of for my use cases, at least.

cc @R3S3t9999, anything that could be useful to avoid parsing the big JSON?

L5 and scene cuts sound good to me. That would be enough for my use cases as well. thanks

@manuelrn #256 should be enough for your use case.

You can use dovi_tool export -d level5 to get part of the editor JSON config for the active area.
Then you can manually edit the presets accordingly.