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

Add an option to link subtitle tracks to audio tracks #717

Open
ehsope opened this issue Jan 6, 2023 · 35 comments · May be fixed by #746
Open

Add an option to link subtitle tracks to audio tracks #717

ehsope opened this issue Jan 6, 2023 · 35 comments · May be fixed by #746

Comments

@ehsope
Copy link

ehsope commented Jan 6, 2023

This would be very useful for commentary tracks, so that if you select a commentary track for a movie, the subtitles for that track are also automatically selected.

@robUx4
Copy link
Contributor

robUx4 commented Jan 8, 2023

There is a FlagCommentary that can be set on any type of tracks, including the subtitle ones. So from the format point of view we have what is necessary. Then it's up to players to handle the mix properly.

@robUx4 robUx4 added enhancement spec_main Main Matroska spec document target discussion labels Jan 8, 2023
@hubblec4
Copy link
Contributor

hubblec4 commented Jan 8, 2023

There is a FlagCommentary that can be set on any type of tracks, including the subtitle ones. So from the format point of view we have what is necessary.

The FlagCommentary element alone is not enough for Players to generate a Link-System.
Mostly there are more than one subtitle and audio commentary.
And a Player developer is not able to know how the tracks have to be linked.

And every player could handle such a Link-system different.

Then it's up to players to handle the mix properly.

It makes in my eyes totally sense, that Matroska provides such a Link-system.

The good is, Haali has such a Link-system in his Splitter and it works great and is a pleasure to use it.
(unfortunately is the Haali Splitter to old and out of support)

The TRACKSETEX can be easy created and edit with an older version of chapterEditor.

This Haali TRACKSETEX system takes also the video track and an Edition into account.
It is used with the Matroska Tags but this is not optimal.

I have two ways in my mind:

  1. Take over the Haali TRACKSETEX syntax

Tracks
+TrackSets
++TrackSet -> multiple -> with the Haali TRACKSETEX syntax

  1. use new Matroska elements for each value of the Haali TRACKSETEX syntax

Tracks
+TrackSets
++TrackSet -> multiple
+++TrackSetDisplay
++++TrackSetName
++++TrackSetLanguageBCP47 -> multiple
+++TrackSetVideoUID
+++TrackSetAudioUID
+++TrackSetSubtitleUID
+++TrackSetEditionUID

For all ...UID elements there can also be an alternate element which uses the track number (or also possible the track ID).
TrackSetVideoNum instead of TrackSetVideoUID
If both elements are present than wins the ...UID element.

@robUx4
Copy link
Contributor

robUx4 commented Feb 25, 2023

I don't think hardcoding groups of tracks is a good thing. One user may want the commentary in one language and subtitles in another. It is a user (and therefore a player) preference. Not something that should be hardcoded in the file. It should match the commentary and subtitle tracks with the preferred language (+combination) of the user. All it takes is the commentary and the language info of the track.

And when linking segments, when you switch to the another segment, you pick the track with the same rule, it will work even if the segment is remuxed/transcoded/reordered/etc.

@hubblec4
Copy link
Contributor

I agree with you that a player should offer such preferences to the user.
This is simple for the user and needs only this new "flags".

But on the other hand,
what is, if there are more than one commentary subtitle track with the same language are present?
How should the algorithm know which track the user wants?

Hardcoding groups of tracks is not a MUST for a player.
It is like the chapters. Chapters are hardcoded, but a very very simple player without the ability to handle chapters, will play the file. A simple player maybe offers in the preferences to set a chapter intervall, which will be used instead of the hardcoded chapters.

With the players preferences, only one combination of tracks can be set.
But with hardcoding groups of tracks it is possible to set more combinations.

And when linking segments, when you switch to the another segment, you pick the track with the same rule, it will work even if the segment is remuxed/transcoded/reordered/etc.

I think there is no restriction when hardcoding groups of tracks is used.

Both systems, player preferences and hardcoding, are fine.
Both have advantages and disadvantages,

@ehsope
Copy link
Author

ehsope commented Feb 28, 2023

The Commentary flag works fine if you have a single commentary track, but some movies have more, for example LOTR has 3 audio commentary tracks. Being able to link the correct subtitles for these tracks would be very nice.

