npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@videoflow/renderer-server

v1.0.15

Published

Server-side video renderer for VideoFlow — renders JSON videos using Playwright + ffmpeg

Readme

@videoflow/renderer-server

Render VideoFlow videos to MP4 files on the server. Generate videos from VideoFlow's JSON format in Node.js — ideal for APIs, batch processing, and background jobs.

Installation

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

Requirements:

  • Node.js 18+
  • ffmpeg 4.4+

Installing ffmpeg

# macOS
brew install ffmpeg

# Linux
sudo apt-get install ffmpeg

# Windows (with Chocolatey)
choco install ffmpeg

Quick Start

import VideoFlow from '@videoflow/core';

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

const title = $.addText({ text: 'Hello!', fontSize: 3, color: '#fff' });
title.fadeIn('1s');
$.wait('3s');
title.fadeOut('1s');

await $.renderVideo({
  outputType: 'file',
  output: './output.mp4',
  verbose: true,
});

Why Use This Package?

  • Generate videos from an API — accept JSON, return MP4
  • Batch processing — render hundreds of videos in a pipeline
  • Background jobs — offload rendering to worker processes
  • High-quality output — leverages ffmpeg for optimized encoding

API

ServerRenderer.render

Render a compiled VideoFlow JSON to MP4.

import VideoRenderer from '@videoflow/renderer-server';

const json = await $.compile();

// Render to file
await VideoRenderer.render(json, {
  outputType: 'file',
  output: './video.mp4',
  verbose: true,
});

// Render to buffer
const buffer = await VideoRenderer.render(json);

Options:

  • outputType'file' or 'buffer' (default: 'buffer')
  • output — output file path (required when outputType is 'file')
  • verbose — log progress to console
  • signalAbortSignal for cancellation

Instance Methods

For fine-grained control, create a ServerRenderer instance:

import { ServerRenderer } from '@videoflow/renderer-server';

const json = await $.compile();
const renderer = new ServerRenderer(json);

// Render a single frame to JPEG
const frameBuffer = await renderer.renderFrame(30);
fs.writeFileSync('frame.jpg', frameBuffer);

// Render the full audio track to WAV
const audioBuffer = await renderer.renderAudio();
if (audioBuffer) {
  fs.writeFileSync('audio.wav', audioBuffer);
}

// Always clean up when done
await renderer.cleanup();

Example: Video Generation API

import express from 'express';
import VideoFlow from '@videoflow/core';

const app = express();
app.use(express.json());

app.post('/api/generate-video', async (req, res) => {
  const { title, subtitle } = req.body;

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

  const titleLayer = $.addText({ text: title, fontSize: 3, color: '#fff' });
  titleLayer.fadeIn('1s');
  $.wait('2s');

  const subtitleLayer = $.addText({ text: subtitle, fontSize: 1.5, color: '#ccc' });
  subtitleLayer.fadeIn('500ms');
  $.wait('3s');

  const outputPath = `./videos/${Date.now()}.mp4`;
  await $.renderVideo({
    outputType: 'file',
    output: outputPath,
  });

  res.json({ video: outputPath });
});

app.listen(3000);

Example: Batch Video Generation

import VideoFlow from '@videoflow/core';

const items = [
  { text: 'Slide 1', color: '#ff0000' },
  { text: 'Slide 2', color: '#00ff00' },
  { text: 'Slide 3', color: '#0000ff' },
];

for (const [i, item] of items.entries()) {
  const $ = new VideoFlow({ width: 1920, height: 1080, fps: 30 });
  $.addText({ text: item.text, fontSize: 3, color: item.color });
  $.wait('3s');

  await $.renderVideo({
    outputType: 'file',
    output: `./output/slide-${i + 1}.mp4`,
    verbose: true,
  });

  console.log(`Rendered slide ${i + 1}`);
}

See Also

License

Apache License 2.0