Building Myntra’s Video Platform: Part 1

This article is the first in the series on ‘Building Myntra’s Video Platform’

The way people consume content globally is changing rapidly. Gone are the days when people were content with just images. People have graduated from images to long videos to short videos to GIFs. The easy access to the internet via 4G enabled by low data cost have made video consumption not a luxury but a necessity. Upcoming technologies such as 5G which are on the way will further propel this behavior. Internet-first companies like Netflix, Instagram, TikTok and Youtube’s success primarily rides on their cutting-edge video features.

As per Youtube ‘s survey“1 in 2 Gen Zers and millennials say “they don’t know how they’d get through life” without video.”

Other interesting insights available: https://www.thinkwithgoogle.com/feature/youtube-video-data-watching-habits/

Touching upon this in more detail is the the new Ericsson Mobility Report published by Ericsson in November 2021 that states:

  • The average traffic per smartphone in the India region is the second-highest globally at 18.4GB per month and is projected to grow to around 50GB per month in 2027
  • An increase in average data volume per subscription will be fuelled primarily by more viewing of video content.
  • 5G will account for 39% of all mobile subscriptions in India by 2027.
  • In one of the studies by Ericsson and FET it was observed that people in Taiwan are moving from 4G to 5G and one of the main contributions to the high data usage is video streaming services.

Social media is thriving with influencers sharing videos daily on popular platforms. Even Celebrities and personalities have hopped onto this bandwagon and are holdingLivestreams to increase engagement with their audiences.

People are moving away from traditional cable networks and are steadily making internet streaming based video consumption a habit.As a pioneer and frontrunner in influencer-led content, Myntra strategically decided to ramp up its video capabilities a few years ago to engage consumers more effectively.

Leveraging the talent of the best-in-class product and tech teams at Myntra, the proprietary technology was built in-house. The system created for handling the Video On Demand (VOD) and Live stream use cases is called Matrix.

We also forayed into Live Streaming late last year with the launch of M-live. This feature allows users to watch livestreams on fashion and beauty of the most sought-after influencers on the Myntra App.

mLive Screenshot

Why did we want to build it ourselves?

  • Better control over the entire UX
  • Give our users best of performance
  • Reduce the cost of running live streams which would only keep on increasing as we keep on scaling up.
  • Finally, we believed we possessed the capabilities, talent and prowess to pull it off :)

Let’s get started

Types of streaming

There are two types of streaming techniques namely Progressive Streaming and Adaptive Bitrate Streaming. Progressive Streaming was in vogue initially and was later replaced by the efficient Adaptive Bitrate Streaming (ABR). ABR offers a host of advantages in comparison to Progressive Streaming.

Progressive Streaming

In the early days of the internet, video files like mp4 etc were directly served over the internet. This was called as Progressive Video Streaming. One single file was served across Desktop, Laptop, Tablets and Mobile devices.

Progressive Streaming

The main issues with this were

  • For large screens the video was rather small
  • In case network wasn’t fast enough, especially for Mobile devices video was likely to occasionally stall and buffer
  • A single file meant compromise between quality or experience

Adaptive Bitrate Streaming

Adaptive Bitrate Streaming (ABR) was meant to solve all these issues Progressive Streaming couldn’t. ABR doesn’t follow the one size fits all approach, instead provides different video qualities based on the screen size of the device being used and network quality. Also one single device is not tied to one specific configuration and can rather move between the different video qualities based on the network conditions. This allows seamless and continuous playback.

Adaptive Bitrate Streaming (ABR)

So if someone were traveling and the network quality changed, the video quality would change accordingly. Lower quality will be picked in case of low internet quality and higher quality will be picked if network quality improves.

Daseddon, CC BY-SA 3.0 <https://creativecommons.org/licenses/by-sa/3.0>, via Wikimedia Commons

Streaming Protocols

Macromedia developed RTMP (Real-Time Messaging Protocol) in the mid-2000s. Designed for streaming both audio and video, many know this protocol simply as Flash. Macromedia later merged with Adobe, which now develops RTMP as a semi-open standard.

For much of the past decade, RTMP was the default video streaming method on the internet. But with the recent rise of HLS, we’ve seen a decline in the usage of RTMP. Even today, most streaming video hosting services work with RTMP ingestion. In other words, broadcasters deliver their streams to their chosen online video platform in RTMP stream format. Then, the OVP usually delivers those streams to viewers via HLS.

RTSP (Real-Time Streaming Protocol)

Like RTMP, RTSP/RTP describes a stateful protocol used for video contribution as opposed to multi-device delivery. The latencies are pretty less around 2 seconds however it is not optimized for the experience.

Android and iOS devices don’t have RTSP compatible players out of the box, which makes its adoption even lesser.

Adobe HDS (HTTP Dynamic Streaming)

HDS was made by Adobe. It is an ABR based tech and was made to work with Flash players. Since Flash Player in itself is deprecated, it is no longer being used.

Microsoft Smooth Streaming

Microsoft Smooth Streaming (MSS), is Microsoft’s version of a live streaming protocol. Smooth Streaming also uses the adaptive bitrate approach, delivering the best quality available at any given time.

First introduced in 2008, MSS was one of the first adaptive bitrate methods to hit the public realm. One of the MSS reasons for gaining popularity is that the 2008 Summer Olympics were broadcasted by Microsoft using this very platform. The most widely-used MSS platform today is the Xbox One. However, MSS is one of the less popular streaming protocols available today.

Apple HLS (HTTP Live Streaming)

