--- title: Rendering description: "Render compositions to MP4 locally or in Docker." --- Render your Hyperframes [compositions](/concepts/compositions) to MP4 with the [CLI](/packages/cli). The rendering pipeline is frame-by-frame and seek-driven — see [Deterministic Rendering](/concepts/determinism) for how this works under the hood. ## Getting Started Run the diagnostics command to check for required dependencies: ```bash Terminal npx hyperframes doctor ``` Expected output: ``` ✓ Node.js v22.x ✓ FFmpeg 7.x ✓ FFprobe 7.x ✓ Chrome (bundled) ✓ Docker available ``` Before rendering, preview your composition in the browser to verify it looks correct: ```bash Terminal npx hyperframes dev ``` Run the render command from your project directory: ```bash Terminal npx hyperframes render --output output.mp4 ``` Expected output: ``` ⠋ Rendering composition "root" (30fps, standard quality) ✓ Captured 240 frames in 8.2s ✓ Encoded to output.mp4 (8.0s, 1920x1080, 4.2MB) ``` ## Rendering Modes ### Local Mode (default) Uses Puppeteer (bundled Chromium) and your system's FFmpeg. Fast for iteration during development. **Requires:** FFmpeg installed on your system. See [Troubleshooting](/guides/troubleshooting) if FFmpeg is not found. ```bash Terminal npx hyperframes render --output output.mp4 ``` **Pros:** - Fast startup, no container overhead - Uses your system GPU for hardware-accelerated encoding (with `--gpu`) - Best for iterative development **Cons:** - Output may vary across platforms due to font and Chrome version differences - Not suitable for CI/CD pipelines that require reproducibility ### Docker Mode [Deterministic](/concepts/determinism) output with an exact Chrome version and font set. Use this for production renders and CI pipelines. **Requires:** Docker installed and running. ```bash Terminal npx hyperframes render --docker --output output.mp4 ``` **Pros:** - Identical output on every platform — same Chrome, same fonts, same FFmpeg - The same pipeline used in production - Ideal for CI/CD and automated workflows **Cons:** - Slower startup due to container initialization - No GPU acceleration inside the container Docker mode uses `chrome-headless-shell` with [BeginFrame](/concepts/determinism#how-it-works) control for frame-perfect, deterministic capture. ## When to Use Each Mode | Scenario | Recommended Mode | |----------|-----------------| | Local development and iteration | Local | | CI/CD pipeline | Docker | | Sharing renders with a team | Docker | | Quick preview export | Local | | AI agent-driven rendering | Docker | | Benchmarking performance | Local | ## Options | Flag | Values | Default | Description | |------|--------|---------|-------------| | `--output` | path | `renders/.mp4` | Output file path | | `--fps` | 24, 30, 60 | 30 | Frames per second | | `--quality` | draft, standard, high | standard | Encoding quality preset | | `--workers` | 1-8 or `auto` | auto | Parallel render workers (see [Workers](#workers) below) | | `--gpu` | — | off | GPU encoding (NVENC, VideoToolbox, VAAPI) | | `--docker` | — | off | Use Docker for [deterministic rendering](/concepts/determinism) | | `--quiet` | — | off | Suppress verbose output | ## Workers Each render worker launches a **separate Chrome browser process** to capture frames in parallel. More workers can speed up rendering, but each one consumes ~256 MB of RAM and significant CPU. ### Default behavior By default, Hyperframes uses **half of your CPU cores, capped at 4**: | Machine | CPU cores | Default workers | |---------|-----------|----------------| | MacBook Air (M1) | 8 | 4 | | MacBook Pro (M3) | 12 | 4 (capped) | | 4-core laptop | 4 | 2 | | 2-core VM | 2 | 1 | This is intentionally conservative. Each worker spawns its own Chrome process, so the per-worker overhead is significant. Fewer workers avoids resource contention with FFmpeg encoding and your other applications. ### Choosing a worker count ```bash Terminal # Explicit worker count npx hyperframes render --workers 1 --output output.mp4 # Let Hyperframes pick based on your CPU npx hyperframes render --workers auto --output output.mp4 # Maximum parallelism (use with caution on laptops) npx hyperframes render --workers 8 --output output.mp4 ``` Start with the default. If renders feel slow and your system has headroom (check Activity Monitor / `htop`), try increasing `--workers`. If you see high memory pressure or fan noise, reduce it. ### When to use 1 worker - Short compositions (under 2 seconds / 60 frames) — parallelism overhead exceeds the benefit - Low-memory machines (4 GB or less) - Running renders alongside other heavy processes (video editing, large builds) ### When to increase workers - Long compositions (30+ seconds) on a machine with 8+ cores and 16+ GB RAM - Dedicated render machines or CI runners - Docker mode on a well-provisioned host ## Tips Use `draft` quality during development for fast previews. Switch to `standard` or `high` for final output. - Use `npx hyperframes benchmark` to find optimal settings for your system - Docker mode is slower but guarantees [identical output](/concepts/determinism) across platforms - For compositions with many frames, `--gpu` can significantly speed up local encoding ## Next Steps Understand the determinism guarantees Full list of CLI commands and flags Fix common rendering issues Avoid pitfalls that affect render output