Search code examples
http-live-streamingmpeg-dashbentoshaka

Fragmented mp4 for DASH and HLS On Demand vs Live Profiles


I'm experimenting with Bento4 and Shaka Packager to output files for both DASH and HLS using fragmented mp4.

I'm having some trouble understanding the differences and pros and cons between the MPEG-DASH Live and On-Demand profiles. If I was streaming live broadcast content I would use the Live profile but for static on demand videos it seems I can use the On-Demand or Live profile. Each profile outputs files in a completely different file format and folder structure with On-Demand outputting a flat folder structure containing .mp4 files and Live outputting a nested folder structure containing m4s files.

Is it advisable to use one profile rather than the other for static video content that will not be broadcast live (e.g. browser support, efficacy etc) and if so why?


Solution

  • The "live" profile is somewhat of a misnomer, because it isn't really related to live streaming. The main difference is that with the on-demand profile, the server hosts large flat files with many segments per file (where a segment is a short portion of a media asset, like audio or video, typically 2 to 10 seconds each), including an index of where the segments are in the file. It is then up to the streaming client to access the segments one by one by doing HTTP "range" requests to access portions of the media assets. For the "live" profile, segments are not accessed as ranges in a flat resource, but as a separate resource for each segment (a separate URL for each segment). This doesn't necessarily mean that the HTTP server needs to have the segments in separate files, but it need to be able to map each segment URL to its corresponding media, either by performing itself a lookup in an index into a flat file, or by having each segment in a separate file, or by any other means. So it is up to the server to do the heavy lifting (as opposed to the "on-demand" profile where it is the player/client that does that. With packagers like Bento4, if there's no special assumptions made of the HTTP server that will server the media, the default mode for the "live" profile is to store each segment in a separate file, so that the stream can be served by any off-the-shelf HTTP server. So, for simplicity, if your player supports the on-demand profile, that's an easier one to choose, since you'll have fewer files.