Media segment referencing

How the platform referencies media segments and how to adjust that

When performing manifest manipulation, the standard behavior of broadpeak.io is to reference media segments inside the manifest with relative URLs.

However, in some cases, delivery workflows may need unique ways to identify media segment locations in manifests. broadpeak.io gives the ability to change the default way media segments are referenced in manifests, using relative or absolute URLs or even adding a prefix in the segment’s path location.

Default Scenario

The standard behavior of broadpeak.io is to reference media segments inside the manifest using relative URLs, meaning that references are made based on the original request path URL of the manifest.

The following example shows an HLS media manifest with an ad inserted, where the path is adapted to match the ad media segment path.

#EXTM3U
#EXT-X-VERSION:5
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-TARGETDURATION:4
#EXT-X-PROGRAM-DATE-TIME:2021-01-01T01:10:00.000000+00:00
#EXTINF:4, no desc
video/segment-41.ts
#EXTINF:4, no desc
video/segment-42.ts
#EXTINF:4, no desc
video/segment-43.ts
#EXTINF:4, no desc
video/segment-44.ts

# switch to ad content
#EXT-X-DISCONTINUITY
#EXT-X-PROGRAM-DATE-TIME:2011-01-01T01:10:16.000000+00:00
#EXTINF:4, no desc
../../ad-creative1/hls/audio=129117-video=633990-1.ts
#EXTINF:4, no desc
../../ad-creative1/hls/audio=129117-video=633990-2.ts
#EXTINF:4, no desc
../../ad-creative1/hls/audio=129117-video=633990-3.ts

# switch back to original content
#EXT-X-DISCONTINUITY
#EXT-X-PROGRAM-DATE-TIME:2011-01-01T01:10:28.000000+00:00
#EXTINF:4, no desc
video/segment-48.ts
#EXTINF:4, no desc
video/segment-49.ts

Note that the principle is the same for DASH streams: the baseURL of DASH manifests is set with a relative URL to specify the location of media segments, whether they come from the original content or from the replacement one (in that case, the inserted ad).

Use of absolute URL

Sometimes, you may need to reference live media segments or ad media segments with absolute URLs in manifests, switch to an alternative FQDN, or add a path modification. Advanced options are available in your service configuration to do so, at the ad insertion settings step.

  • Source media segments: When activating the absolute URI option, you can choose to change the FQDN and even add a prefix to your source media segments URL to ensure they are routed to the location that matches your needs.
  • Ad media segments (in case of Ad Insertion): you can do the same as for source media segments, but the option is only available when you don't need to transcode your ads nor use Server Side Ad Tracking (SSAT). Indeed, in such cases, ad media segments are available from stream.broadpeak.io, and the URL should not be modified. It's the same thing for tracking beacons that are triggered from broadpeak.io when the player requests ad media segments.

Ad insertion use-cases

To illustrate the use of URL options in broadpeak.io, we describe below different configurations and the shape of media segments referencing before, during, and after ad insertion

We’ll use a simple ad insertion scenario in HLS. Let’s assume we work with the following elements :

Default scenario

#EXTINF:4, no desc
video/segment-44.ts
#EXT-X-DISCONTINUITY
#EXT-X-PROGRAM-DATE-TIME:2011-01-01T01:10:16.000000+00:00
#EXTINF:4, no desc
../../ad-creative1/hls/audio=129117-video=633990-1.ts
#EXTINF:4, no desc
../../ad-creative1/hls/audio=129117-video=633990-2.ts
#EXTINF:4, no desc
../ad-creative1/hls/audio=129117-video=633990-3.ts
#EXT-X-DISCONTINUITY
#EXT-X-PROGRAM-DATE-TIME:2011-01-01T01:10:28.000000+00:00
#EXTINF:4, no desc
video/segment-48.ts

In that case, a CDN between the player and broadpeak.io has to route each segment request to the right origin, whether it’s an ad or content media segment that has to be retrieved (see https://developers.broadpeak.io/docs/ad-insertion-with-a-cdn for more info on that topic).


Original Source as absolute URL with ad segments in relative URL

#EXTINF:4, no desc
https://stream.content-origin.io/123456/hls/video/segment-44.ts
#EXT-X-DISCONTINUITY
#EXT-X-PROGRAM-DATE-TIME:2011-01-01T01:10:16.000000+00:00
#EXTINF:4, no desc
../../ad-creative1/hls/audio=129117-video=633990-190.ts
#EXTINF:4, no desc
../../ad-creative1/hls/audio=129117-video=633990-191.ts
#EXTINF:4, no desc
../../ad-creative1/hls/audio=129117-video=633990-192.ts
#EXT-X-DISCONTINUITY
#EXT-X-PROGRAM-DATE-TIME:2011-01-01T01:10:28.000000+00:00
#EXTINF:4, no desc
https://stream.content-origin.io/123456/hls/video/segment-48.ts

Original Source as absolute URL with ad segments in absolute URL

#EXTINF:4, no desc
https://stream.content-origin.io/123456/hls/video/segment-44.ts
#EXT-X-DISCONTINUITY
#EXT-X-PROGRAM-DATE-TIME:2011-01-01T01:10:16.000000+00:00
#EXTINF:4, no desc
https://creative.ad-origin.io/ad-creative1/hls/audio=129117-video=633990-190.ts
#EXTINF:4, no desc
https://creative.ad-origin.io/ad-creative1/hls/audio=129117-video=633990-191.ts
#EXTINF:4, no desc
https://creative.ad-origin.io/ad-creative1/hls/audio=129117-video=633990-192.ts
#EXT-X-DISCONTINUITY
#EXT-X-PROGRAM-DATE-TIME:2011-01-01T01:10:28.000000+00:00
#EXTINF:4, no desc
https://stream.content-origin.io/123456/hls/video/segment-48.ts

Original Source as relative URL with Replacement content in absolute URL

#EXTINF:4, no desc
video/segment-44.ts
#EXT-X-PROGRAM-DATE-TIME:2011-01-01T01:10:16.000000+00:00
#EXTINF:4, no desc
https://creative.ad-origin.io/ad-creative1/hls/audio=129117-video=633990-190.ts
#EXTINF:4, no desc
https://creative.ad-origin.io/ad-creative1/hls/audio=129117-video=633990-191.ts
#EXTINF:4, no desc
https://creative.ad-origin.io/ad-creative1/hls/audio=129117-video=633990-192.ts
#EXT-X-DISCONTINUITY
#EXT-X-PROGRAM-DATE-TIME:2011-01-01T01:10:28.000000+00:00
#EXTINF:4, no desc
video/segment-48.ts

Use of prefix for URI

The use of URI prefix fields allows inserting or replacing FQDN or changing segment locations when an alternative to what the origin is delivering for ads and content segments is necessary. The following examples illustrate the principle for the source segment; ad segment configuration works the same way.

… for source segments with relative URL

#EXTINF:4, no desc
/prefix-p/video/segment-41.ts

… for source segments with absolute URL

#EXTINF:4, no desc
https://stream2.content-origin.io//123456/hls/video/segment-41.ts

Virtual Channel and Content Replacement use cases

The same principles can be applied to other service types. In that case, the option applies only to the main content; replacement contents used in slots will be referenced with a relative URL.