There is a lot that goes on behind every video stream. To stream your videos seamlessly, video streaming protocols play a huge role. They break the video into smaller chunks and send it to the viewer. Depending on your requirements and end goals there are several protocols available. One of these is MPEG-DASH, which is widely used to stream videos online.
In this article, I’d shed more light on what MPEG-DASH is, how it works, and also how it compares to HLS, another streaming protocol.
TABLE OF CONTENT
-
- What is MPEG-DASH?
- What is MPEG Dash Playback?
- Is MPEG Dash playback secure for video?
- How streaming over HTTP came into existence?
- How MPEG DASH works?
- HLS Vs. DASH
- How Streaming Platform Utilise HLS DASH?
- Vdocipher provides Dash + Secure Video playback
- Other MPEG Dash Player without secure video playback
- How to build the Dash player
- DASH is the alternative when we need it
- How To Get AES Encryption Online?
What is MPEG-DASH?
MPEG-DASH is a streaming method. DASH stands for “Dynamic Adaptive Streaming over HTTP.” Because it is based on HTTP, any origin server can be set up to serve MPEG-DASH streams.
MPEG-DASH is similar to HTTP Live Streaming (HLS), another streaming protocol, that breaks videos down into smaller chunks and encodes those chunks at different quality levels. This makes it possible to stream videos at different quality levels and to switch in the middle of a video from one quality level to another one.
What is MPEG Dash Playback?
DASH stand for Dynamic Adaptive Streaming over HTTP, as the name suggests it’s it has the “Dynamic” bit rate and is “adaptive” to Network performance, that is it changes the bit rate according to network to keep the video playing. Higher the video bitrate higher the video quality.
Working of Dash Playback contains majorly three steps
- Segmentation & Encoding
In this step video is divided into many segments of fewer seconds and index file to keep the track of all the segmentation is created, this index file is also known as the manifest file.
Segments are encoded in various encoding and video quality levels for smaller to bigger files size and the manifest file is updated. Dash Support any encoding standards
- Delivery
When the video starts streaming, the device first fetches the index file (manifest file) and then it fetches the proper segment of video one by one from the server using HTTP/HTTPS by accounting for the network performance.
- Decoding and Playback
Device on receiving the segments decoded each segment and provide the data to the player for video playback.
If during the playback the network performance changes then the player also changes the segment request of high/low quality depending on the network performance. This makes the video playback adaptive to network performance.
Is MPEG Dash playback secure for video?
Dash playback is not secure by default, it’s just a technology for adaptive media playback, it does not contain any encryption standards to secure your video, what secure the video is the DRM services. If you want to learn more about the DRM we already have a blog for this “What is DRM Technology, its Working & Video Content Protection Types”
How streaming over HTTP came into existence?
Did you know streaming over HTTP wasn’t even a thing until iPhone 3GS came into existence? Up until then, video streaming happened over RTMP and required the Adobe Flash plugin for playback. Steve Jobs was determined to kill Adobe Flash. He vouched for open web standards to take charge of video streaming on web browsers and mobile devices. The industry-backed him and hailed him a savior. Nobody wanted to rest the faith of the entire video streaming industry on the shoulders of one corporate.
The death of Adobe Flash
To begin with, there were too many problems with Flash. It was proprietary. While the Adobe Flash plugin was compatible with most web browsers of that time, creating Flash content required web developers to buy costly software licenses from Adobe. Flash plugin was a security nightmare even when it was updated fifteen times a month. Setting up a dedicated server for RTMP streaming was another hassle and wasn’t exactly cheap.
Firewalls would disallow traffic over port 1935 essential to receive content from RTMP servers. Firewalls weren’t a problem for content over HTTP since port 80 is always set to allow.
Further, Adobe Flash was too resource-heavy for battery-operated devices. It was simply impractical to bring Flash to mobile devices when web standards were constantly evolving. There is a reason death of flash is often regarded as the rebirth of the web we know today.
The need for an open streaming standard
Adobe killed Flash a few years later, leaving a huge vacuum in the industry. Apple was quick to tap on the opportunity with its proprietary HTTP-based adaptive bitrate streaming protocol, HLS streaming(or HTTP Live Streaming).
While HLS addressed every problem associated with Adobe RTMP, it didn’t one. HLS was proprietary just like Adobe’s offering. This development of MPEG had begun.
DASH was the perfect candidate in the post-Flash world. It was an open streaming method not controlled by a corporation. It allowed video playback on browsers supported by open web standards powered by HTML5. MPEG-DASH did not require users to install any plugin and streaming provider deploys a dedicated RSTM server and would run on existing protocols: HTTP and TCP. The firewall wasn’t a problem either for HTTP servers.
The birth of the first open streaming method: MPEG DASH
Apparently, some competitors weren’t fine with the situation Apple was putting them into. One of them was Google. Together, they laid the plan for an alternative to HLS, an industry standard that is not controlled in any way by a single corporate but a consortium of independent stakeholders. More than 50 companies became involved — Microsoft, Netflix, Google, Ericsson, Samsung, and Adobe included — and the effort was coordinated by MPEG with other industry organizations such as 3GPP, DECE, OIPF, and W3C. MPEG published the Dynamic Adaptive Streaming over HTTP (DASH) standard in April 2012 as MPEG-DASH and revised it in 2019 as MPEG-DASH ISO/IEC 23009-1:2019.
Explore More ✅
Ensure Smooth & Secure Streaming of Your Videos With VdoCipher
VdoCipher helps 3000+ customers over 180+ countries to host their videos securely, helping them to boost their video revenues.
How MPEG DASH works?
MPEG DASH expects the video content to be stored on a HTTP server in two parts: Media Presentation Description (MPD) and segments. MPD contains the content’s metadata in various configurations. The segment contains the bitstreams in the form of multiple segments.
MPEG DASH retrieves the MPD as soon a HTTP session is established with the client. MPD provides all the information the DASH client needs to pre-render the video content to be played: media types, available video resolutions, bandwidth range, status of digital rights management (DRM) flag, URI of the video on the HTTP server, etc.
The DASH client parse the information in the MPD file to pick the most appropriate rendition of the video, throws a HTTP GET request to fetch the first set of segments from that rendition, and starts playing the video.
To ensure continuous stream, the client fetches consequent segments according to the available bandwidth and may upscale, downscale segment quality accordingly.
HLS Vs. DASH
The Similarities Between HLS & DASH
In hindsight, MPEG-DASH has expected parallelism to other HTTP-based streaming protocol HLS since they both try to address the modern streaming problems. For instance, they both run over HTTP and employ TCP as their transport protocol.
Dynamic Streaming
Streaming videos shouldn’t start over when you change their quality midway. That would be a bad experience for users and unnecessary load on streaming platforms’ servers. To circumvent these problems, both streaming methods slice a video-set into consecutive, independent subsets called segments and encodes each segment at several resolutions (SH, HD, UHD, etc.).
Adaptive Streaming
If you’re watching a trailer in full HD and realized it is also available in 4K HDR, you may switch the video quality midway without having to restream the video from scratch. Adaptive streaming means your browser’s inbuilt video player can switch the quality back and forth based on your bandwidth and connection’s quality.
Adjustable segments lengths
Segment lengths on both HLS and MPEG DASH are user adjustable. HLS used to default to 10 seconds until 2016 when Apple switched to 6 seconds default segments. MPEG-DASH allows segments to be anywhere from 2 to 10 seconds although most streaming platforms tend to keep them between 2-4 seconds for interrupted video playbacks.
The differences come into to play
There was one difference to DASH that did not surface until YouTube started streaming content in 4K HDR. HLS restricts HTTP streaming to only two codecs: H.264 and its successor H.265/HEVC. However, that isn’t the case with MPEG DASH. DASH is codec agnostic and will play any codec you throw on it. Not every streaming platform encodes 4K HDR videos in HEVC. MPEG DASH provides the codec freedom they need. Both HLS and DASH has been widely used for react video and react native video playback
The Google factor
For example, Google backed its own home-grown codec VP9 (successor to VP8) over HEVC for streaming 4K HDR on YouTube. If you remember, 4K streaming was unavailable on Apple devices until recently. HLS insistence towards HEVC was the reason.
HLS wasn’t compliant with VP9 so Google went for MPEG DASH for streaming 4K HDR and higher quality content on YouTube. As I said, MPEG-DASH is codec-agnostic. That is streaming platforms can transport videos in the codec of their choice.
Majority of video streaming still happens in SD and HD. Video segments in lower quality are encoded in H.264 and are streamed over HLS. HLS has a considerable market share of video streaming market, and it looks like it will remain so for a foreseeable future. MPEG-DASH has a long way to go but it is off to a great start. When it comes to content delivery networks (CDNs), RTMP servers still process a lot of videos for processing.
How Streaming Platforms Utilise HLS & DASH?“>
In our research, we found sufficient evidence to claim that every major streaming platform support DASH in addition to HLS, including Amazon Prime Video, Netflix, Disney Plus and Hulu. Game streaming service Amazon Twitch is an exception as it relies majorly on HLS for live game streaming. Netflix CEO even claimed that MPEG-DASH lowered their network costs.
DASH is the alternative when we need it
As expected by the consortium that led to the formation of MPEG-DASH, Apple eventually did try to steer the development of HLS in favor of its devices. Apple devices support HEVC since 2018. By restricting HLS support to HEVC, Apple abused its industry position to enforce HEVC on device manufacturers, operating platforms, and streaming platform. Had it not for MPEG-DASH as an open alternative, HEVC would had have become the new H.264.
The industry rather than giving into Apple’s pressure switched to MPEG-DASH for 4K HDR content.
Vdocipher provides Dash + Secure Video playback
When dash playback is added with DRM solution it not only provides reliable video playback irrespective of network performance but also the secure video playback.
But here’s a catch you won’t be able to serve all your customer with just Dash cause Dash is not majorly supported by the Apple device. For the apple device, you have another playback technology like Dash called HLS and then you have to choose the DRM service that serves the Apple device,
So we at vdocipher player provide the complete package in Plug and play, which handles all complexity of secure video playback
List Other MPEG Dash Player without secure video playback?
- Dash.js
Dash.js is an open-source HTML5 Video player based on MPEG_DASH and built by the own dash industry forum to demonstrate a production-ready framework for Dash Playback.
It is based on the Media Source Extension API by w3c and provides a simple user interface with tons of information to debug the video stream for error.
Sample code for using Dash.js :
<!doctype html> <html> <head> <title>Dash.js Rocks</title> <style> video { width: 640px; height: 360px; } </style> </head> <body> <div> <video data-dashjs-player autoplay src="https://dash.akamaized.net/envivio/EnvivioDash3/manifest.mpd" controls> </video> </div> <script src="yourPathToDash/dash.all.min.js"></script> </body> </html>
- Exoplayer:
Exoplayer video player on application level for android, it is alternative to Android’s MediaPlayer API for providing better features and customization, it has feature like persistent caching and custom rendered.
Android’s MediaPlayer API is fixed to the android version of the device, whereas Exoplayer can be updated via playstore application update
We’ve also written a blog on how to stream videos on iOS using AVPlayer, do check it out to know more about video streaming in iOS.
How to build the MPEG Dash player?
Dash player functionality is to fetch the manifest file, parse it and play all segments one by one.
MPEG Dash player can be processed in 7 steps:
- Get the video element reference
- Create media source
- Create ObjectURL from the media source and add to source of video
- Set the mime type for media source via addSourceBuffer
- Fetch the manifest file and parse and store all required data in variable
- Initialize the video with first segment
- Use event `timeupdate` to continuously update the source with all other segments
// Create media source const videoEl = document.getElementById("my-video"); const mediaSource = new MediaSource(); const sourceUrl = URL.createObjectURL(mediaSource); videoEl.src = sourceUrl; let videoSource; let segCheck; let currentSegmentIndex = 0; let lastTime; // get mainfest file const xmlData = await fetch("MANIFEST_URL_FROM_SERVER") .then((r) => r.text()) .then((xml) => parser.parseFromString(xml, "text/xml", 0)); // extract data from manifest file const file = xmlData.querySelectorAll("BaseURL")[0].textContent.toString(); const rep = xmlData.querySelectorAll("Representation"); const type = rep[0].getAttribute("mimeType"); const codecs = rep[0].getAttribute("codecs"); const width = rep[0].getAttribute("width"); const height = rep[0].getAttribute("height"); const bandwidth = rep[0].getAttribute("bandwidth"); const ini = xmlData.querySelectorAll("Initialization"); const initialization = ini[0].getAttribute("range"); const segments = xmlData.querySelectorAll("SegmentURL"); const segList = xmlData.querySelectorAll("SegmentList"); let segDuration = segList[0].getAttribute("duration"); // wait for media source to ready mediaSource.addEventListener( "sourceopen", function (e) { try { videoSource = mediaSource.addSourceBuffer("video/mp4"); initVideo(initialization, file); } catch (e) { log("Exception calling addSourceBuffer for video", e); return; } }, false ); // init the video with first segment async function initVideo(range, url) { const segmentVideoBuffer = await fetch(url, { header: `Range: "bytes=${range}"`, }); B.appendBuffer(new Uint8Array(segmentVideoBuffer)); videoEl.addEventListener("timeupdate", playSegment); } // play all segment one by one if necessary function playSegment() { if (index < segments.length && videoEl.currentTime - lastTime >= segCheck) { const range = segments[index].getAttribute("mediaRange").toString(); segCheck = (timeToDownload(range) * 0.8).toFixed(3); const segmentVideoBuffer = await fetch(url, { header: `Range: "bytes=${range}"`, }); videoSource.appendBuffer(new Uint8Array(segmentVideoBuffer)); segCheck = (timeToDownload(range) * 0.8).toFixed(3); lastTime = videoElement.currentTime; } } // Helper function timeToDownload(range) { const [start, end] = range.split("-"); return ((end - start) * 8) / bandwidth; }
HLS Vs DASH, Which One To Pick?
The problem is 1.65 billion Apple devices in use today. We cannot stream a video encoded with MPEG-DASH on an iPhone, iPad, or Apple TV. On macOS the situation is a little tricky, Apple users cannot stream MPEG-DASH on Safari or any application that uses its Webkit engine for web view. However, users Google Chrome and Microsoft Edge on macOS can, but users prefer the default browser.
Moreover, most videos are unavailable in 4K HDR and not everybody has the device and bandwidth capable of handling 4K videos. Many streaming platforms prefer HLS for low quality streaming and only switch to MPEG-DASH for streaming content in 4K on non-Apple devices. Because that is what they have been doing for a long, long time.
It always better to have viable alternatives
Despite being controlled by Apple, HLS pioneered an ingenious method to video streaming employing existing web standards internet protocols. MPEG DASH improved on the method.
Video streaming over HTTP was a huge deal at a time when Flash was getting annoying every day. I don’t remember a time when I could play a Flash video on YouTube without updating Adobe’s plugin.
Whether Apple favored its devices while developing of HLS is still a matter of debate. H.265 was supposed to be the successor to H.264 until it wasn’t. MPEG DASH saved the day and become a mainstream streaming platform and the most viable alternative.
Nevertheless, without these incidents, DASH wouldn’t have grown in popularity and adoption to become a viable alternative to Apple’s proprietary streaming platform. Finally, we have a streaming method that is equally capable and loyalty-free. Competition is good regardless.
VdoCipher Encrypted DRM Infrastructure Details
- Upload of Videos (All common formats are supported )
The content can be uploaded through Dashboard or APIs. Upload from desktop, FTP, DropBox, Box, URL, Server all is supported. - Encryption & Transcoding for DRM streaming
Videos are converted into encrypted files, and multiple qualities & versions for ensuring delivery of quality content at all devices, browsers, and all connection speeds. The encrypted content is stored at our AWS S3 servers and raw videos are never exposed. We have set up our custom EC2 instances for the encoding pipeline, and the resultant files are hosted securely on AWS S3 servers. - Encrypted Video Streaming
As discussed above the high-security key and license exchange mechanism supports the transfer of encrypted video data, ensuring HLS DRM level security. Dynamic URLs ensure that each playback is authenticated and the URL cannot be extracted outside the website or app for pirated playback. We use multiple top tier CDNs – Cloudfront, Akamai, Google CDN, Verizon to ensure smooth delivery of content all across the globe - Decryption in Video Player & Watermarking
There is a private communication between our API & the client website. This ensures that its not possible for hackers to decrypt our streams. The One Time encryption that we use is theoretically and practically hack-proof. The website embedding the video content requests a One-time password from the VdoCipher web server using the API. This OTP request is made only after the user is authenticated. The VdoCipher API returns the OTP, which is used to render the embed code. This embed code is valid for a single playback session only. Along with the key a usage policy is specified, ensuring that only a logged-in and authenticated user is allowed to playback the encrypted video. The video would simply fail to play if an external plugin or downloader is used to try to access the video file.We have timely modifications to our licensing and authentication mechanism to keep security updated. - Watermarking -Video licensing and playback are combined to generate customisable viewer specific watermarks. The watermark can be IP address, Email ID and User ID shown in customisable colour & transparency to identify a playback session by the viewer.
- Result – Progressive High Secure Streaming
Through this 6-step Video Hosting, Encryption and Streaming process, VdoCipher, as a video hosting software, is able to provide a progressive high security video streaming with future buffer possible. This is also different from RTMP which does not maintain any buffer and can be quite erratic as a result.
You can find out more about DRM Solution here.
Final Thoughts
With DASH insight the future of video streaming looks better than ever. We expect the growing adoption of MPEG DASH will have a catalytic effect. The demand for 4K HDR content is at an all-time high. I don’t see any reason DASH will gain more streaming market share.
Supercharge Your Business with Videos
At VdoCipher we maintain the strongest content protection for videos. We also deliver the best viewer experience with brand friendly customisations. We'd love to hear from you, and help boost your video streaming business.
Head of Digital Marketing at Vdocipher. I love the art of connecting the right product to their users. When i’m not doing that i love getting lost in books.