VideoFlowcodeGitHubStudioTry itCoreRenderersReact Video EditorPlaygroundExamplesDocscodeGitHubStudioTry it
← Back to Blog

Headless Video Rendering: Generating MP4s on Node.js without FFmpeg

October 3, 2026 · By VideoFlowLearn how to build a headless video rendering pipeline in Node.js using @videoflow/renderer-server. Generate MP4s from code without the FFmpeg headache.Headless Video Rendering: Generating MP4s on Node.js without FFmpeg

Headless Video Rendering: Generating MP4s on Node.js without FFmpeg

For a long time, if you wanted to generate a video from code, your only choice was to wrap FFmpeg in a shell script. You'd spend hours concatenating complex filter strings, managing binary dependencies on your server, and praying that the output looked the same locally as it did in production.

But the web has changed. With the advent of WebCodecs and highly optimized headless browsers, we no longer need to rely on the "black box" of FFmpeg for every video task.

In this guide, we'll explore how to build a modern, headless video rendering pipeline using Node.js and VideoFlow, the open-source toolkit that turns JSON into cinematic MP4s.

The Problem with the "FFmpeg Wrapper" Pattern

FFmpeg is a masterpiece of engineering, but it wasn't designed for the modern web developer. When you use it to automate video creation—like generating personalized onboarding videos or social media clips—you hit several walls:

  1. Binary Management: Your server environment needs the exact right version of FFmpeg installed. Scaling this in serverless environments or Docker containers is a known headache.
  2. Lack of Portability: An FFmpeg command is a string. It's hard to test, hard to version control, and impossible to "preview" in a browser before you hit render.
  3. The "Black Box" Effect: Debugging why a specific frame looks wrong inside a complex filter chain is nearly impossible.

Enter @videoflow/renderer-server

VideoFlow takes a different approach. Instead of generating a list of commands for a video encoder, you describe your video as a portable VideoJSON document. This document can then be rendered identically by any of the three official renderers.

A technical-diagram illustration showing a JSON document icon on the left transforming through a glowing pipeline into a cinematic video frame.

The powerhouse for backend automation is @videoflow/renderer-server. It uses headless Chromium (via Playwright) to execute the render. By default, it uses the WebCodecs API inside the browser to encode the video. This means you get frame-perfect, hardware-accelerated rendering without ever installing FFmpeg on your host machine.

Building Your Headless Pipeline

Let's look at how simple it is to generate an MP4 from a Node.js script.

First, install the core library and the server renderer:

npm install @videoflow/core @videoflow/renderer-server
npx playwright install chromium

Now, you can define your video using the fluent builder API and trigger a render:

import VideoFlow from '@videoflow/core';
import '@videoflow/renderer-server'; // Registers the Node renderer

async function generateVideo() {
  const $ = new VideoFlow({ width: 1080, height: 1920, fps: 30 });

  // Add a background image
  $.addImage(
    { fit: 'cover' },
    { source: 'https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe' }
  );

  // Add a title with a cinematic transition
  const title = $.addText(
    {
      text: 'HEADLESS RENDER',
      fontSize: 8,
      color: '#FF5A1F',
      fontWeight: 800,
      position: [0.5, 0.4]
    },
    {
      transitionIn: { transition: 'blurResolve', duration: '800ms' }
    }
  );

  $.wait('3s');
  title.fadeOut('500ms');

  // Render directly to a file
  await $.renderVideo({
    outputType: 'file',
    output: './cinematic-output.mp4',
    verbose: true,
  });

  console.log('Video rendered to ./cinematic-output.mp4');
}

generateVideo();

In just a few lines of code, you've created a high-quality video with a blurResolve transition—one of the 27 built-in presets—and exported it as an MP4.

Why This Matters for SaaS and AI

This "headless-first" architecture is a game-changer for two specific use cases:

1. Personalized Video at Scale

If you're building a SaaS that generates "Year in Review" videos or personalized sales pitches, you need a pipeline that is both fast and cheap. Because VideoFlow can render in the user's browser via @videoflow/renderer-browser or on your server via @videoflow/renderer-server, you can choose where the compute happens.

A technical-diagram illustration of a headless browser icon rendering multiple video tracks simultaneously.

2. AI-Driven Content

As we explored in our guide on How to Build an AI Video Agent, LLMs are incredibly good at emitting structured JSON. By giving an agent the ability to produce VideoJSON, you can turn a text prompt into a fully rendered MP4 in seconds.

Beyond the Basics: The Three-Renderer Rule

The real magic of the VideoFlow ecosystem is that the same code you run on your server can be used for a live preview in your web app.

  • Use @videoflow/renderer-dom for a frame-accurate 60fps preview while the user is editing.
  • Use @videoflow/renderer-browser to let the user export the video locally, saving you server costs.
  • Use @videoflow/renderer-server for batch jobs, scheduled tasks, or API-driven generation.

All three renderers are Apache-2.0 licensed, meaning you can build your entire business on top of them without worrying about proprietary lock-in.

Conclusion

Headless video rendering doesn't have to be a struggle with legacy binaries. By treating videos as portable data (JSON) and leveraging modern browser APIs, you can build video pipelines that are as easy to maintain as a standard web app.

Ready to start building? Head over to the VideoFlow Playground to experiment with the API in real-time, or check out 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 →Cinematic Code: How to Stack and Animate GLSL Effects in VideoFlowVideo Rendering Without FFmpeg: Inside the VideoFlow Server EngineVisualizing Git History: How to Build a Repository Timeline with VideoFlowHeadless Video as a Service: Building a Scalable Rendering API with Node.jsHow to Build a YouTube Shorts Factory with TypeScript and VideoFlowProgrammatic Video Localization: Scaling Multilingual Content with VideoFlowScaling Programmatic Video: How to Architect Large-Scale ProjectsServerless Video Rendering: How to Deploy VideoFlow to AWS Lambda and Vercel
© 2026 VideoFlow. Apache-2.0 core.