TVEPISODE not working for MKV

In a similar way to TVSEASON, Mp3tag's TVEPISODE field is not working for MKV.

Mp3tag's TVEPISODE field should be really mapped to Matroska's PART_NUMBER T=50 tag for MKV files (rather than creating TVEPISODE T=30 tags as it currently does).

However, unlike the issue with TVSEASON, where there's no other way to create Matroska PART_NUMBER T=60 tags, there is a way to create PART_NUMBER T=50 tags for MKV files.

Currently, if you want an episode number to be created as per the Matroska specification; one that will appear in Windows File Explorer (mapped to System.Media.EpisodeNumber), then a workaround is to use Mp3tag's DISCNUMBER field.

Mp3tag's DISCNUMBER field creates MKV PART_NUMBER T=50 tags on the basis that target type value 50 corresponds to album level information for Matroska audio (MKA).

While it's handy that there is this DISCNUMBER workaround, it does mean some further consideration as to a proper fix for TV episode.

I think a distinction needs to be made between MKA and MKV, with Mp3tag's DISCNUMBER field continuing to create PART_NUMBER T=50 tags for MKA, but perhaps not for MKV.

For MKV, Mp3tag's TVEPISODE field should take over the role of creating PART_NUMBER T=50 tags.

A potential problem with this would be for anyone using the DISCNUMBER workaround who was unaware of any future TVEPISODE fix (if and when it got implemented).

Perhaps a solution to this would be to continue to allow PART_NUMBER T=50 tag update via DISCNUMBER field for MKV, but somehow prioritise any use of TVEPISODE field.

In any case, Mp3tag's DISCNUMBER field should not (as it currently does) display or amend values of any PART_NUMBER tags that aren't at TargetTypeValue=50 level.

According to the current Tag Field Mappings overview we currently have these 3 PART_NUMBERs with different TargetLevelType:

DISCNUMBER -> T=50 PART_NUMBER
MOVEMENT -> T=20 PART_NUMBER
TRACK -> T=30 PART_NUMBER

I've just released Mp3tag v3.28e, which adds a mapping of TVEPISODE to T=50 PART_NUMBER for MKV Matroska video files.

Please test this thoroughly. My impression is, that there are not that many people using Mp3tag with Matroska, so it's good to catch any potential issues early.

I could only find TVEPISODE and TVSHOW in the fields exclusive to mp4 section of the mappings documentation.
Are there more MP4-exclusive tags that are also mapped for Matroska files?

I'm playing with the idea of adding the option to write tags from linked .nfos to .mkv files via mkvpropedit in my script, but there are hardly any official mappings.
I'd like to avoid mapping things to fields that are mapped differently in Mp3tag, hence my question.

@RobertM you seem to have used Matroska tags for a while. Do you think these mappings would make sense for tv shows/movies?

TAG_MAPPING = {
    "country":("COUNTRY", 70), # doc states it's an organizational tag, so maybe no TargetTypeValue?
    "showtitle": ("TITLE", 70), # ought to be above season level in case "season title" is used as well
    "season": ("PART_NUMBER", 60),
    "episode": ("PART_NUMBER", 50),
    "title": ("TITLE", 50),
    "originaltitle": ("ORIGINALTITLE", 50), # not listed as official tag
    "edition": ("EDITION", 50), # EDITION or VERSION?, not listed as official tag
    "plot": ("SUMMARY", 50), # SUMMARY or DESCRIPTION?
    "director": ("DIRECTOR", 50),
    "studio": ("PRODUCTION_STUDIO", 50),
    "mpaa":("LAW_RATING", 50),
    "year": ("DATE_RELEASED", 50), # Kodi uses this instead of DATE_RECORDED
    "premiered": ("", 50), # unsure since DATE_RELEASED is taken by "year"
    "genre": ("GENRE", 50),
    "id": ("IMDB", 50),
    "tmdbid": ("TMDB", 50), # prefix with movie/ or tv/
    "source": ("ORIGINAL_MEDIA_TYPE", 50),
}

I'm also curious how you tag multi-episode files. Do you duplicate the tags structured via organizational tags or do you only save each tag type once and enter values for both/all episodes in that?

Do you think these mappings would make sense for tv shows/movies?

I don't know about .nfos, but generally, in terms of integration with Mp3tag, unless there's a specific exception made (like I requested for TVSEASON), tags for MKV files will get created at level T=50 (since Mp3tag v3.28e).

This means MKV files with COUNTRY T=70 and TITLE T=60 tags could not be maintained at that level with Mp3tag.
If you have TITLE levels above 50 for example, they'll just appear against Mp3tag's TITLE field in its tag editor, and get saved as T=50 level tags whenever you try to edit them.
Multiple occurrences of MKV TITLE tags at different levels (or the same level) will appear in Mp3tag's TITLE field separated by double backslashes (\\), but will all be saved at T=50 level once edited.

