A Low Cost On Demand Video Streaming Architecture
Software Architecture #Laravel# Digital Ocean# MPEG Dash

Introduction

While COVID-19 became set back for many companies, it also brought new opportunities for certain industries. OTT and Video On Demand platforms are one of them. Schools, Colleges, Institutions started looking for an option to have something for the students to let them continue the studies while being at home in this pandemic.

While Working on a client project at TheCodework, Architecting Video On Demand platform was coming out to be very costly comparing Video On Demand by AWS. Although, using AWS is a very effective solution with greater performance but, that too comes with a price for each of the services. We rather choose Digital Ocean instead of with its Block Storage Volumes to store our video files. I must say it isn't a bad solution comparing the reduced monthly cost.

Architecture

The architecture of the project was quite simple with no complexity at all. We were using Laravel application for the backend Admin and APIs with Queues handled by Redis, SQL Database, and 4 Core CPU Server.

To stream videos on Mobile Devices or on the Web portals, Dynamic Adaptive Streaming over HTTP (DASH) which is a bitrate streaming technique and being popular these days. The popular ones are MPEG Dash and Apple's HLV.

Video Transcoding

When the admin uploads a video, we let Redis Queue process the video transcoding on the server. We restricted the admin to provide MPEG-4 video for the upload, and then the Queue would handle the transcoding and creates the Streamable MPEG Dash Video file. We used Laravel Wrapper to interact with the installed MPEG Dash binary and start the process.

Mounting the Digital Ocean Volumes

Digital Oceans servers come with optimal storage but, to store MPEG Dash files we needed more storage that. So we decided to go with Digital Ocean Volumes that easily get mounted to the Droplet. Additionally, we can increase the size of the volume anytime we need so it is quite flexible to use.

[IMPORTANT]
While creating volumes on the Digital Ocean, please make sure you do not automatically mount it to the droplet rather, select the Manually Format * Mount option while creating Volume. Digital Ocean Create Volume To find about mounting, you can refer to https://www.digitalocean.com/docs/volumes/how-to/mount/ blog of Digital Ocean and mount it to your storage folder.

If you are seeking for guidance, please tweet me!

around a minute read 24th Feb 2021

About

A entrepreneur, running an early stage venture, VizitDoc and a MVP-First Service Based Companay ThecodeWork.

A dreamer, having care for alternative education.

Archives - 1

  • Code

    20 Articles

    List of code snippet and articles I wrote when I started blogging in early 2016 😃

Codementor badge