@hubblec4
Copy link
Contributor

hubblec4 commented Mar 2, 2023

Very good example @magistingen.

On Terminator 2 Blu-ray there are also multiple Audio commentary tracks and a lot of Subtitle commentary tracks.

With Haali's TRACKSETEX it was easy to combine the correct tracks together.

@hubblec4
Copy link
Contributor

@eddilara yes that's also possible with the Haali TRACKSETEX and with my suggestion for the new elements to group tracks.

@hubblec4
Copy link
Contributor

another thing to add to this is multiple video tracks
so that someone could have all the outtakes and bloopers in 1 mkv file instead of 10

Many thanks for this inspiration. I have thought about it and it is fantastic and the best, it works :-)

I like to have a simple menu within the player, and Matroska seems to be the best way.
A Blu-ray or DVD menu is to much and not my intension.

Until now I was sure I have to preserve extra stuff from discs (Blu-ray, DVD) in separated files, because the video streams uses different codecs.
Then it is only possible to link such files via the Matroska Soft-Linking feature, which is only supported in VLC but don't work.
Matroska Hard- and Medium-Linking can not be used, because the same codes and order of the streams are required.

But storing everything in one file offers new possibilities.

I have made for this a test with my favorite Test-Blu-ray: Terminator 2 (T2).
This disc has versatile features on board like Seamless-Branching, many codecs and so on.

Creating a multi-Edition.mkv of all three movie versions and with outtakes and other content is no big deal.
I have used MKVToolNix to mux a final mkv and played it in MPC-HC.
Changing streams works like expected but you have to change all three stream types(video, audio, subs) separately.

I'm very impressed, because there is no longer a Matroska Linking feature required to link files, because there is only one file with all the content and the player handles all the streams. Perfect.

and you could link the audio and subs to that video track so the player would automatically flip the audio and subs if you change the video track

My test file has also different Editions with the chapters of each extra stuff and the main movies.
I have also to change the Edition to get the correct chapters.

Additionally, to build multi-Edition-mkv's you MUST use ordered chapters.
After changing the video stream from the main movie at playtime 2 hours to an outtake with a playtime of 3 minutes, I get a black screen. Logically because for these timestamp no data present.
After changing the Edition all works.

Grouping of video, audio and subtitles is NOT enough. Also the Editions have to be taken into account.

Hey Steve, I count 4 users who like this new Matroska feature, could you imagine to change your opinion?

@ehsope
Copy link
Author

ehsope commented Mar 18, 2023

Multiple editions of a film this way seems a bit inefficient tho. On BluRays they can link multiple files to have all 3 editions of Apocalypse Now come on one 100GB disc, but those 3 editions take up like 250GB in MKVs due to all the duplicated scenes. I assume implementing something like that into MKV would be out of the question but it sure would be neat.

@robUx4
Copy link
Contributor

robUx4 commented Mar 18, 2023

so that someone could have all the outtakes and bloopers in 1 mkv file instead of 10

Interleaving unrelated content for the sake of having one file seems wrong. Multiple video tracks should be used for content that happens at the same time. If you want something happening at a different time, use different segments (in the same file if you want) or Ordered Editions that plays only a part of the file (beginning = actual movie, end of file = bloopers).

I assume implementing something like that into MKV would be out of the question but it sure would be neat.

That sounds like Ordered Editions is exactly what you need.

@robUx4
Copy link
Contributor

robUx4 commented Mar 18, 2023

Hey Steve, I count 4 users who like this new Matroska feature, could you imagine to change your opinion?

I do agree there's something needed here. The problem is to find the correct solution. We could add some element to tell a subtitle track corresponds to a given audio track. If we don't restrict it to subtitles that mean you can tell an audio track corresponds to a video track. But that means you can also do it the other way around, you can tell a video track corresponds to an audio track. But then you need to be able to tell all the audio tracks that correspond to that video track. So we would need a list of tracks for that.

As you can see it can become complicated quickly. What if a video track tells it corresponds to an audio track and that audio track tells it corresponds to another video track ? A player needs to know what rule to apply with certainty. The problem is not to add an element to link one track with another or one track with multiple tracks, but the proper rules to use with it.

