DASH manifest manipulation

Content substitution and content insertion, in DASH, with illustrated examples

📘

Terminology

This page uses the term "alternate content" to mean any content that is used to replace original content or be inserted or stitched to original content.

The terms "rendition" and "track" are also used interchangeably to refer to any of the representations in the DASH manifest, whether video, audio or subtitles.

📘

About the examples

All examples in this page are made up and shortened for the purpose of illustration. They are not functional manifests, and will differ in a number of respects to manifests that will actually be used as Source or generated by broadpeak.io.

White space and comment lines are also freely added that would like not be found in real manifests.

The role of Periods

In MPEG-DASH, the mechanism used to switch between different content is powered by the use of multiple periods that do not overlap on the timeline. Clients (at least those that know how to deal with multiple periods) directly handle the switch from one period to the next.

The DASH protocol allows each period to contain their own sets of renditions (as Representations contained in Adaptation Sets), and players should be able to adapt if there is no direct correspondence between consecutive adaptation sets.

📘

For optimal quality of experience, and compatibility with as many players as possible, it is recommended to match adaptation sets between contents (or period) as much as possible

Manifest Manipulation

Content Substitution

Multiple Periods

In MPEG-DASH, the mechanism used to switch between different content is powered by the use of multiple periods that do not overlap on the timeline. Clients (at least those that know how to deal with multiple periods) directly handle the switch from one period to the next.

If there is an "event" in the DVR window, the output of broadpeak.io will always contain multiple periods.

  • If the source contains a single period, a new period will be inserted to represent the substitute content.
  • If the source already contains multiple periods (for example marking portions of the content that will be replaced, such as original ads in a DAI scenario), and the "event" timing matches the boundaries of that period, broadpeak.io will replace those periods with new ones representing the substitute content

Media URIs

The new periods for substitute content will contains media URIs that reference substitute media segments. Those URIs are defined by the BaseURL element, and/or the media segment (SegmentTemplate@media)

Example

We will illustrate these changes by using a basic original manifest with a single period:

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" type="dynamic"> 
  <!-- Period 1 -->
  <Period id="1" start="PT0.00S"> 
    <BaseURL>../../../dash/sourcecontent/</BaseURL> 
    ...
  </Period> 
</MPD>

An "event" triggers a switch from this original live source to a substitute content after 16s and for 12 seconds, after which the stream resumes the original live content.

The MPD generated by broadpeak.io will now contain three periods:

  • Each period will have a unique id and a start time
  • Each period points to a specific base URL which represents the base path where the media segment of each source, original or replacement source, can be accessed.
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" type="dynamic"> 
	<!-- Period 1, with original content -->
  <Period id="1" start="PT0.00S"> 
    <BaseURL>../../../dash/sourcecontent/</BaseURL> 
    ...
  </Period> 
  
  <!-- Period 2, with substitution content -->
  <Period id="2" start="PT16.00S">  
    <BaseURL>../../../dash/substitutioncontent</BaseURL> 
    ...
  </Period> 
  
  <!-- Period 3 -->
  <Period id="3" start="PT28.00S">  
    <BaseURL>../../../dash/sourcecontent/</BaseURL>
    ...
  </Period> 
</MPD>

📘

Period@duration

Periods in Live manifests do not carry a duration attribute. The DASH timing model makes it an optional parameter that can be deducted from the following period's start point.


Content Insertion

Multiple Periods

broadpeak.io will manipulate the source manifest to insert new periods for the inserted content, and if necessary splitting the original period into multiple periods if the insertion takes place in the middle of the content. The output will therefore always contain multiple periods, assuming that the ad server returned a VAST/VMAP payload with compatible creatives.

Based on the type of ad inserted (pre-roll, mid-roll or post-roll), the insertion of new content may happen right at the start of the playlist, in the middle of it, or at the end of it.

❗️

Multi-Period Sources

Note that source manifests that use multiple sources are not currently supported for the logic of insertion

Example

Below is an example of how an original MPEG-DASH manifest might look like for an on-demand asset of 24 seconds

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" type="static" mediaPresentationDuration="PT24S"> 
  <!-- Period 1 -->
  <Period id="1" duration="PT0M24S"> 
    <BaseURL>../../../dash/sourcecontent/</BaseURL> 
    ...
  </Period> 