For your other listed mappings at level 50, you can map them any way you like of course. But generally, yes, if you can find a corresponding official tag name in the Matroska spec, then you'd be as well to use that.
Naturally, this doesn't mean we'd then expect them all to display universally, everywhere, all at once, in any application you can think of. Far from it.

My interest has been in seeing what MKV tags I can get to display in MS Windows environment (I'm currently still on Windows 10).

So, my answer to the question whether to use SUMMARY or DESCRIPTION tag for example, would be to prefer Description, as Description will display in Windows, and Summary won't.
However, Windows actually displays MKV DESCRIPTION tag as Comments and also displays MKV COMMENTS tag as Comments (Windows property: System.Comment).
If both DESCRIPTION and COMMENT tags exist then Windows seems to prefer whichever one it finds last.
Because of this unpredictable behaviour, and the fact that Mp3tag mappings lists COMMENT rather than DESCRIPTION, I tend to just use COMMENT.

Windows displays DATE_RELEASED, and doesn't display DATE_RECORDED tag, so I've tended to prefer DATE_RELEASED too.
VLC player media information reverses this approach and displays DATE_RECORED as its preferred date however.
And Mp3tag's YEAR field is mapped to DATE_RECORED.
As with anything, it depends on the application, so you could populate them both, which is what I've started doing.
I tend to put just the year (eg. 2025) in DATE_RECORDED, using Mp3tag's YEAR field, and the full date (eg. 2025-02-28) using DATE_RELEASED.

I populate TMDB with just the id number rather than prefixing it with movie/ or tv/ as I find that way it plugs in neatly to API calls when using Tag Sources (something I've just started getting into).

As for multi-tagging, no, I don't use structured organizational tags, I just put all information in one tag instance.
One ARTIST tag for example, with comma separated names of the movie's starring cast.
I know Matroska supports tag nesting, but Windows doesn't. For the MKV tags that it does display, Windows tends to display only the last one it finds.
And, though Mp3tag will write separate tags if separated with a double backslash (\\), it doesn't support fancy sub-tagging.
For example, Mp3tag won't create CHARACTER tags (name of the character an actor plays) as sub-tags of (real name) ACTOR tags.

Thanks for the detailed reply!

NFO files are the most common way to store metadata for video files.
Media centers/servers like Kodi, Jellyfin and others support reading/creating them.
Plex is a notable exception as it instead relies on its internal, proprietary database (but I think support for .nfos will eventually come to Plex too).

The neat thing about .nfos is that they're simple XML inside and thus you can mass edit them with scripts (or even do it manually in a text editor). The other upside is that they are the same for every type of video container (mkv/mp4/avi/flv/iso..), which is a huge advantage over tags that can vary from container to container.

That's understandable but unfortunate as for a tv show you often have the episode TITLE, season TITLE and tvshow TITLE at the same time (which is a prime use case for different TargetTypeValues).

I've searched the common media centers for documentation on which matroska tags they support. From what I found, they either outright do not support them, or the support is very limited.

I intend to turn my back on Windows when the W10 support ends.

What a mess.

For my use case, all the information is already present in XML format in the .nfos created by tinyMediaManager beside each video file so I think it would make more sense to follow the mkv documentation.

Hm, that would also be fairly dirty (especially for multi episodes).

I could probably recreate the .nfo xml structure with different (nested) mappings and then use mkvpropedit to import them as tags, but since they'd then be poorly recognised in Windows and only partially editable in Mp3tag that would probably be wasted time on my part since none of the media centers make use of them either.

Thanks anyhow, matroska tags were an interesting excursion for me.
Considering how complex and ambiguously documented they are, I'm not surprised that they're not widely used.

Yes, the fact that Windows just displays the last one it finds means you can't use the TITLE tag at different levels to distinguish between series and episode names.
At first I thought there'd be no way around this, but then I discovered that Windows interprets the SUBTITLE tag as Episode name, and that Mp3tag's SETSUBTITLE field creates MKV SUBTITLE tags at level 50.
So that's the way I do it, creating a TITLE T=50 tag for movie/series name, and a SUBTITLE T=50 tag for episode name.

Well spotted! I hadn't picked up on the fact that the Matroska specification says, for TMDB identifiers, "The variable length digits string MUST be prefixed with either “movie/” or “tv/”."
I think the numeric part of the identifier is unique in its own right. But, for the sake of being able to say I'm following the spec, I think I'll start storing them with the official prefix now.
I can strip the movie/ tv/ prefix off when it comes to using TMDB identifiers in Tag Source API calls.

There's one or two tricks, such as using the SUBTITLE tag for Episode name, that are quite useful in terms of Windows display, but apart from that I just try to keep it simple.
I'd rather use Mp3tag than write my own XML which tries to utilise MKV's fancy nesting and sub-tagging structure that not much else out there is capable of recognising.

This thread has drifted somewhat from the original post, but in terms of those seeking to use Mp3tag' s interactive functionality for directly tagging the video files themselves (rather than something else, such as tinyMediaManager - which isn't really tagging the files at all), I wouldn't say MKV files are much worse than any other video container (MP4 for example).