I’m creating a script that automatically collects metadata such as display size, resolution, bit rate, etc… from MediaInfo and automatically puts the info that mkvpropedit doesn’t have a parameter for, such as the bit rate of the audio/video stream, into an XML file according to the Matroska tagging standards.
They can be found here:
My issue with this process is that I want the information about audio/video bit rate to be in separate XML files, and to be added to the respective track. I thought that simply using the command as specified in the documentation would be the right way about it, however, when I check the results, it seems that mkvpropedit has just placed it in the header/general section, and whatever info was written last, is what is retained.
This is an example of info being written to the general header.
This how I’m using the command:
mkvpropedit --tags track:v1:
of course I change v to a when I want to add to the audio track.
You’re using the correct option. Matroska has the concept of “tag targets”, meaning each set of tags also contains a control structure that tells a reader what the tags apply to. Those structures are called “tag targets”. For example, such a target can be a track, or an attachment or the whole file.
mkvpropedit only has one option for dealing with tags,
--tags. It’s argument determines which set of tags
mkvpropedit operates on. In your example
track:v1:<filename> would read tags from
<filename> & add the appropriate “tag target” elements to make the tags refer to the first video track. Using
global:<filename> would not add those “tag target” elements & let the tags apply to the whole file instead.
You should make sure that the tags you’ve added are linked to the track properly. For that extract the whole set of tags with
mkvpropedit yourfile.mkv tags <filename>.xml & open the XML file in your editor of choice. Look for elements such as this one:
<Targets> element with its
<TrackUID> children are what links tags to a track.
Another thing to keep in mind is that
mkvmerge automatically creates & writes track statistics tags.
Last, it’s always possible that the program you use for reading tags is buggy or simply doesn’t act the way you expect it to.
Hi, thanks for the reply!
I wasn’t aware that I had to include the “Targets” field in the XML file, as I thought that it would be automatically resolved when you specified which track you wanted to edit. I’m glad you brought that to my attention though, as it now behaves as I expected!
About mkvmerge’s capabilities to automatically do track statistic tags, I think that would be more convenient. However, I aim to edit existing matroska files without modifying them in any other way.
Thanks again for the reply, it was really helpful.
If you use the selector
mkvpropedit will add the
<Target> elements itself. If you use
--tags global:…, it won’t — and you can do it yourself.
--tags track:…:… is just a convenience for the user so they don’t have to figure out the right content for
That being said, I really have no idea why your program would not show tags on the track when using