I think we need a list. In a multi angle video, each audio track would correspond to all the video tracks.

In the absence of this list, each track is considered to correspond to all the other tracks (current situation).

@ehsope
Copy link
Author

ehsope commented Mar 18, 2023

Had no idea Ordered Editions was a thing in MKV and it does indeed sound like exactly what I want. However it seems support for it isn't all that common, I tried to search it up but there are few relevant results. Where can I read more about how to use it?

As for the linking, although rare, I can think of scenarios where different video tracks would have their own audio track, so it should be possible to link audio to video tracks. A list seems like the best idea, I would use Link1, Link2 etc though there may be a better way. I would also like the ability to link multiple subtitle tracks to an audio track. This would be useful with my copy of Sleeping Beauty, which features still photographs in a separate subtitle track that's supposed to play alongside the commentary track, and should ideally have its own tag to tell the player that it isn't subtitles.

@hubblec4
Copy link
Contributor

hubblec4 commented Mar 18, 2023

Multiple editions of a film this way seems a bit inefficient tho. On BluRays they can link multiple files to have all 3 editions of Apocalypse Now come on one 100GB disc, but those 3 editions take up like 250GB in MKVs due to all the duplicated scenes. I assume implementing something like that into MKV would be out of the question but it sure would be neat.

You are a fully wrong. :)
Matroska can store the same content of a multiple edition movie from Blu-ray to mkv WITHOUT doubling the content. My chapterEditor ist the only tool currently what does exactly this. With ordered chapters it is an easy task.

Had no idea Ordered Editions was a thing in MKV and it does indeed sound like exactly what I want. However it seems support for it isn't all that common, I tried to search it up but there are few relevant results. Where can I read more about how to use it?

My Matroska-Playback repo is a good point to start.

@hubblec4
Copy link
Contributor

hubblec4 commented Mar 18, 2023

The problem is to find the correct solution. We could add some element to tell a subtitle track corresponds to a given audio track. If we don't restrict it to subtitles that mean you can tell an audio track corresponds to a video track. But that means you can also do it the other way around, you can tell a video track corresponds to an audio track. But then you need to be able to tell all the audio tracks that correspond to that video track. So we would need a list of tracks for that.

As you can see it can become complicated quickly.

To complicated like you think would I say.

We don't need a linking system for the tracks, all what we need is a grouping of tracks and the Edition together so that a player change all this in one go.

I'm very sure you have never tried Haalis TRACKSETEX and you don't know from what I speech. How simple it works, how simple to create it and how wonderful it is to use.

A group of tracks which have to set by the player when the user activate such a group thats all what we need.

Linking between tracks is not the right way in my opinion.

@robUx4
Copy link
Contributor

robUx4 commented Mar 19, 2023

As I'm working on a player on my dayjob (VLC) I do care a lot about not making specs too complicate that people won't bother with some features of Matroska. So it's important to do this right.

It seems the consensus is to use a group of tracks that should go together. It's probably cleaner than having one track declare its dependency or one track declare its "children".

IMO it's still opening a can of worms on the player side. For example if you select a subtitle track, should it switch to the corresponding audio (commentary) track as well ? (SHOULD as in a normative should, and even possibly a MUST). Also the presentation of this group is not a common thing in players. It doesn't exist in VLC, so a whole UI has to be built around that.

Groups should have a name that people can recognize (main, directory commentary, actor commentary, etc). That could be an ID (type of group) that the player translates to its UI. But tags with different translations are probably better. Or maybe in addition to the ID so the author can refine the text. That means we need a TagGroupTargetUID as well.

@hubblec4
Copy link
Contributor

hubblec4 commented Mar 19, 2023

As I'm working on a player on my dayjob (VLC) I do care a lot about not making specs too complicate that people won't bother with some features of Matroska. So it's important to do this right.

Many thanks from me for all your work on VLC it will be the best chance to have a good working Matroska player on Linux in future.

It seems the consensus is to use a group of tracks that should go together. It's probably cleaner than having one track declare its dependency or one track declare its "children".

