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

htmltomp4

v1.2.1

Published

Deterministic HTML, CSS, Canvas, SVG, and WebGL animation to MP4/WebM/ProRes video renderer powered by Chromium and FFmpeg.

Readme

HTMLtoMP4 CLI (htmltomp4)

Turn local HTML, CSS, Canvas, SVG, and WebGL animations into deterministic MP4, WebM, or ProRes 4444 videos using Chromium and FFmpeg.

No screen recording, no dropped frames, and no cloud upload queues. Instead of recording wall-clock time, htmltomp4 steps browser time (requestAnimationFrame, CSS/Web Animations API, SVG SMIL, and seeded Math.random) frame-by-frame and pipes frames directly to FFmpeg with automatic hardware encoder detection (NVIDIA NVENC, AMD AMF, Intel QSV, or CPU fallback).


🖥️ Want the One-Click Windows Desktop App?

If you prefer a native GUI with bundled Chromium + FFmpeg (zero Node.js or PATH setup), visual batch queues, encoder diagnostics, and 4K/60fps presets:


✨ Features

  • Deterministic Frame Stepping: Steps virtual browser time, requestAnimationFrame, CSS/WAAPI animations, and SVG animations frame-by-frame for smooth, repeatable exports even on heavy scenes.
  • Auto-Duration Detection: Automatically inspects document.getAnimations() when --duration is omitted.
  • Hardware-Probed GPU Encoding: Tests NVIDIA (h264_nvenc / hevc_nvenc), AMD (amf), and Intel (qsv) encoders at your target resolution before starting, falling back cleanly to CPU (libx264 / libx265) if a driver check fails.
  • Multiple Containers & Studio Codecs: Export standard mp4 (H.264/HEVC), webm (VP9), or prores (MOV with ProRes 4444).
  • Safe Output Staging: Renders into a temporary staging file and only replaces existing outputs when --overwrite is passed and FFmpeg exits cleanly.
  • External Soundtrack Sync: Attach --audioFile ./track.wav with automatic AAC/Opus/PCM codec selection.

🚀 Quick Start (CLI)

1. Install

Clone the repository and install dependencies (requires Node.js 18+):

git clone https://github.com/savvops/htmltomp4.git
cd htmltomp4
npm install

(Puppeteer automatically downloads a compatible Chromium binary, and ffmpeg-static provides a fallback FFmpeg binary if ffmpeg is not on your system PATH.)

2. Render an Animation

Try rendering one of the included examples:

# Render a 5-second 1080p@30fps MP4
node cli.js examples/css_animation.html --duration 5

# Render at 4K 60fps
node cli.js examples/canvas_particles.html --width 3840 --height 2160 --fps 60 --duration 5

# Render an entire folder of .html files in parallel
node cli.js --inputDir ./examples --outputDir ./videos --parallel 2 --duration 4

Output videos are written to ./output/ by default (or your specified --outputDir).


⚙️ CLI Options

htmltomp4 <file.html|directory> [more inputs...] [options]

| Flag | Default | Description | | :--- | :--- | :--- | | --width | 1920 | Output width in pixels (2 to 8192, even numbers required for 4:2:0/4:2:2) | | --height | 1080 | Output height in pixels (2 to 8192) | | --fps, --frameRate | 30 | Frames per second (1 to 240) | | --duration | (auto) | Seconds to render. Omit to auto-detect from CSS/Web Animations (fallback: 10s) | | --maxDuration | 60 | Cap for auto-detected animation duration in seconds | | --inputDir | — | Render all .html / .htm files in a directory (non-recursive) | | --outputDir | ./output | Destination directory for rendered videos | | --overwrite | false | Replace existing output files only after a successful render | | --parallel, -p | 1 | Number of concurrent conversion workers (1 to 16) | | --format | mp4 | Output container: mp4 (H.264/HEVC), webm (VP9), or prores (ProRes 4444 .mov) | | --gpu | auto | Hardware encoder preference: auto, nvidia, amd, intel, or cpu | | --inputCodec | jpeg | Frame pipe format: jpeg (fast) or png (lossless frame capture) | | --jpegQuality | 85 | JPEG capture quality (1 to 100) | | --audioFile | — | Path to an external audio file (.wav, .mp3, etc.) to mux with the video | | --seed | 1234 | PRNG seed for deterministic Math.random() inside the page | | --ignorePageErrors | false | Continue rendering even if the HTML page throws console/network errors | | --executablePath | (auto) | Custom path to Chrome/Chromium executable | | --ffmpegPath | (auto) | Custom path to FFmpeg executable |

Run node cli.js --help for the complete list of encoder presets (--nvencPreset, --cpuCrf4k, --pixFmt, etc.).


🧪 Running the Test Suite

# Run CLI contract and renderer lifecycle tests
npm test

# Run full offline video conversion integration suite (requires Chromium + FFmpeg/ffprobe)
npm run test:converter

🛡️ Security & Best Practices

  • Render only trusted HTML: Pages execute inside headless Chromium and can make network requests or load relative local files.
  • Self-contained assets: If your export appears blank, ensure external fonts, scripts (Three.js, GSAP, Vanta), and images use valid relative paths or reachable URLs, and give your root animation container explicit width and height (100vw / 100vh). See the Troubleshooting & First-Export Guide.

📄 License

MIT License — Built by Savv Studio.