Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested-ordered chapters #232

Closed
hubblec4 opened this issue Jun 18, 2018 · 14 comments · Fixed by #543
Closed

Nested-ordered chapters #232

hubblec4 opened this issue Jun 18, 2018 · 14 comments · Fixed by #543
Labels
clarifications spec_main Main Matroska spec document target

Comments

@hubblec4
Copy link
Contributor

This is another big topic where nothing is defined(I found nothing).

Practice:
LAV-Filters ignores the "ordered" state of such nested-ordered chapters and use the start time as chapter mark only.

What is the current "normal" usage? What does VLC?

When I create my Matroska-menu chapter files I must ever insert a top-level ordered chapter(hidden) and a nested chapter. The start and end time is ever the same for both chapters.

A Matroska player should handle nested ordered chapters equal to normal ordered chapters or is this not possible?

@robUx4
Copy link
Contributor

robUx4 commented Jun 25, 2018

Ordered chapters have to have a beginning and an end, unlike regular chapters which only need a start and are used as starting points in the stream. Given that, nested ordered chapters enforce a certain duration on their direct parent (and so on) which cannot differ from the sum of their children. But this parent cannot also have a start/end defined otherwise it would directly address a portion of the stream that may not be the same as its children.

So there has to be a rule saying only one ordered chapter level is allowed to have an end address in a particular chapter tree (good wording to be found). On the other end, one could use chapters with no end under elements with a end to add some "bookmarks" to jump to in the virtual stream.

@hubblec4
Copy link
Contributor Author

hubblec4 commented Jun 25, 2018

Ordered chapters have to have a beginning and an end, unlike regular chapters which only need a start and are used as starting points in the stream.

Logical.

Given that, nested ordered chapters enforce a certain duration on their direct parent (and so on) which cannot differ from the sum of their children.

Maybe I understand this not correctly but,

