[Matroska-users] Requesting help with Matroska Tags

Steve Lhomme slhomme at matroska.org
Thu Sep 1 20:45:41 CEST 2011


Sorry for answering this tag thread (and some others) so late, I was
busy on various other things. And there's quite a bit of demand/work
on the tags.

On Sat, Aug 20, 2011 at 1:45 AM, Matthew Heaney
<matthewjheaney at gmail.com> wrote:
> Hello,
>
> I'm looking into adding metadata support in WebM (it's basically a
> subset of MKV, but with doctype "webm").  I've been looking at the
> Matroska Tags specification and I had a few questions.
>
> Suppose I have an Ogg file with the following values in its comment
> header (I obtained these results by using oggz-comment.exe):
>
>     Vendor: Xiph.Org libVorbis I 20070622
>     TITLE: One Look
>     ARTIST: Blaise Alleyne
>     ALBUM: One Look - Demo
>     YEAR: 2007
>     COMMENT: Licensed under a Creative Commons Attribution-Share
> Alike Canada 2.5 license
> http://creativecommons.org/licenses/by-sa/2.5/ca/
>     GENRE: Folk/Rock
>     TRACKNUMBER: 1
>
>
> Now suppose I want to capture this information in the form of Matroska
> tags.  Assume for now that this is an MKV file with a single (Vorbis)
> audio track.
>
> We start with a Tags element:
>
> 1:Tag [12][54][C3][67]
>
> Next we have a Tag element:
>
> 2:Tag [73][73]
>
> Can there be multiple level-2 Tag elements nested in the level-1 Tags
> element?  What would be the purpose of this?

As you see from the Targets, one of them could tag a chapter and
another would tag an attachment.

> Next there's a Targets element:
>
> 3:Targets [63][C0]
>
> I think this associates the metadata values with a particular track.
> The description of that element says that "It is void to describe
> everything in the segment."  Does this mean it can be omitted?  What
> does it mean to say that it's "void"?

Yes, it covers the whole segment when it's omitted.

> I see that there's a TargetTypeValue, and that it defaults to 50
> ("album").  Is 50 the appropriate value here?  We have a single audio
> track; is 30 ("track" or "song") a better value?

Well, it depends on what you want to specify. 50 is good for Movie
which is what Matroska files are usually. For a music track you will
probably want to describe the Album (50) and the Track (30). It's true
that loosely tags files may usually contain the title track without
even an artist.

> 4:TargetTypeValue [68][CA]
>
> Can the TargetTypeValue be omitted?

Yes, it's marked as not mandatory.

> There's also a TargetType string that is informational:
>
> 4:TargetType [63][CA]
>
> If the TargetTypeValue is 50, then should the TargetType have the value "ALBUM"?
>
> If the TargetTypeValue is 30, then should the TargetType have the
> value "TRACk" or possibly "SONG"?

It depends if it's a movie or a music track (or something else).

> Can the TargetType be omitted?

Yes, it's marked as not mandatory.

> There are a few sub-elements that correspond to various UIDs, such as
> TrackUID.  We have only a single audio track, so I think this can be
> omitted.

Yes

> Is there anything else that can be nested (at level 4) inside the
> Targets element (at level 3)?

No. I know the specs may seem a bit cryptic at first. When you see an
element 4 and then 3, that means you change a level down. So SimpleTag
is not inside Targets but inside of Tag.

> I'm still having trouble grokking the relationship between the Targets
> element (at level 3) and the SimpleTag element.  Is the SimpleTag
> element nested inside the Targets element, such that the SimpleTag
> would be at level 4?  Or does the SimpleTag element stand alone, as a
> peer to the Targets element, at level 3?

You should have a look at our examples, the layout is pretty clear there:
http://www.matroska.org/technical/specs/tagging/example-audio.html
http://www.matroska.org/technical/specs/tagging/example-video.html

The bottom line is each Tag is a block of data that tags a specific
part of the Matroska segment (target) (it may be the whole segment)
and these data are a series of SimpleTag elements.

> Wherever the SimpleTag does, I think the TagName, TagString, etc, are
> nested inside the SimpleTag element.

Yes. The + means a SimpleTag can be inside a SimpleTag. In case you
need to associate a URL with a particular music label (for example).

> I think also that there is one SimpleTag and its nested components for
> each metadata value listed above.  So let's see what that would look
> like:
>
> I'm not sure what to do with the vendor string, so let's ignore that
> one for now.  I think the remaining comments would look something like
> (assuming that SimpleTag elements are at level 3):
>
> 3:SimpleTag [67][C8]
> 4:TagName [45][A3]  with payload "TITLE"
> 4:TagString [44][87] with payload "One Look"
>
> 3:SimpleTag [67][C8]
> 4:TagName [45][A3]  with payload "ARTIST"
> 4:TagString [44][87] with payload "Blaise Alleyne"
>
> 3:SimpleTag [67][C8]
> 4:TagName [45][A3]  with payload "ALBUM"
> 4:TagString [44][87] with payload "One Look - Demo"

No, the "ALBUM" is not a tag element. It's "TITLE" under the
TargetTypeValue 50 (Album).

Here's an example:
http://www.matroska.org/technical/specs/tagging/example-audio.html#cd

The big difference with Matroska and most other tag systems is that
it's not flat. Because each level can need its own metadata. We spent
quite of bit of time figuring our a lot of use cases and tried a few
different versions before getting the system we have now.

> Now I can see already that I'm confused.  Matroska nests its tags.
> Are the TITLE and ALBUM tags listed at the same level in the
> hierarchy?  Or is the TITLE tag (for the track/song) nested inside the
> ALBUM somehow?
>
> I assume YEAR comment refers to the release date, so that would be:
>
> 3:SimpleTag [67][C8]
> 4:TagName [45][A3]  with payload "DATE_RELEASED"
> 4:TagString [44][87] with payload "2007"
>
> The COMMENT would be:
>
> 3:SimpleTag [67][C8]
> 4:TagName [45][A3]  with payload "COMMENT"
> 4:TagString [44][87] with payload "Licensed under a Creative Commons
> Attribution-Share Alike Canada 2.5 license
> http://creativecommons.org/licenses/by-sa/2.5/ca/"
>
> Although I think in this case the COMMENT comment would be more
> usefully transcribed as one of COPYRIGHT, PRODUCTION_OF_COPYRIGHT,
> and/or TERMS_OF_USE, perhaps with a URL nested under COPYRIGHT.
>
> The GENRE would be:
>
> 3:SimpleTag [67][C8]
> 4:TagName [45][A3]  with payload "GENRE"
> 4:TagString [44][87] with payload "Fold/Rock"
>
> The TRACKNUMBER would be:
>
> 3:SimpleTag [67][C8]
> 4:TagName [45][A3]  with payload "PART_NUMBER"
> 4:TagString [44][87] with payload "1"
>
> I'm not sure at what level PART_NUMBER goes, however.

As it's not flat, PART_NUMBER means different things depending on
where it's found. You can see the examples in the spec define it
depending on the value of TargetType

http://www.matroska.org/technical/specs/tagging/index.html#Organizational

> Does anyone have any insight into this?  I still not clear about which
> things should be nested into other things, so any help would be much
> appreciated.
>
> Thanks,
> Matt
> _______________________________________________
> Matroska-users mailing list
> Matroska-users at lists.matroska.org
> http://lists.matroska.org/cgi-bin/mailman/listinfo/matroska-users
> Read Matroska-Users on GMane: http://dir.gmane.org/gmane.comp.multimedia.matroska.user
>



-- 
Steve Lhomme
Matroska association Chairman



More information about the Matroska-users mailing list