Yes, grouping of tracks AND the Edition will be a simple and powerful solution. Please don't forget the Edition, it is not a track but it belongs to these grouping system, like Haali TRACKSETEX it does.

IMO it's still opening a can of worms on the player side.
For example if you select a subtitle track, should it switch to the corresponding audio (commentary) track as well ? (SHOULD as in a normative should, and even possibly a MUST).

IMO definitive no. The stream selection should still work independent of the new "track-grouping" feature.
When a user change a stream then it is the choice of the user.
The "track-grouping" feature does in principle exactly the same thing, tracks/Edition are changed, but at once.

Also the presentation of this group is not a common thing in players. It doesn't exist in VLC, so a whole UI has to be built around that.

Yes, no player has currently a support for this new feature and no player has taken over the Haali TRACKSETEX feature.
On the other hand every player who can use the Haali Splitter has then the "track-grouping" feature.

I'm very sure the UI is not so much work and simple to implement.
Haali Splitter popup menu

Haali uses the existing popup menu from system TrayIcon and added on top the Track Sets if some found in the Matroska Tags.
VLC has also popup menus in the main menu where it can be simple added.

Groups should have a name that people can recognize (main, directory commentary, actor commentary, etc). That could be an ID (type of group) that the player translates to its UI. But tags with different translations are probably better. Or maybe in addition to the ID so the author can refine the text. That means we need a TagGroupTargetUID as well.

Yes a name for a group is important and also supported by Haali(and support for a language code).
But we should keep this also so simple as possible like Haali.
Only a GroupDisplay should be used like the new EditionDisplay. Tagging such Groups is IMO to much.
A Display has a name and multiple languages. That's all what we need to find a group in the UI.

To restrict or combine a group name with IDs makes the things again complicated and IMO not necessary.

Here a link to Haali TRACKSETEX feature. I hope you have time to read.

I had above posted a possible element structure for this new feature. I will add some descriptions.
I use TrackSet as name for the elements but this can be changed if we have found a good name for this new feature.

