Search code examples
httphttp-live-streamingmpeg-dash

Does HLS and MPEG-DASH live in HTTP message body?


Do the packets look like this (I assume HLS and MPEG-DASH fit into HTTP in the same way, correct me if wrong)

<HTTP HEADERS>
</HTTP HEADERS>
<HTTP BODY>
    <HLS HEADERS>
    </HLS HEADERS>
    <HLS BODY>
    </HLS BODY>
</HTTP BODY>

or are the headers included as HTTP headers like this?

<HTTP WITH HLS HEADERS>
</HTTP WITH HLSHEADERS>
<HTTP BODY>
    <HLS PAYLOAD>
    </HLS PAYLOAD>
</HTTP BODY>

Solution

  • I'm not sure I am fully clear on your question but hopefully an explanation of the structure of HLS and DASH will help.

    Both HLS and DASH provide an index or manifest file, which contains information about the audio, video, subtitle etc streams for a video or media stream.

    The player looks at the index file, which is essentially just a XML file, and uses the URLs for the media streams to download and then play the media - the URL's can be absolute or relative to a base URL.

    The information for the video streams typically will include different bit rate streams for each segment of the video. This allows the player to select the next segment from the relevant stream which is best suited to the device and the current network conditions.

    The actual video and audio streams themselves are typically a fragmented structure - either TS (MPEG Transport Stream) based or a flavour of fragmented MP4 (fMP4).

    There are plenty of example DASH manifest files available including this one from the Mozilla site at the time of writing:

    <?xml version="1.0" encoding="UTF-8"?>
    <MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="urn:mpeg:dash:schema:mpd:2011"
      xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
      type="static"
      mediaPresentationDuration="PT654S"
      minBufferTime="PT2S"
      profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
    
      <BaseURL>http://example.com/ondemand/</BaseURL>
      <Period>
        <!-- English Audio -->
        <AdaptationSet mimeType="audio/mp4" codecs="mp4a.40.5" lang="en" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
          <Representation id="1" bandwidth="64000">
            <BaseURL>ElephantsDream_AAC48K_064.mp4.dash</BaseURL>
          </Representation>
        </AdaptationSet>
        <!-- Video -->
        <AdaptationSet mimeType="video/mp4" codecs="avc1.42401E" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
          <Representation id="2" bandwidth="100000" width="480" height="360">
            <BaseURL>ElephantsDream_H264BPL30_0100.264.dash</BaseURL>
          </Representation>
          <Representation id="3" bandwidth="175000" width="480" height="360">
            <BaseURL>ElephantsDream_H264BPL30_0175.264.dash</BaseURL>
          </Representation>
          <Representation id="4" bandwidth="250000" width="480" height="360">
            <BaseURL>ElephantsDream_H264BPL30_0250.264.dash</BaseURL>
          </Representation>
          <Representation id="5" bandwidth="500000" width="480" height="360">
            <BaseURL>ElephantsDream_H264BPL30_0500.264.dash</BaseURL>
          </Representation>
        </AdaptationSet>
      </Period>
    </MPD>
    

    (https://developer.mozilla.org/en-US/docs/Web/Apps/Fundamentals/Audio_and_video_delivery/Setting_up_adaptive_streaming_media_sources#MPEG-DASH_Encoding )

    Looking at the details of this manifest:

    enter image description here