</MPD>

Following the successful retrieval of ad information, three insertion of content are performed, at the beginning of the asset, after 12 seconds, and at the end. All the inserted ads are 8 seconds. Here is a visual representation of how it would look:

The resulting manifest contains 5 periods:

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" type="static" mediaPresentationDuration="PT48S"> 
  <!-- Period 1, with pre-roll -->
  <Period id="1" duration="PT8S"> 
    <BaseURL>../../bpkio-jitt/dash/pre-roll/</BaseURL>
    ...
  </Period> 
  
  <!-- Period 2, original content, part 1 -->
  <Period id="2" duration="PT12S">  
    <BaseURL>../../../dash/sourcecontent</BaseURL>
    ...
  </Period> 
  
  <!-- Period 1, with mid-roll -->  
  <Period id="3" duration="PT8S">
    <BaseURL>../../bpkio-jitt/dash/mid-roll</BaseURL>
    ...
  </Period> 
    <!-- Period 2, original content, part 2 -->
  <Period id="2" duration="PT12S">  
    <BaseURL>../../../dash/sourcecontent</BaseURL>
    ...
  </Period> 

    <!-- Period 5, with post-roll -->
  <Period id="1" duration="PT8S"> 
    <BaseURL>../../bpkio-jitt/hls/post-roll/</BaseURL>
    ...
  </Period> 
</MPD>

Notice how this manifest now declares the stream to be 48s long.


Dealing with DRM

If the content is encrypted, the MPEG-DASH specification requires that each AdaptationSet within the period provides encryption information in a ContentProtection element.

Whether content is substituted or inserted in those streams, the associated periods will reflect the encryption status of that new content.

Examples

In the case where the original source is encrypted, and the replacement source is not, the manifest might look like the following:

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" type="dynamic"> 
	<!-- Period 1, encrypted original content -->
  <Period id="1" start="PT0.00S"> 
    <BaseURL>../../../dash/sourcecontent/</BaseURL>
    <AdaptationSet ... > 
      ...
			<!-- Encryption information related to content source -->
      <ContentProtection ...> 
         ... 
      </ContentProtection>
      ...
    </AdaptationSet>
  </Period> 
  
  <!-- Period 2, with inserted or substituted content, not encrypted -->
  <Period id="2" start="PT20.00S">  
    <BaseURL>../../../dash/othercontent</BaseURL>
    ...
  </Period> 
  
  <!-- Period 3, encrypted original content -->  
  <Period id="3" start="PT60.00S">
    <BaseURL>../../../dash/sourcecontent/</BaseURL>
     <AdaptationSet ... >
      ...
			 <!-- Encryption information related to content source -->
       <ContentProtection ...> 
         ...
      </ContentProtection>
      ...
    </AdaptationSet>
  </Period> 
</MPD>

If the new content is also encrypted, the periods associated with it will also contain their own encryption information.

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" type="dynamic"> 
	<!-- Period 1, encrypted original content -->
  <Period id="1" start="PT0.00S"> 
    <BaseURL>../../../dash/sourcecontent/</BaseURL>
    <AdaptationSet ... > 
      ...
			<!-- Encryption information related to content source -->
      <ContentProtection ...> 
         ... 
      </ContentProtection>
      ...
    </AdaptationSet>
  </Period> 
  
  <!-- Period 2, with substituted or inserted content, encrypted -->
  <Period id="2" start="PT20.00S">  
    <BaseURL>../../../dash/othercontent</BaseURL>
     <AdaptationSet ... >
      ...
			 <!-- Encryption information related to new content -->
       <ContentProtection ...> 
         ...
      </ContentProtection>
      ...
    </AdaptationSet>
    ...
  </Period> 
  
  <!-- Period 3, encrypted original content -->  
  <Period id="3" start="PT60.00S">
    <BaseURL>../../../dash/sourcecontent/</BaseURL>
     <AdaptationSet ... >
      ...
			 <!-- Encryption information related to content source -->
       <ContentProtection ...> 
         ...
      </ContentProtection>
      ...
    </AdaptationSet>
  </Period> 
</MPD>