Tracks
+TrackSets -> master, minOccur=0, maxOccur=1
++TrackSet -> master, minOccur=1
+++TrackSetDisplay -> master, minOccur=0, maxOccur=1 (I don't know if we need really more than one Display)
++++TrackSetName -> UTF8, minOccur=1, maxOccur=1, can be empty, a player can set a default name
++++TrackSetLanguageBCP47 -> String, minOccur=0
+++TrackSetVideoUID -> UInteger, minOccur=0, maxOccur=1 default=0(don't change the video track, same if absent)
+++TrackSetAudioUID -> UInteger, minOccur=0, maxOccur=1 default=0(don't change the audio track, same if absent)
+++TrackSetSubtitleUID -> UInteger, minOccur=0, maxOccur=1 default=0(don't change the subs track, same if absent)
+++TrackSetEditionUID -> UInteger, minOccur=0, maxOccur=1 default=0(don't change the Edition, same if absent)

What do think about this element structure?

@ehsope
Copy link
Author

ehsope commented Mar 20, 2023

For example if you select a subtitle track, should it switch to the corresponding audio (commentary) track as well ?

Imo, the link hierarchy should be video > audio > subtitles. Selecting a higher track should automatically select the lower tracks, but not vice versa.

It should ideally also only select subtitles if the user wants subtitles, and in the correct language if available. In Plex, the user can configure language preferences so it should be relatively simple. In VLC, it could be done by detecting which subtitle language is already selected, and switching to the corresponding subtitle track for the commentary. If there is no corresponding track, default to whatever's there. For example, the user has French subs enabled, but the commentary only has English subs, so selecting the commentary audio automatically enables the English commentary subtitles.

One way you could do the UI is by only showing the subtitles linked to the current audio track, so when you select Commentary 2 audio, and go to enable subtitles, only Commentary 2 subtitles are available. That way you don't need unique flag names and can just go by whatever the higher track is named.

@robUx4
Copy link
Contributor

robUx4 commented Mar 25, 2023

One way you could do the UI is by only showing the subtitles linked to the current audio track, so when you select Commentary 2 audio, and go to enable subtitles, only Commentary 2 subtitles are available. That way you don't need unique flag names and can just go by whatever the higher track is named.

Actually I think watching a movie with the commentary (just) as subtitles could be interresting. Or the other way around, listening to the commentary but having the original dialogs shown at the same time can be nice.

In general the format should not block people from using things the way they want. It is however necessary to "group" tracks for when people want the automatic feature, that information can't be guessed by the player.

@robUx4
Copy link
Contributor

robUx4 commented Mar 25, 2023

What do think about this element structure?

This is a good first step. I would not put a string there, for the same reason we don't have a track name. Adding translations means updating the beginning of the file when tags are usually at the end. But that means we need an ID (track group ID or UUID) so it can be addressed in tags.

I don't think the Chapter Edition should be in there either for the reason I already gave:

Interleaving unrelated content for the sake of having one file seems wrong.

Tracks and editions should be completly separated. If you need unrelated content in the same Segment then reuse the same track groups, or don't use the same Segment at all if you can't. Otherwise it becomes close to implement this spec in any player.

@hubblec4
Copy link
Contributor

hubblec4 commented Mar 26, 2023

I would not put a string there, for the same reason we don't have a track name.

I'm a bit confused. We have no track names??? YES we have track names.

Adding translations means updating the beginning of the file when tags are usually at the end. But that means we need an ID (track group ID or UUID) so it can be addressed in tags.

What do mean with "translations"?
I warn to use Tags to set a name for the Track-Groups.
It is the same waste like tagging Editions. (The new EditionDisplay is perfect and total enough.)

Tracks and editions should be completly separated. If you need unrelated content in the same Segment then reuse the same track groups, or don't use the same Segment at all if you can't.

Oh Steve....why? :-)

I'm now sure you have no experience (or to less) with Multi-Angle Blu-ray discs.
When I make an mkv from such disc and preserve all Angles, I must use ordered chapters and an Edition for each Angle.
When I change from the English Angle to the German Angle I have to change Audio, Subs AND the Edition!!

And Haali TRACKSETEX uses also the Edition and I don't know why we not simple copy his work.
All is defined, all is working, all what we have to do is to copy this wonderful system to Matroska using elements instead of a Tag-String.

@hubblec4
Copy link
Contributor

Interleaving unrelated content for the sake of having one file seems wrong.

For me it seems it is a feature, not a restriction or a thing what have to be restricted.
To preserve an entire Blu-ray in one MKV file, is a feature what only Matroska can do.

MPC-HC plays fine such files and I'm sure VLC too(I have not tested).

@robUx4
Copy link
Contributor

robUx4 commented Mar 27, 2023

I'm a bit confused. We have no track names??? YES we have track names.

Yes, my bad, I forgot about it (and didn't look properly). Still IMO it's not very useful in modern Matroska as we have flags telling what kind of track it is (for example commentary). A player will do a better job of having all the translations it needs for this kind of tracks, and even some fancy icons.

IMO we should not use a single language name, nor hundreds of languages for the track group feature. If you really want that you can use tags. On the other hand we probably want group types (like commentary flags). Maybe we just need a new track type that would reference other tracks in a Child element (like we have for audio and video elements). Then we can reuse all the existing features of tracks (including the legacy name and tagging).

@robUx4
Copy link
Contributor

robUx4 commented Mar 27, 2023

I'm now sure you have no experience (or to less) with Multi-Angle Blu-ray discs.

No but that sounds like content that should be played within the same timeline, so it totally falls into one Segment category.
I'm 99% sure Blu-Rays don't allow unrelated content to be playable at the same time, because they have constraints on the reading speed of the disc. Having to skip (or discard) large chunks of unrelated data during every playback is inefficient and may not work with all hardware. This is also one reason it should not be done in Matroska.

@robUx4
Copy link
Contributor

robUx4 commented Mar 27, 2023

And Haali TRACKSETEX uses also the Edition and I don't know why we not simple copy his work.

We will never use tags for playback features.

@hubblec4
Copy link
Contributor

No but that sounds like content that should be played within the same timeline, so it totally falls into one Segment category.

Yes and the conclusion is, you have to switch the Edition if you want watch another Angle.
So we need the Edition in the Track-Group system also. Without changing an Edition you don't change the Angle.

@hubblec4
Copy link
Contributor

hubblec4 commented Mar 27, 2023

I'm 99% sure Blu-Rays don't allow unrelated content to be playable at the same time,

I would say you are wrong. For a m2ts playlist it is not a problem to use content of other files.
M2ts allows also to combine content which have different codecs and different streams and not the same order.

We will never use tags for playback features.

Of course and I don't want use Tags, I want to make a copy of his work with new Elements.

@hubblec4
Copy link
Contributor

hubblec4 commented Mar 27, 2023

we should not use a single language name, nor hundreds of languages for the track group feature. If you really want that you can use tags.

OK than we should not use a Display for Editions for should tag them. the same for Chapter or Track names, it would be better to tag this in future.... (ironic)

On the other hand we probably want group types (like commentary flags)

Oh...now it would be crazy :-)
At the beginning of this discussion you don't want use a "Group of Tracks", a Linking was preferred.
Now we need a simple name for a Track-Group and you want insert types and IDs, for what?
Sounds for me to much unnecessary things.

It seems you need a presentation of Haalis TRACKSETEX, should I prepare something for the Matroska Meeting?

@robUx4
Copy link
Contributor

robUx4 commented Mar 28, 2023

It seems you need a presentation of Haalis TRACKSETEX, should I prepare something for the Matroska Meeting?

No need, you already presented it here at length. It's not rocket science to make a list of tracks. The "problem" is just to put it in a nice place. And I think a track type is the most adequate choice I've seen so far. It would be similar to the "program" list in TS streams. And it would likely be implemented using the same feature in VLC.

If you look at the TS example, it's used in DVB to select channels (which comes with their group of audio and caption tracks). This is one case were a bitstream of multiple unrelated audio/video content are interleaved at the same time. And a track for grouping them means we could remux such TS streams to Matroska more accurately.

Having a group separate from the usual track would work too. But we lose features available to tracks like FlagCommentary, FlagOriginal. That's the only 2 I could find. On the other hand a lot of things found in TrackEntry would make no sense for a track group, for example the mandatory track language (it includes multiples languages) or the codec ID.

So in the end I think it can't be another kind of track. The TrackSets you proposed is close to what we need. I think we would need a "group type" in addition to tell what kind of group it is, like the main group, commentary group, or TV channels (if coming from DVB).

@robUx4 robUx4 linked a pull request Mar 28, 2023 that will close this issue
6 tasks
@hubblec4
Copy link
Contributor

I don't think the Chapter Edition should be in there either for the reason I already gave:

Interleaving unrelated content for the sake of having one file seems wrong.

Tracks and editions should be completly separated.

Ahhh ha, very interesting and why have you implemented for a long time the TrackTranslateEditionUID ?

We should to remove this immediately. :-)
Intermixing Tracks and Chapters.....oh no what a dirty thing :-)

@robUx4
Copy link
Contributor

robUx4 commented Apr 1, 2023

Ahhh ha, very interesting
We should to remove this immediately. :-)
Intermixing Tracks and Chapters.....oh no what a dirty thing :-)