Normal chapters with nested chapters:

  1. chapter 00:00:00.000000000
    1.1. chapter 00:00:00.000000000 (first nested chapter, minimum start time 0)
    ....
    ....
    1.10. chapter 00:01:00.000000000 (last nested chapter, maximum start time 1 minute. (Or have to be less then 1 minute?)
  2. chapter 00:01:00.000000000

All nested chapters start time must between 0 and 1 minute.

Normal ordered chapters:

The start and end times do not have to be sorted in ascending order.

  1. chapter 00:10:00.000000000 - 00:11:00.000000000
  2. chapter 00:05:00.000000000 - 00:06:00.000000000

Each ordered chapter is independent from the others. Only the order of the chapters is important.

Nested ordered chapters:

For now, only Top-Level(1) ordered chapters are taken into account to generate the virtual timeline.
For all nested chapters is the start time used only. You can set something like this

  1. chapter 00:10:00.000000000 - 00:11:00.000000000
    1.1 chapter 00:00:30.000000000 - end time can be empty or any other value, because it is ignored
    1.2 chapter 00:01:30.000000000
  2. chapter 00:05:00.000000000 - 00:06:00.000000000

This video with a virtual timeline of 2 minutes has now 4 visible chapters

  1. chapter 0sec
  2. chapter 30sec
  3. chapter 60sec
  4. chapter 90sec

You see that all nested start times not between of the parent chapter times. And this is total OK, fine and good(for me).
Or is this behavior illegal or should be?

Full nested ordered chapters:

Remember, each ordered chapter works independent, and this says me I can use any start-end time.

  1. chapter 00:10:00.000000000 - 00:11:00.000000000
    1.1 chapter 00:02:00.000000000 - 00:03:00.000000000
    1.2 chapter 00:00:00.000000000 - 00:01:00.000000000
  2. chapter 00:05:00.000000000 - 00:06:00.000000000

This video has now a virtual duration of 4 minutes and 4 visible chapter marks in the timeline.
To build the virtual timeline you must use all chapters duration.
Before you append the duration of the 2.chapter to the virtual timeline, all nested ordered chapters from 1.chapter must be appended.

Before we define which Level is to used for ordered chapters, we can say all levels can be used for ordered chapters.

But this parent cannot also have a start/end defined otherwise it would directly address a portion of the stream that may not be the same as its children.

This is for me also a question of definition. For the moment is it necessary because nested ordered chapters are not allowed.
On the other hand I like the idea to have empty end time stamps, but this ends up in more difficulties to define all correctly.
Like you said, this chapters(only start) are markers in the timeline.

@robUx4 robUx4 added the spec_main Main Matroska spec document target label Dec 18, 2018
@robUx4
Copy link
Contributor

robUx4 commented Apr 4, 2021

We are missing some text explaining that the start and end of a Chapter MUST NOT be before or after the parent Chapter (in ordered chapters where there is a start/end).

@hubblec4
Copy link
Contributor Author

hubblec4 commented Apr 4, 2021

...the start and end of a Chapter MUST NOT be before or after the parent Chapter (in ordered chapters where there is a start/end).

I can't agree with that.

For non-ordered nested chapters it is fully OK, but not for ordered nested chapters.

From this example above

  1. chapter 00:10:00.000000000 - 00:11:00.000000000
    1.1 chapter 00:02:00.000000000 - 00:03:00.000000000
    1.2 chapter 00:00:00.000000000 - 00:01:00.000000000
  2. chapter 00:05:00.000000000 - 00:06:00.000000000

I could also set the 2 nested ordered chapters one level up and we get this:

  1. chapter 00:10:00.000000000 - 00:11:00.000000000
  2. chapter 00:02:00.000000000 - 00:03:00.000000000
  3. chapter 00:00:00.000000000 - 00:01:00.000000000
  4. chapter 00:05:00.000000000 - 00:06:00.000000000

But now is the presentation of the chapters in the player sub-optimal.
My menu mkv's uses currently this format:

  1. chapter 00:10:00.000000000 - 00:11:00.000000000
    1.1 chapter 00:10:00.000000000 - 00:11:00.000000000
  2. chapter 00:02:00.000000000 - 00:03:00.000000000 -> hidden
    2.1 chapter 00:02:00.000000000 - 00:03:00.000000000
  3. chapter 00:00:00.000000000 - 00:01:00.000000000 -> hidden
    3.1 chapter 00:00:00.000000000 - 00:01:00.000000000
  4. chapter 00:05:00.000000000 - 00:06:00.000000000

The presentation of the chapters looks like this

  1. chapter -> Start of Episode 1
    +1.1 chapter -> First chapter of Episode 1
    +1.2 chapter -> Second chapter of Episode 1
  2. chapter -> Start of Episode 2

All players supports only the top-level ordered chapters at the moment to build the virtual timeline.
So I have always to set a top-level hidden ordered chapter and a not hidden nested chapter.

Unfortunately I can not write a new Matroska player over night which supports nested-ordered chapters. :-(

@robUx4
Copy link
Contributor

robUx4 commented Apr 5, 2021

This is wrong

  • chapter 00:10:00.000000000 - 00:11:00.000000000
    • chapter 00:02:00.000000000 - 00:03:00.000000000
    • chapter 00:00:00.000000000 - 00:01:00.000000000

The first chapter says the player should play from 10s to 11s in the file. You cannot tell it to play from 2s to 3s within the same block.

Since you are familiar with dvdmenuxtractor, you should check the output. It is using ordered chapters and in the way I describe. I also found your old S06E00 - Hauptmenü sample and it does this as well.

@hubblec4
Copy link
Contributor Author

hubblec4 commented Apr 5, 2021

I have checked the players with this sample mkv.
NestedOrderedChapters.zip

This structure is used:

chapter 1 00:00:50.000000000 - 00:01:00.000000000
chapter 1.1 00:00:00.000000000 - 00:00:02.000000000
chapter 1.2 00:00:02.000000000 - 00:00:05.000000000

The total video duration is 1min. The first top-level chapter should play now only the last 10 sec of this video.
The nested chapters should now show two chapters as markers in the timeline. The first at 0sec and the second at 5 sec.

MPC-HC shows negativ times for the nested chaters and in the timeline is no marker. -> I'm not happy with this behavoir
But VLC shows them correctly -> but it plays the content not correctly, the video starts not at 50 sec.

Note: currently is the end time of the nested chapters ignored. only the start time is used for a marker in the time line.

Ordered chapters are always independent, also if they are nested chapters. -> That is what I prefer and wish.

@robUx4
Copy link
Contributor

robUx4 commented Apr 5, 2021

This is in line with how nested chapters were intended to work and heavily used in DMX. The content of a nested chapter MUST be within its parent chapter. In you example the ordered chapter starts at 50s and ends at 1 minute. Your nested chapters are incorrect.

@hubblec4
Copy link
Contributor Author

hubblec4 commented Apr 5, 2021

The content of a nested chapter MUST be within its parent chapter.

Yes for non-ordered chapters is this OK.

All non-ordered chapters MUST be sequentially from the lowest to the highest,
but this rule is ignored when the chapters are ordered,
and the same thing should be applied for nested chapters.

At the moment I speak only from nested-ordered chapters, but I have also in mind nested-ordered-linked chapters
which plays within a nested construct, content from another file. And in this case is the content not part of the parent chapter.

The nesting of ordered chapters is very useful to combine content for a better presentation.

@robUx4
Copy link
Contributor

robUx4 commented Apr 5, 2021

Again, this is not how it was designed, nor how it works as your experiment shows. And I still have no idea how what you describe could even work nor what it has to do with "preservation".

Nested chapters are sub chapter of their parent chapter. They MUST be contained inside their parent. Ordered or not ordered, this makes zero difference.

@hubblec4
Copy link
Contributor Author

hubblec4 commented Apr 5, 2021

"preservation"

was the wrong word...I have changed it to presentation

Yeah, I know/could imagine it makes not sense at the moment for others, but for me makes it sense.

and yes I am aware that this function will probably not be built in.

They MUST be contained inside their parent.

Why MUST?

@hubblec4
Copy link
Contributor Author

hubblec4 commented Apr 5, 2021

sample of nested chapter

chapter 1 00:00:50.000000000 - 00:01:00.000000000
chapter 1.1 00:00:50.000000000 - 00:00:52.000000000

The new virtual timeline is created from chapter 1 -> the duration is now 10sec
and a nested chapter with a start time of 50sec should be shown....but this makes for me no sense.
The video duration is smaller then the chapter mark.

@robUx4
Copy link
Contributor

robUx4 commented Apr 5, 2021

There is no "virtual timeline" with non-ordered chapters. So you are talking about ordered chapters.

I think you don't understand how ordered chapters work. The start/end time is used like this:

If an Edition of Ordered Chapters is enabled, then the Matroska Player MUST
play those Chapters in their stored order from the timestamp marked in the
ChapterTimeStart Element to the timestamp marked in to ChapterTimeEnd Element.

If you have one (top level) chapter the duration to play is the duration of that chapter. In this case 10 seconds, even though the Segment might contain 12 hours of content. The Segment duration and the ordered edition duration are completely different things. By repeating the source content multiple time an ordered edition might even be longer than the Segment duration.

And in your example (sample) you don't explain what to do with the nested chapter.

@hubblec4
Copy link
Contributor Author

hubblec4 commented Apr 5, 2021

There is no "virtual timeline" with non-ordered chapters. So you are talking about ordered chapters.

Yes I know.

I think you don't understand how ordered chapters work. The start/end time is used like this:

Mmmh... that makes me a bit sad that you think this really.

My chapterEditor has multiple editors on board which deals with ordered chapters.

In the Matroska chapter editor is an automatic to generate ordered chapters.
There is a Multi-mkv editor which generate multiple ordered editions from an mkv which uses non-ordered chapters.
There is also a simple Matroska-Menu editor in 2 variants which generates multiple ordered editions.
And there is a Disc2mkv editor which can handle seamless branching discs (BD + DVD) which also uses ordered chapters.
And interally there is an algo which generates non-ordered editions from ordered editions.

I have never seen an other tool what handles ordered chapters in so many ways.

If an Edition of Ordered Chapters is enabled, then the Matroska Player MUST
play those Chapters in their stored order from the timestamp marked in the
ChapterTimeStart Element to the timestamp marked in to ChapterTimeEnd Element.

Yes... And where is the restriction that a nested ordered chapters not handled like a top-level ordered chapter?
A nested ordered chapter has also a start and ent time, but the duration of such a chapter is not used. Only the start time is used.

If you have one (top level) chapter the duration to play is the duration of that chapter. In this case 10 seconds,

Exactly: the new virtual duration is 10 seconds. But the nested chapter has a start time of 50 seconds.

The Segment duration and the ordered edition duration are completely different things. By repeating the source content multiple time an ordered edition might even be longer than the Segment duration.

Yes, also known to me.
In chapterEditor's Matroska-Menu editor is a function to repeat an ordered edition multiple times.
This function simulates the duration of a disc menu. Often you found on Blu-rays a menu-mpls which has a lot of entries of m2ts files which are used for playback. Mostly there are two m2ts files used and the second one is repeated very very often.
The m2ts files it self has a small duration, mostly 1 minute, but the duration of the disc menu is often more then 6 hours.

If you mux such mpls file in MKVToolNix (or other tools which handles mpls files) you get a hugh mkv, because the second m2ts file is very very often appended.

And in your example (sample) you don't explain what to do with the nested chapter.

My samples here looks not really good, but this a maybe a thing of MarkDown -> sorry I'm not a profi in MarkDown.

@robUx4
Copy link
Contributor

robUx4 commented Apr 6, 2021

My chapterEditor has multiple editors on board which deals with ordered chapters.

In the Matroska chapter editor is an automatic to generate ordered chapters.
There is a Multi-mkv editor which generate multiple ordered editions from an mkv which uses non-ordered chapters.
There is also a simple Matroska-Menu editor in 2 variants which generates multiple ordered editions.
And there is a Disc2mkv editor which can handle seamless branching discs (BD + DVD) which also uses ordered chapters.
And interally there is an algo which generates non-ordered editions from ordered editions.

I have never seen an other tool what handles ordered chapters in so many ways.

That's not a guarantee it produces correct output. The discussion we're having proves the spec are not precise enough in what is correct and what is not. So you can't say your code is correct or not.

If an Edition of Ordered Chapters is enabled, then the Matroska Player MUST
play those Chapters in their stored order from the timestamp marked in the
ChapterTimeStart Element to the timestamp marked in to ChapterTimeEnd Element.

Yes... And where is the restriction that a nested ordered chapters not handled like a top-level ordered chapter?

And where is the explanation of how that could even work ? I can't think of any and you didn't provide one.

And I never said nested chapters must not be handled like top-level ordered chapters. In fact I said the exact opposite. "They MUST be contained inside their parent" also implies that the nested chapters are picking the parts to play in the Segment just like their parent. And in fact the parent may not even be interpreted at all, since the children MUST describe the same parts to play as their parent. This is how it's handled in VLC.
These are unwritten rules that we must write in the chapter section (the goal of this issue). But this is how it was designed and coded since the begining.

A nested ordered chapter has also a start and ent time, but the duration of such a chapter is not used. Only the start time is used.

That's news to me and doesn't follow any spec we have defined so far. You made up these rules. This is in total contradiction with what DMX outputs and how the ordered chapters in VLC works, which was designed specifically to support the DMX output.

If you have one (top level) chapter the duration to play is the duration of that chapter. In this case 10 seconds,

Exactly: the new virtual duration is 10 seconds. But the nested chapter has a start time of 50 seconds.

You have to be more specific than that. Do you expect the player will pretend it starts at 50s instead of 0s ? Or that it starts at 50s in the file but the showing 0s at that time during playback. The latter is the correct way.

And in your example (sample) you don't explain what to do with the nested chapter.

My samples here looks not really good, but this a maybe a thing of MarkDown -> sorry I'm not a profi in MarkDown.

It's not a markdown issue. You do not explain what you want to do with the second line of your example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarifications spec_main Main Matroska spec document target
Projects
Development

Successfully merging a pull request may close this issue.

2 participants