HLS has been there since 2009 and has gone through multiple versions. HLS is the most popular tech in Adaptive Streaming.

MPEG-DASH (Moving Picture Expert Group Dynamic Adaptive Streaming over HTTP)

Similar to HLS, Strong push by MPEG group. Lacks iOS support due to Apple snubbing it.

WebRTC

WebRTC is great for two way communication but suffers from serious issues when trying to scale across a few hundred. Going into thousands of clients is a huge problem because of the WebRTC design. More on that in later sections.

Criteria for choosing a protocol

The criteria for choosing one or more protocols depends on a bunch of parameters.

User Experience and Reliability

All the research is of no use if the primary criteria of providing a good user experience fails. Progressive Streaming techniques such as RTMP and RTSP tend to fail here. ABR based technologies are to be picked up so that we can give a good experience to users irrespective of their consumption platform and their device or network state.

Codecs supported

A protocol is nothing if it doesn’t support popular codecs. A protocol defines a way the video or audio can be shared t. The actual multimedia content needs to be encoded using these codecs and sent. The most popular codecs these days are H264, H265, VP8 & VP9. Apart from these fresh entrants like AV1, VVC and newly announced MPEG-5 EVC, and LCEVC are promising even though they lack hardware decoder support. So if a protocol doesn’t support one or more codecs from the popular ones it clearly can’t be used.

Support on different platforms

A protocol needs to be supported on all popular platforms i.e Android, iOS, Web. If a protocol is married to a platform and doesn’t offer good support on any other platform then it doesn’t stand a chance to scale holistically.

Support by CDN partners

CDNs are the ones which serve multimedia content to the users. They scale well and the protocol needs to be supported by major CDN players out there.

Latencies supported

Most of the ABR technologies introduce a lot of delay in the live stream. For some of the use cases the delay may not be very important, however we should always have an option to provide a low latency live stream, if possible.

Security & DRM support

Should offer security mechanisms like AES etc along with DRM support.. Since Myntra may partner with external content providers it is likely that we must be able to support the popular DRMs. The support for DRM may be mandated for the partnership to happen.

Cost

The cost to run a live stream needs to be reasonable.

Considering all these aspects the 2 Protocols which work really well across all these parameters are HLS & DASH

HLS & DASH

  • Both are ABR based and offer good experience

  • Support major codecs

  • HLS supports Video Codecs: H264, H265

  • DASH is codec agnostic, supports all major codecs

  • Supported by all major CDN providers

  • Both normal and low latency is supported

  • Security & DRM support

  • Both support encryption

  • HLS supports Fairplay

  • DASH supports Widevine, players lack Fairplay support currently

  • Cost: Both are reasonable cost wise

  • The major difference lies in the fact that HLS enjoys more support than DASH.

  • HLS has native / out of the box support on iOS devices.

  • On Android and web too, players play the content fine.

  • DASH is not supported on iOS which is a big bummer.

  • On Android and Web, players play it fine.

  • DASH has better codec support than HLS

  • H264 is free but H265 which offers more compression is free until 100k devices post which royalty has to be paid. Most people stick to H264

  • DASH uses VP8 and VP9 popular codecs by Google. VP9 the counterpart to H265 is free to use.

HLS enjoys wider adoption because of support on all 3 platforms . Some OTT platforms provide both HLS and DASH to support wider reach and give better video compression through DASH and VP9 on supported platforms. It is expected that AV1 or VVC may be supported in HLS. We do not have confirmation yet.

Source : Wowza https://www.wowza.com/wp-content/uploads/Streaming-Formats-Currently-Used_Q8.png

HLS & DASH concepts

Let’s cover the basic concepts of both these protocols:

The initial versions of HLS supported only MPEG-2 TS containers. From 2016 Apple started to support fragmented mp4 (fMP4). DASH relies on fMP4.

There are 3 main constructs : Master Playlist, Media Playlists and Media Segments

HLS

Media segments

The input video stream is broken into smaller video segments. These small segments can be individually played too. These segments are delivered to clients. Another approach that exists revolves around having just one single file and defining the byte ranges of this file as the segments. The former approach with Ts and fMP4 is more popular and has better support than the latter.

The #EXT-INF attribute in the media playlist conveys the duration of the content in the segment. Segment sizes contribute to latency. More on that in the subsequent sections. Apple ‘s recommendation for segment size has changed over the years from 10 seconds to 8 seconds and finally 6 seconds currently.

Master Playlist

The master playlist file is like a registry that tells the client-side player to pick one variant of the content based on multiple parameters such as video size, and recommended network quality etc. The entry contains pointers to another Playlist file known as Media Playlist.

In HLS these playlist files are called M3U/M3U8 manifest files while on DASH they are present as MPD files. They also contain multiple variations based on audio language tracks or subtitles.

Master Playlist

The first playlist entry in the Master Playlist is considered as the default playlist to be picked at the start of the playback. Generally, the first entry is kept as the playlist with the lowest bitrate. This is done to reduce load time.

Media Playlist

These files as mentioned earlier are referenced from Master Playlist. Each rendition has its own Media Playlist. These Media Playlist files often contain entries of files in sequential order. The entries usually mention the duration of the files.

Media Playlist

That concludes Part 1 of the series. In the next article we will talk about different topics around VOD, Live, encoders etc.

We hope you enjoyed reading this article. We would love to hear your thoughts and suggestions in the comments.

首页 - Wiki
Copyright © 2011-2024 iteam. Current version is 2.137.1. UTC+08:00, 2024-11-24 23:05
浙ICP备14020137号-1 $访客地图$