Hey everyone! I've been developing a video platform for about three months where users can upload videos that get encoded to HLS (with M3U8 playlists and segments) for on-demand streaming. It's sort of a simplified alternative to YouTube; users upload their videos, get a shareable link or iframe, and earn money based on views.
Currently, everything operates on a single server that handles the frontend, backend, database, and video encoding using FFmpeg. However, as user traffic increases or multiple uploads occur simultaneously, the server struggles to keep up. Since encoding is CPU-intensive, trying to manage uploads, database requests, and processing all on one machine isn't going to work as we grow. Clearly, we need to transition to multiple servers.
My current process is as follows: a user uploads a video, the server encodes it to HLS, those files are stored on Cloudflare R2, and then the app streams the HLS content to the user's dashboard or player.
What I'm aiming for is a solution that allows a seamless handling of this setup. I'm not looking for a complicated system where files are constantly moving between servers, leading to increased operations costs. The simplest solution I envision is to have one main server for the frontend, backend, database, and user logic, and dedicate another server or servers specifically for video encoding and HLS generation, potentially pushing the results directly to R2.
If anyone has experience with similar implementations, I'd love to hear your thoughts or suggestions!
2 Answers
Have you considered using AWS Lambda for your encoding tasks? It can scale well and handle spikes in traffic without overwhelming a single server. Just be aware of limitations, especially around handling copyrighted content, since that could become an issue with uploads.
Another option might be to use dedicated encoding services like Zencoder or Bitmovin. They can handle the heavy lifting of encoding for you, so your servers can focus on other tasks. This could save you hassle, especially if you plan to grow quickly!

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically