Event-Driven Streaming Video Processing Platform
An event-driven HLS pipeline on AWS that processes over 1,000 daily uploads with zero message loss.
- Stack
- AWS ECS
- ECR
- EC2
- SQS
- S3
- Python
Problem
Uploaded videos had to become streaming-ready HLS output reliably, and upload volume could jump well above normal without any upload being lost.
Approach
Each upload produces an event. SQS buffers the events and EC2 consumers pick them up, so processing runs asynchronously and a traffic spike queues work instead of dropping it. FFmpeg encoding runs in containers on ECS, and the HLS output is written to S3.
Key decisions and trade-offs
- A queue between upload and processing. SQS decouples the two, so a traffic spike lengthens the queue instead of overloading the encoders or losing an upload. The cost is that processing is asynchronous: a video is not streamable the moment it is uploaded, and the wait grows with queue depth.
- Two kinds of compute. EC2 consumers pull work from the queue, and FFmpeg encoding runs as containers on ECS. Containerizing the encoder cut processing time by 60%. The cost is operating two compute layers, each with its own images, permissions and scaling.
- HLS output in S3. Segmenting video into HLS leaves streaming-ready files in S3 that standard players can fetch directly, with no media server to run. The cost is encoding work up front, and many small files per video instead of one.
Results
- The pipeline processes over 1,000 uploads a day with zero message loss.
- It absorbed 10x traffic spikes with about 99% processing reliability.
- Containerizing FFmpeg on ECS cut processing time by 60%.