VideoFlowcodeGitHubStudioTry itCoreRenderersReact Video EditorPlaygroundExamplesDocscodeGitHubStudioTry it
← Back to Blog

Serverless Video: Rendering MP4s in AWS Lambda Without FFmpeg

September 19, 2026 · By VideoFlowLearn how to build a serverless video pipeline on AWS Lambda using VideoFlow. Generate professional MP4s from JSON without the headache of FFmpeg layers.Serverless Video: Rendering MP4s in AWS Lambda Without FFmpeg

Serverless Video: Rendering MP4s in AWS Lambda Without FFmpeg

If you have ever tried to run a video rendering pipeline on AWS Lambda, you have likely hit "the wall." Usually, that wall is built out of custom FFmpeg layers, massive deployment packages, and the fragile complexity of stringing together shell commands inside a stateless function. Managing binaries in a serverless environment is often more work than building the actual video product.

But what if you could treat video rendering like any other piece of modern web infrastructure? What if your video was just a portable JSON document, and your renderer was a headless browser that didn't require a single FFmpeg flag to produce a high-quality MP4?

In this guide, we will walk through building a serverless video factory using VideoFlow. We’ll show you how to generate professional videos from code on AWS Lambda, leveraging the power of WebCodecs to bypass the need for traditional media binaries entirely.

A technical diagram showing a JSON document flowing into a serverless cloud icon and transforming into a video play button

The Architecture of Serverless Video

Traditional video automation relies on FFmpeg, which is essentially a massive, monolithic C library. Getting it to run reliably on AWS Lambda requires juggling shared libraries and staying under the 250MB unzipped limit. It’s a battle against the environment.

VideoFlow changes the game by using a VideoJSON architecture. Instead of defining a video as a sequence of opaque commands, you define it as a structured data object. When it comes time to render, VideoFlow uses a headless browser (via Playwright) to composite the frames.

Because modern browsers now support WebCodecs, the browser itself can encode the H.264 video and AAC audio. This means the @videoflow/renderer-server can produce a final MP4 file or buffer without ever calling a sub-process. In a Lambda environment, this translates to smaller deployment packages, faster cold starts, and a much simpler developer experience.

Setting Up Your Lambda Function

To get started, you'll need to install the core builder and the server-side renderer. Note that while FFmpeg is usually the default for video, it is entirely optional here.

npm install @videoflow/core @videoflow/renderer-server

For the Lambda environment, you will typically use a package like playwright-aws-lambda or a similar layer that provides a Chromium binary optimized for serverless. This ensures that the headless browser needed by the renderer is available in the constrained Lambda environment.

Building and Rendering in 20 Lines

The magic of VideoFlow is the fluent builder API. You don't need to calculate frame offsets or manage complex timelines manually. You describe the flow, and the toolkit handles the math.

Here is a complete example of a function that generates a personalized welcome video and returns it as a buffer—perfect for an API Gateway endpoint or an S3 upload.

import VideoFlow from '@videoflow/core';
import ServerRenderer from '@videoflow/renderer-server';

export const handler = async (event) => {
  const { userName } = JSON.parse(event.body);

  // 1. Initialize the project
  const $ = new VideoFlow({ width: 1280, height: 720, fps: 30 });

  // 2. Compose the scene
  const bg = $.addShape({ 
    width: 100, height: 100, 
    fill: '#1a1a1a' 
  }, { shapeType: 'rectangle' });

  const title = $.addText({
    text: `Welcome, ${userName}!`,
    fontSize: 8,
    color: '#FF5A1F',
    position: [0.5, 0.5],
  });

  // 3. Add some motion
  title.fadeIn('800ms');
  $.wait('3s');
  title.fadeOut('500ms');

  // 4. Compile and Render to a Buffer
  const json = await $.compile();
  const buffer = await ServerRenderer.render(json, { 
    outputType: 'buffer', 
    verbose: true 
  });

  return {
    statusCode: 200,
    headers: { 'Content-Type': 'video/mp4' },
    body: buffer.toString('base64'),
    isBase64Encoded: true,
  };
};

In this snippet, we use $.addText and $.addShape to create a simple scene. The .fadeIn() and .fadeOut() methods automatically advance the internal flow timer, making it trivial to sequence elements. You can experiment with these patterns live in the VideoFlow Playground.

An abstract representation of a clean video timeline being assembled from modular blocks

How VideoFlow Handles the Heavy Lifting

You might be wondering: how does a browser produce a professional MP4 without FFmpeg? The secret lies in the @videoflow/renderer-server pipeline.

When you call ServerRenderer.render, VideoFlow launches a headless Chromium instance. It then uses the same rendering engine that powers our in-browser export. Layers are rasterized, GLSL effects (like bloom or vhsDistortion) are applied via WebGL, and the result is fed into an internal muxer called MediaBunny.

This "Browser-in-a-Box" approach has several advantages for serverless:

  1. Identical Output: The video you see in the Live Preview is byte-for-byte identical to what the Lambda produces.
  2. No Native Binaries: You are running standard Node.js and Chromium. No need to compile custom C++ add-ons or manage Linux-specific FFmpeg builds.
  3. GPU Acceleration: Even in headless mode, Chromium can often leverage software-based WebGL to render complex effects and transitions faster than a CPU-bound FFmpeg filter graph.

Why Not Just Use FFmpeg?

FFmpeg is a legendary tool, but it wasn't built for the era of "Video as Code." As we discussed in our VideoFlow vs FFmpeg comparison, FFmpeg requires you to learn a specialized, string-based DSL (Filter Graphs) that is notoriously difficult to debug and even harder to generate dynamically from an LLM or a web form.

VideoFlow provides a typed, developer-friendly abstraction. If you're coming from other programmatic video tools, you might find it a refreshing alternative to Remotion, specifically because VideoFlow's core and renderers are fully Apache-2.0 open source, and they don't require a React runtime to function.

Conclusion

Building video automation shouldn't feel like a systems engineering project. By moving the rendering logic into the browser and using JSON as the intermediate format, VideoFlow makes serverless video rendering accessible to any TypeScript developer.

Whether you are building a personalized onboarding flow, an automated social media factory, or an AI agent that communicates through video, the combination of AWS Lambda and VideoFlow is the most efficient way to scale.

Ready to build your first serverless video? Check out the Getting Started guide or dive into the source code on GitHub.

VideoFlow

Open-source toolkit for composing videos from code.

Product

CoreRenderersReact Video EditorPlaygroundStudio

Learn

DocsAPI referenceExamplesvs. Remotionvs. FFmpeg

Project

GitHubLicenseContactTermsPrivacy

From the blog

All posts →Building a "Canva for Video" with the @videoflow/react-video-editorCinematic JSON: Mastering GLSL Effects in VideoFlowHeadless Video Rendering in Node.js: Why You Don't Need FFmpegServerless Video: Rendering MP4s in AWS Lambda Without FFmpegAutomating Social Media Captions: A Developer's Guide to Frame-Perfect SubtitlesBeyond Node: How to Render Cinematic Videos from Python and GoBuilding a Video Rendering API with Node.js and VideoFlow (No FFmpeg Required)Mastering Programmatic Video Transitions: A Developer's Guide
© 2026 VideoFlow. Apache-2.0 core.