---
title: "Video Without a Video Server: AWS Lambda, FFmpeg and HLS for a Learning Platform"
url: https://nayansukhadiya.in/blog/video-pipeline-aws-lambda-ffmpeg-hls
published: 2026-10-20T10:28:45.501+00:00
updated: 2026-11-07T16:11:12.640277+00:00
category: "Media & Digital Content"
tags: ["aws","lambda","ffmpeg","hls","video"]
---

# Video Without a Video Server: AWS Lambda, FFmpeg and HLS for a Learning Platform

> Upload an MP4, get a streamable lesson that remembers where each student stopped. A serverless Lambda + FFmpeg + HLS pipeline.

On a learning platform, video is the product. A lesson that buffers, restarts from zero every time, or waits for someone to convert it manually is a lesson students abandon. When I built the video side of an LMS at Brilworks, the brief came down to three things: lessons must start fast, students must pick up where they left off, and publishing a video must need no manual steps.

## The short answer

- **Stream with HLS, not a single MP4.** The video is cut into short segments plus a playlist, so playback starts after the first few seconds download and seeking jumps straight to the right segment.
- **Convert with AWS Lambda and FFmpeg.** An upload triggers a function that remuxes the video to H.264 in HLS form, writes the segments to S3 and records the playback URL.
- **Remember the position per student.** A custom player saves progress and resumes from it, across sessions.

> **The one idea behind it all** Do the expensive work once, when the video is uploaded, so every one of the thousands of plays afterwards is just a cheap file download.

## 1. Why HLS instead of one MP4 file

A single MP4 can play in the browser, but it has awkward edges: seeking far ahead can mean waiting for a large range download, and a weak connection stalls the whole file.

HTTP Live Streaming (HLS) splits a video into small segments, usually a few seconds each, and lists them in a `.m3u8` playlist. The player downloads the playlist, then fetches segments as it needs them. That gives:

- **Fast start:** playback begins once the first segments arrive.
- **Cheap seeking:** jump to minute 40 and the player requests the segment for minute 40.
- **Plain static hosting:** segments are ordinary files, so S3 can serve them without a media server.

Safari plays HLS natively; other browsers play it through Media Source Extensions with a JavaScript player library.

## 2. The pipeline: from upload to playable

```text
Upload MP4 ─▶ S3 (source bucket)
                │  object-created event
                ▼
          AWS Lambda + FFmpeg
          ├─ remux the video to H.264 in MPEG-TS segments
          ├─ write the .m3u8 playlist + segments
          ▼
       S3 (HLS output)  ─▶  playback URL saved on the lesson
```

1. **Upload.** The video goes to S3. Large files never pass through the API server.
1. **Trigger.** The new object fires a Lambda function. There is no queue to watch and no server to keep running between uploads.
1. **Remux and package.** FFmpeg reads the source and writes HLS: a playlist plus segments. Remuxing changes the container without re-encoding the pictures, which keeps it fast and the quality untouched.
1. **Store and publish.** Segments and playlist are written to S3, and the playback URL is saved on the lesson, ready for the player.

From the instructor's side, publishing a lesson is just uploading a file.

## 3. Remux vs re-encode: the important trade-off

There are two ways to make HLS from an MP4:

- **Re-encode:** decode every frame and compress it again. Slow and CPU-heavy, but it can produce several quality levels for adaptive streaming.
- **Remux:** copy the existing H.264 video stream into new segments. Very fast and lossless, but you get the quality the source already had.

For lesson recordings, remuxing was the right call: the sources were already H.264, the work fits comfortably in a Lambda function, and nothing is lost. The cost is that there's one quality level, not an adaptive ladder. If the platform later needs that, the same pipeline can add a re-encode step.

Lambda's limits shape this too: a function can run for at most 15 minutes and has bounded local disk, which suits fast remuxing far better than heavy multi-rendition encoding.

## 4. The player: resume where you stopped

A learning player has one job a movie player doesn't: respect the student's progress. The player I built:

- **Saves the position** as the student watches.
- **Resumes from the last position** when the lesson opens again, in a later session too, so nobody has to scrub to find their place.

It sounds small. In practice it is what makes a long course feel continuous instead of something you have to scrub through every time.

## The design decisions, side by side

| Decision | Why | Trade-off |
| --- | --- | --- |
| HLS segments over a single MP4 | Fast start, cheap seeking, static hosting | A packaging step before a video is playable |
| Lambda instead of a conversion server | Pay per upload, nothing idle, scales by itself | 15-minute limit and bounded disk per run |
| Remux, not re-encode | Fast and lossless for H.264 sources | One quality level, no adaptive ladder |
| Event-triggered pipeline | No manual steps between upload and publish | Failures need logging and a retry path |
| Saved playback progress | Resume works across sessions | Progress writes while the video plays |

## What I take from it

The best infrastructure for a feature is often the one that disappears. There's no video server to patch, scale or pay for at 3 a.m.; an upload does the work once, and S3 serves the result. The engineering went into the two moments students actually feel: how fast a lesson starts, and whether it remembers them.

## Sources

- [Apple: HTTP Live Streaming overview](https://developer.apple.com/streaming/)
- [RFC 8216: HTTP Live Streaming](https://www.rfc-editor.org/rfc/rfc8216)
- [FFmpeg: HLS muxer documentation](https://ffmpeg.org/ffmpeg-formats.html#hls-2)
- [AWS Lambda quotas](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html)

## Frequently asked questions

### Do you need a media server to stream HLS?

No. HLS is a playlist plus ordinary files, so any static host or object storage such as S3 can serve it, ideally behind a CDN.

### What is the difference between remuxing and transcoding?

Remuxing moves the existing video stream into a new container without changing the pictures. Transcoding decodes and re-compresses every frame, which is slower but can change quality or codec.

### Why does resume-from-last-position matter so much on a learning platform?

Courses are long and watched in many sittings. Without it, every session starts with scrubbing to find your place, which is exactly where students drop off.
