This is part two in a series on MPEG-DASH. The previous post described the structure of an MPEG-DASH MPD. This post describes informative metadata, like labels, languages, and copyright information. I plan to write one more post in this series, about less visible data like asset identifiers.
All of the elements and attributes described in this post are optional, but it's a good idea to include at least role and language information. This allows clients to select tracks that match their user's language, and allows accessibility programs to find the information they need (like captions or audio descriptions).
Entire Program
For metadata that applies to the whole program, we can put it in a <ProgramInformation>
element at the MPD level. This can contain:
@lang
- Language in RFC 5646 format<Title>
- The program title<Source>
- The original source of the program<Copyright>
- A copyright statement for the program
In all of the elements above, the element contents are arbitrary strings.
Individual Streams
For metadata that only applies to an entire <AdaptationSet>
:
@lang
- Language in IETF RFC 5646<Role>
- Specifies the purpose of this media. This is a descriptor type, so the values depend on the@schemeIdUri
, but MPEG defines "urn:mpeg:dash:role:2011" for the roles "captions", "subtitle", "main", "alternate", "supplementary", "commentary", and "dub". Those values map closely to HTML5 kinds. If these are insufficient, you can always define your own URN. This attribute can appear multiple times, so if you do define your own URN, you should probably also include a<Role>
with the MPEG-defined URN.<Rating>
- Rating, defined by the URN used in@schemeIdUri
. MPEG doesn't define any Rating URNs. DVB defines "urn:dvb:iptv:ratings:2014" for EN 300 468 ratings, which seem to be defined as integer minimum viewer age. They also define "urn:dvb:iptv:guidance:2014", which I don't entirely understand.<Accessibility>
- Accessibility, defined by the URN used in@schemeIdUri
. The consensus seems to be that this element is unnecessary, since you can use Roles for the same information. MPEG doesn't define an Accessibility URN's, and I can't find any third-party URN's either.
If an Adaptation Set contains multiple media streams, you can describe each stream with a <ContentComponent>
, which contains the same attributes and elementes described for <AdaptationSet>
.
Metadata in Segments
Metadata can also be included in segments. If you do this, I recommend that you:
- Put the metadata in the initialization segment(s), and don't put any in the media segments. This allows clients to access it efficiently, and avoids bloating the media segments with duplicate information.
- Put any metadata that could be used for selection in the MPD too, so clients will have enough information to make adaptation set selections without having to download segments.
- If you put the metadata in multiple places, make sure it's identical to ensure that viewers will get the same experience regardless of which metadata their client chooses to use.
- If you want a per-stream label, put it in the initialization segment(s), since there's no interoperable way to put it in the MPD.
Mapping to HTML5
Bob Lund (my coworker) and Silvia Pfeiffer have been working on a draft spec for providing metadata as HTML5 attributes. At the DASH MPD level, @lang
maps to @language
as you'd expect, and the mapping for <Role>
to @kind
is mostly straightforward (although not all values map easily).
DASH doesn't have a stream-level label, so @label
will be blank unless it maps from inside the stream. W3C has a way to generate URN's from the HTML5 spec, so you could try to include a label as <SupplementalProperty schemeIdUri="http://www.w3.org/TR/html/#attr-track-kind-subtitles"/>
or <SupplementalProperty schemeIdUri="http://www.w3.org/TR/html/#attr-track-kind" value="http://www.w3.org/TR/html/#attr-track-kind-subtitles"/>
, but you won't find any support for that in players yet.
Unfortunately, in-band metadata availability is currently inconsistent. Safari seems to support all of these attributes (from a quick look at the code). WebKitGTK+ provides @language
and @label
, but not @id
or @kind
. Microsoft Edge supports @id
and @language
on AudioTrack and VideoTrack and @kind
and @language
on TextTrack. Last time I checked, other browsers didn't provide any in-band metadata, but this may have improved in the last year.