Tutorials · 7 min read

Should I build my video infrastructure from scratch? Challenge accepted

You've decided to integrate a video feature into your app or create a video infrastructure on your own. Let's see what is needed and what are the challenges in order to get to the finish line.

Artem Matinian

May 17, 2023

It’s natural that one will think about integrating videos into their project. There are so many use cases for a video that we cannot even start to count. From user-generated content like Youtube, TikTok, Instagram, and the likes, through e-learning apps, personal trainers, e-shopping, and the list goes on and on, there’s no limit to what you can do with moving images that zoom across the fiber optics as digital signals from one place to another.

 

Is there are catch, though? How easy is it to implement videos into your project, app, or website? In this article, we will look at the options, challenges, and solutions for getting video infrastructure up and running.

The Casual Cloud Vendor ☁️

Probably, the first thought of every developer (with a mainstream line of thinking) is AWS. It comes naturally, as most of the existing infrastructure is probably set up on AWS, Azure, or the like. Who can blame you? it’s convenient, easily scalable, and…. can get quite expensive. Not only that, it might be difficult to implement as well; think about:

 

  • Having DevOps that specialize not only in AWS but also in the video area
  • If you don’t have such a team, then you’ll need to hire people for that.
  • Time-consuming setup
  • High price
Funny image about saving costs

Here’s the implementation list of all the different services to deploy and setup to have video-on-demand with AWS:

AWS requirements

That’s not all; you’ll also have to build the client that uploads the videos yourself and plus all of the front-end. You can already understand the costs and time involved with this project.

 

“Alright”, you say, now what? isn’t it better to just build the whole architecture myself? what’s the point of using AWS if it’s costly, complex, and resource intensive?

##The DIY solution 🛠️

Let’s go with this simple idea. You want to create an upload button where users upload their videos to your app or website. You already have quite a few users and you know that the feature will be adopted quite quickly, right?

 

The minimum requirements are:

 

  • Rent a server for $120/month (i.e Cloudflare, DigitalOcean and the likes) with the following available resources (vCPU: 4, 16GB of memory, 250GB HDD)
  • Install a web server like Apache, Nginx
  • Create a hosting logic on your server
  • Find a third-party video player
  • Create your application and add an upload button to allow your users to send their videos created with their last smartphone model.
  • Allow the user to play their videos freshly uploaded with the video player
  • Deploy your application on the server

 

It does sound easier than AWS, right? why is the AWS solution so complex? why all of these services?

 

You launch the service, and it seems to run smoothly for a few hours, and then you start to get some emails from customers, like:  

MichaelScott777 says:

💡 My playback is really choppy, and it takes forever for the video to load! why are you so slow (that’s what she said 😀)

TheShrute909 exclaims:

💡  Why is the video is so slow?!?!?!??!!?!? it takes the video 5 hours to show! help!!1

 

Your users are calling out that the playback experience is poor. There is a lot of buffering before the video starts to play.

 

So you start Googling around, and you discover that you can’t just upload the video; you need to encode it with different qualities, plus if you want to stream the videos, you also need to implement some specific protocols, and you start going down the rabbit hole: HLS, DASH, H.264, HEVC, AV1 and etc. “WHAT THE HELL IS ALL OF THIS?” you ask.

 

Then you stumble upon something that seems like salvation: FFmpeg! a video processing “Swiss knife” you hail in victory and pound yourself on the chest. You’ve made it. After several weeks of sleepless nights and 59.7 coffee cups later, it’s installed, it’s running, and magically does the job (you don’t really understand how completely, but it works).

Funny image with a malfunctioning car

Everything seems to run smoothly, but you are afraid to touch anything as you focus on your main product, and if you start messing around with the video monster again, you might sink more time into it. But then your users start to ask for more features around video:

 

CryptoKing001 is asking for this feature:

💡 Heellooo!, how can I know how many people watched my videos? <3 <3 <3

You grab your head in fear, and the anxiety builds up. You can’t sink in more resources into that video thing, and that 3rd party video player I’ve used doesn’t provide analytics (!!!!). So, you decide to outsource the whole thing, although you did have a limited budget setup for this project, so you go over budget.

 

The app seems to be running fine for a few weeks, and many users upload their videos daily. You check your monitors and discover that you are running out of disk space! the product is minutes from being down because of all of this video thing; eventually, it goes down, and you generate some bs message to your users about vertical scalability that they have no idea what you are talking about. Eventually, you rent more servers and add more disk space; the product is up again, but, again, you are way over budget already with that analytics stuff; now you have to pay more for space (argh!). At least you’ve evaded a disaster, but you get a new complaint:

 

obee1kanobeeeeeeeeeeeee writes:

💡 why the videos don’t play after I upload them???? I have to wait for 5 minutes before it plays. MY VIEWERS ARE COMPLAINING!!! FIX IT!!!

Your head is already missing half of the hair it used to have before you started the project, and now this?!

 

You start investigating and find out that you have 100% CPU utilization on the video server; remember that magical salvation that you installed on the server: FFmpeg? now it gobbles up most of the CPU to encode the videos. So, you write another bs message to your users about encoding and some stuff you don’t even know about (and your users don’t even care), and you start sinking more money into the project. You buy more CPU and start scaling again.

 

Few months past. You don’t need to buy shampoo anymore (at least that’s a good thing, you can save some money), most of your attention has shifted into scaling these wretched video servers, you are now an expert in video encoding and delivery, but you are losing users as they have no interest in your product, as all of your investment and resources went into this video project black hole. You’ve hired more engineers that are dedicated to doing the video project, and the budget for the video project already went out of control a long time ago.

Meme about kungfu

You look back and think, how did I end up here? what could I have done better? would it be better to go with AWS? or maybe there are other solutions I could have considered?

The Perfect Solution

Like with any other service, reinventing the wheel would probably lead to huge financial implications, but as we’ve seen AWS is not perfect as well. However, there are APIs that can solve this problem by providing you with a scalable and easy-to-use service, like api.video.

 

  • With api.video creating an upload scenario and even more is a matter of minutes.
  • api.video has a far lower cost than AWS (check the cost calculator here) or DIY
  • api.video has a strong infrastructure that is scalable and reliable
  • api.video gives you the ability to select the storage location of yoru videos in the US or in the EU. This will ensure that your video content adheres to all relevant legal standards for you or your customers.

 

Check out the get started guide to get started in 5 minutes or create a sandbox account for free to explore api.video on your own!

Try out more than 80 features for free

Access all the features for as long as you need.
No commitment or credit card required

Video API, simplified

Fully customizable API to manage everything video. From encoding to delivery, in minutes.

Built for Speed

The fastest video encoding platform. Serve your users globally with 140+ points of presence. 

Let end-users upload videos

Finally, an API that allows your end-users to upload videos and start live streams in a few clicks.

Affordable

Volume discounts and usage-based pricing to ensure you don’t exceed your budget.