Netflix is a very popular streaming service that allows people to watch a wide variety of video content. If you want to build a service similar to Netflix then you need to have solutions for the three most difficult problems you are gonna face.

  1. How do I acquire content?
  2. How do I build a platform to deliver this content?
  3. How do I scale this platform and service?

The first problem is something you need to figure out yourself. Either you need to buy rights for the content and deliver it on your website or create your own original content which is what most of the streaming services are currently doing. Both are expensive options but I will just assume that you figured out a way to acquire content that you think people wanna watch. This problem is non-technical and hence I will just answer any queries you have in comments on this particular aspect.

This article is primarily gonna focus on the second problem.

Before we dive into the article, I would like to inform the readers that this article is for those who have a basic idea of Web development and Cloud computing. Take a look at Netflix’s tech stack If you don’t have these skills, don’t worry just ensure you have sufficient knowledge before you start building the product. Be sure to note that, in order to make this work you will need a dedicated tech team with skills in diverse fields. I am giving you guys a solution which is as tech-stack independent as possible.

Enough is enough, let’s get started. I am gonna divide the whole setup into 2 parts.,

  1. Creating a website to access the video content.
  2. A serverless configuration for video processing.

Creating a website to access the video content:

The Simplest architecture for the website could be something like this.,

Website Architecture

  1. Login Page: This page will be used for registering users into your platform. Additionally, you can collect payment details needed. Netflix is a subscription-based service. Hence you would require a payment service integration like Stripe. You can also collect user preferences if your content is diverse. You can map your content to specific topics and show the list of topics to the users and ask them to choose at least 3 during the registration process.
  2. Series Page: This page will contain the list of Series or Movies. In this page, you can add a ton features like, ability to add bookmarks or showing the content based on user preferences. Keep this page as clean as possible. Show thumbnails for Movies or Series. Ensure that this page can also be viewed without registration in case you want to expose your content to the world. This will give organic traffic if you do your SEO properly.
  3. Episodes Page: This page is optional. If it’s a movie, this page wouldn’t exist and hence you can take users directly to the content page. This page contains a list of episodes if it’s a Series. You can cluster the episodes according to their seasons.
  4. Content Page: This page will contain a video player. This is the most important page as the user experience in this page will determine the retention. You can use a native HTML5 player but in order to provide features like Adaptive bitrate streaming, we will use Shaka Player in this article.

Now, what is Adaptive bitrate streaming?

Adaptive bitrate streaming works by detecting a user’s bandwidth and CPU capacity in real time and adjusting the quality of the media stream accordingly. To know more about it check out this link. This will ensure at any point in time, viewer’s don’t end up seeing the video buffer.

There are primarily 2 video formats which follow this technology. They are HLS and DASH. HLS (HTTP Live Streaming) is Apple’s proprietary format. This format works natively in Safari browser. If you watched any of Apple’s live events or keynotes on safari, this is the format in which the video was delivered. To know more check out this link. DASH (Dynamic Adaptive Streaming over HTTP) also known as MPEG-DASH is developed under MPEG. DASH is not natively supported by any browser yet but Google created Shaka Player which can play Adaptive media formats like DASH or HLS. You need to take a call on which format you want your video to be. People often choose HLS over DASH. Any Android, iOS, Windows, Mac, Linux, Chrome OS, or other modern devices should support HLS. This includes smart TVs, game consoles, and set-top boxes. However, MPEG-DASH is not supported on the Safari browser. Given that most iPhone, iPad, AppleTV, and macOS users stick with the default Safari browser, this is a major downside for MPEG-DASH. Know more about this here. In this article, we will be using Shaka Player. You can acquire the code for shaka player in this GitHub repo.

Okay, now you have a basics idea on how the latest content consumption formats work. But how do you must be pondering with one question? How do you create a DASH or HLS?
Well, the answer is simple. You need Media encoder software. Media Transcoding is not a simple process. Basically, the raw video is taken and encoded into multiple videos with various resolutions and bitrates. A map of these videos is stored as a playlist in the m3u8 file in case of HLS or mpd file in case of DASH.

media-workloads-on-aws-13-638.jpg

Media transcoding is a complex process which requires enormous CPU and GPU if the content is heavy. It’s highly recommended to use Cloud services such as AWS’s Elastic Transcoder or Akami AMD or Wowza Streaming service.

Having an adaptive media content is not enough. You need to have a good CDN in order to deliver content smoothly. A content delivery network (CDN) is a system of distributed servers (network) that deliver pages and other Web content to a user, based on the geographic locations of the user, the origin of the webpage and the content delivery server.

CDNs basically cache the content in the server which is nearest to your location and so content is delivered much faster compared to accessing it from the actual source. The same media transcoding service providers also provide CDNs. In the case of  Amazon, it’s CloudFront.

This article is written keeping in perspective that your product is just going to be a website. But you will definitely need an app for both Android and iOS. You also need to integrate your product deep into your customer’s entertainment systems like Smart TVs and Gaming consoles like PlayStation and Xbox.

Scaling a product is necessary, but not easy. I will just list down a few challenges you are gonna face and it’s up to you and your tech teach to figure out.

  • How to deliver content to the viewers smoothly without any interruptions?
  • How to scale the servers with the increasing load of traffic?
  • How to deliver higher resolution content at low bandwidth internet?

Let me know in the comments below if you want help with any of the above challenges or any challenge you are currently facing.