You can keep your sarcasm to yourself. We have a code of conduct that doesn't accept that.

why have you implemented for a long time the TrackTranslateEditionUID ?

The TrackTranslate feature allows addressing tracks from Chapter Codecs in a safe way from remuxing. Chapter Codecs can theoretically select tracks. For example DvdMenuXtractor can generate that from a DVD. This is for the chapter codec to address Matroska tracks (which is a foreign concept to a DVD), not the other way around.

Adding a TrackSetEditionUID would mean when you select a TrackSet, only an edition should be usable (I suppose that's the idea). That means if you remove chapters, you don't know what you're supposed to play anymore. This is not the case with TrackTranslateEditionUID which would just be ignored in the absence of Chapter Codecs (95% of players).

I looked at your example. I don't know how Haali's (closed source) code works, but it shows 2 editions. The TrackSet and Edition can potentially be contradictory, if you select Edition 1 and a TrackSet that uses Edition 2. Which one has priority ? If you select an Edition while you were using a TrackSet using a different Edition, which TrackSet is it going to use ? Or is Edition selection disabled when TrackSets have editions ? IMO this is the wrong way to do it, they should be completely separated. I can't think a real world example where you would want some video has a specifc set of audio/subtitle tracks not available to the other editions. That just means the video content is not related to the other parts of the video and should be in a separate Segment.

Also if you have 20 editions, are you going to list all the TrackSets for each of the 20 editions ? And again, who has priority between TrackSet selection and Edition selection ? IMO this is way too complicated for some use case that doesn't exist in the real world.

@hubblec4
Copy link
Contributor

hubblec4 commented Apr 5, 2023

Adding a TrackSetEditionUID would mean when you select a TrackSet, only an edition should be usable (I suppose that's the idea).

No. To set only an Edition without streams makes no sense, but it is possible.
A single Edition can be changed directly via the "Edition menu" from the player (if the player supports Editions).

That means if you remove chapters, you don't know what you're supposed to play anymore. This is not the case with TrackTranslateEditionUID which would just be ignored in the absence of Chapter Codecs (95% of players).

When I set in Haalis TRACKSETEX an EditionUID and there is no Edition with this UID, simple nothing happens.

I looked at your example.

Cool, and thank you. And now maybe I understand you a bit better after I read all your questions.

The TrackSet and Edition can potentially be contradictory, if you select Edition 1 and a TrackSet that uses Edition 2. Which one has priority ? If you select an Edition while you were using a TrackSet using a different Edition, which TrackSet is it going to use ?

It feels a bit to me that you think in a wrong direction.
TRACKSETEX is only a "multiple-selection-and-set-in-one-go" feature, nothing more.
After selecting a TrackSet the TrackSet is not active or has a priority or is linked or combined or something else.
When you change an Edition or track you don't have to be watch which TrackSet it could be.

A TrackSet entry is not grouped like the Audio tracks or the Subtitle tracks.
In an Audio track list there is always one track active and this is shown by using Radio-Items with a black dot in front. But this is not used for the TrackSets feature. This is only a simple list with the names given from the TrackSetDisplay.

After selecting a TrackSet entry from a TrackSet list which is provided by a media-player, all the tracks/Edition will be set which are defined in these TrackSet entry.
A user is always at any time fully free to change the Audio or Subs or video or Edition when ever he want.
And the user can also change at any time, multiple tracks and the Edition in one go with a TrackSet entry.

There is one thing what the player has to do after a user has used a TrackSet:
The entries for Audio/Subs/Video(if more than one video track is present) needs the "Radio-group dot" in front, to show that the correct Audio/Subs track is active. But this is only a GUI "cosmetic" to move the "Radio-group dot" to the correct active track/Edition.

IMO this is the wrong way to do it, they should be completely separated. I can't think a real world example where you would want some video has a specifc set of audio/subtitle tracks not available to the other editions. That just means the video content is not related to the other parts of the video and should be in a separate Segment.

Again you are wrong here. Like I mentioned this is a normal and common case for Multi-Angle-Disc, Blu-ray and DVD.
I have a lot of such disc's preserved in an MKV.
The video content of such a movie has different parts where other languages are used in the video, for example captions of shops, or a newspaper or a letter.
There is no reason to separate this in different Segments/files, because all m2ts files have the same content of streams and codecs.

Lets say we have a Multi-Blu-ray disc with only 4 m2ts file and two Angles. The duration for all m2ts files are 60 seconds.
Angle 1 uses the following m2ts files: 00001, 00100, 00002 -> English version
Angle 2 uses the following m2ts files: 00001, 00200, 00002 -> German version
(This is a typical set for Angle-discs where the "Angle-part-m2ts" uses higher numbers.)

An MKV stores this 4 m2ts in this order: 00001, 00100, 00002, 00200.

With two Editions of ordered chapters it is now possible to play both Angles.
That's for me the greatest feature of Matroska. Ordered chapters now controls which content have to play.

Chapters
+Edition 1 - English
++Chapter 1 - m2ts 00001 -> Start: 0s - End 60s
++Chapter 2 - m2ts 00100 -> Start: 60s - End 120s
++Chapter 3 - m2ts 00002 -> Start: 120s - End 180s
+Edition 2 - German
++Chapter 1 - m2ts 00001 -> Start: 0s - End 60s
++Chapter 2 - m2ts 00200 -> Start: 180s - End 240s
++Chapter 3 - m2ts 00002 -> Start: 120s - End 180s

When I want to change the Angles I have currently to make 3 changes.
The first change is the Audio (from English to German), the second change is the Subtitle.
The third change is the Edition otherwise I still watch the wrong Angle.

The same is used by DVDs, I had updated my chapterEditor for a while, so that is also possible to preserve multi-Angle-DVDs.

I don't know how Haali's (closed source) code works, but it shows 2 editions.

Mmmh I see I had maked a small issue with naming of the TrackSets and this could be irritating.
"Edition1"/ "Edition 2" are only the names for the TrackSet entries and I forgot to rename it for better reflection of what content is played.
And yes "Edition 1" TrackSet uses Edition 1 of this mkv.

The example is not really good to show when it makes sense to change also the Edition with other streams together.

I also have no access to the source code but it is really a simple piece of code.
Haalis Splitter reads the Tags and scans the SimpleTags for the TRACKSETEX keyword.
All found TRACKSETEX entries are now simple listed. The list is not a Radio-Group or a Checkbox group, it is a simple list of names(5th parameter) from the TRACKSETEX entries.
When a user select a TrackSet from this list, the Edition and all tracks will be set and marked as active , that's all.
IMO an easy algorithm.
I'm sure in VLC there a methods to change tracks/Edition, and you could use this methods in a multiple way to change multiple things in one go.

Also if you have 20 editions, are you going to list all the TrackSets for each of the 20 editions ?

20 Editions are more or less not really used for normal mkv files, but ok, let's say we have a movie with 20 Angles.
Yes then it makes sense to set 20 TrackSet entries. For me feels it easier to select all what I want from one list/point in the player, instead of clicking in all the sub menus. Audio, Subs, Video and the Edition are always placed in it's on sub menus. To change a stream I have make minimal 2 clicks, a lot of mouse movements and this for all 3 stream types and the Edition.
With a TrackSet list I have all at one place.

And again, who has priority between TrackSet selection and Edition selection ?

Like I mentioned above a priority don't exists. Everything is independent of each other.
That's also a reason why I like this TrackSets feature so much.

IMO this is way too complicated for some use case that doesn't exist in the real world.

I think it is at this time too complicate because it is new to you. I had also need some time to understand what Haali has coded and for what I can use it. But after I get my first Multi-Angle Blu-ray I was interested how it works.
I have found only 2 web pages with info, but it was enough to re engineer how it works and I have coded a Halli TRACKSETEX editor in my chapterEditor, from now on it was very easy.
LAV-Splitter was born and Haali was ousted and LAV-Splitter has no support, this was the end of TRACKSETEX.


Ok and now I still have to mentioned that Matroska already has a TrackSet system, but it is misplaced and not good useable. In your PR you have used only a TrackUID element, and this is the same like ChapterTrack works.
It is possible to set ChapterTrackUID's which is the same like the TrackUID in the TrackSet.

This feature is also presented in my Matroska-Playback repo but no player supports these elements.
You can see that also the tracks and an Edition is now grouped.
The bad of this is the place, because it is now necessary to make for each TrackSet an Edition.
The Editions/chapters are identical except the list of ChapterTrackUID's.
And the second issue is that the track types are not separated.

@felisucoibi
Copy link

I thjnk is a very good idea for example a star warsa movie with 4 audiocomments of the director, the scy fi guy etc, and 12 subtitles, for some languages and for these audio tracks, is nice to know wich subtitle is for each sound track.

@hubblec4
Copy link
Contributor

hubblec4 commented Nov 3, 2023

Hi @eddilara @felisucoibi @ehsope

I have used the time to learn Lua and scripting for mpv.
And maybe is this for you a solution.
Creating.
Playback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

5 participants
@robUx4 @felisucoibi @hubblec4 @ehsope and others