video-streamingmpeg-dashmp4box

How to make MPEG-DASH to stream different qualities based on time slices


i am exploring MPEG-DASH technique for video adaptation. As a test case, i have two versions of the same video with different resolutions 400x250(1.mp4) & 640x360(2.mp4) and want to stream it via MPEG DASH. Using GPAC - MP4Box i have generated the mpd using below command:

MP4Box -dash 1000 -rap -bs-switching no -profile live -out manifest.mpd 1.mp4 2.mp4

The Generated MPD is as follows:

<?xml version="1.0"?> 
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H4M57.088S" maxSegmentDuration="PT0H0M10.428S" profiles="urn:mpeg:dash:profile:full:2011">
<ProgramInformation moreInformationURL="http://gpac.io">
  <Title>manifest.mpd generated by GPAC</Title>
 </ProgramInformation>
<Period duration="PT0H4M57.088S">
  <AdaptationSet maxWidth="640" maxHeight="360" maxFrameRate="24000/1001" par="16:9" lang="und" startWithSAP="1">
   <Representation id="1" mimeType="video/mp4" codecs="avc1.640015" width="400" height="250" frameRate="24000/1001" sar="10:9" bandwidth="80722">
<SegmentTemplate media="1_dash$Number$.m4s" initialization="1_dashinit.mp4" timescale="24000" startNumber="1" duration="24000"/>
   </Representation>
   <Representation id="2" mimeType="video/mp4" codecs="avc1.64001E" width="640" height="360" frameRate="24000/1001" sar="1:1" bandwidth="137371">
<SegmentTemplate media="2_dash$Number$.m4s" initialization="2_dashinit.mp4" timescale="24000" startNumber="1" duration="24000"/>
   </Representation>
  </AdaptationSet>
 </Period>

What i want exactly is to adopt this video based on time slice i.e. for first 5 seconds, 1.mp4 should be streamed, for next 15 seconds, 2.mp4 should be streamed and onwards..

Guidance needed on how can i achieve adaptation based on the time slices for streaming different qualities.


Solution

  • MPEG DASH is a request and response streaming protocol - the client requests each segment and the streaming server responds with the appropriate segment.

    The client decides which bandwidth to request from those available in the manifest, usually based on its view of the network conditions at the time, based on buffering etc, and on the devices capabilities.

    Most clients will also allow you manually select a bit rate from those available.

    If you want to modify a client to use one bit rate for a given time period and then another bit rate for a different time period, then you will likely want to modify the algorithm in the client that choose the bit rate to request.

    Open source players sometimes allow you specify a custom function to do this - some examples:

    If you don't want to change anything on the client and want to make the server dictate the stream that is used, the simplest way would be to only provide one bit rate for the first time period and then only the other bit rate for the next period.

    MPEG DASH cann support multiple periods - see the diagram below from a DASH overview paper (link at the time of writing: https://www.nctatechnicalpapers.com/Paper/2012/2012-mpeg-dash-a-technical-deep-dive-and-look-at-what-s-next)

    enter image description here

    You can see that if you have one period with a single adaption set with a single bit rate or representation, and then the next period also with a single bit rate or representation, you can also achieve what you want. I think it is fair to say, however, that this is not a typical way to use DASH.