Skip to content

feat: add @hyperframes/renderer turbo renderer package - #121

Closed
miguel-heygen wants to merge 2 commits into
feat/gpu-accelerationfrom
feat/turbo-renderer
Closed

feat: add @hyperframes/renderer turbo renderer package#121
miguel-heygen wants to merge 2 commits into
feat/gpu-accelerationfrom
feat/turbo-renderer

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

Summary

  • New @hyperframes/renderer package with high-performance turbo renderer
  • Uses pipelined CDP with pipe transport for fast frame capture
  • Streams frames directly to FFmpeg for concurrent capture + encoding
  • Auto-detects GPU for hardware-accelerated rendering and encoding
  • Includes all 6 experiment benchmarks and results documentation

Architecture

Standard Engine:
  Node.js → Puppeteer (WebSocket) → Chrome → sequential seek → beginFrame → disk → FFmpeg
  ~10ms/frame (6 workers), 8540ms total

Turbo Renderer:
  Node.js → Puppeteer (pipe) → Chrome → pipelined seek+beginFrame → FFmpeg stdin
  ~26ms/frame (1 worker, CPU), concurrent encode

Experiment Results (6 experiments)

Experiment Speedup Key Finding
CDP Pipelined 1.47x Overlap seek IPC with beginFrame
Streaming Encode 1.05x Concurrent capture+encode
Xvfb Framebuffer 0.28x Dead end — no frame sync
Multi-Tab (4 tabs) 2.38x Shared GPU context
Frame Skipping 1.22x 40% of frames are static
Half Resolution 2.09x 4x fewer pixels

Critical finding: Bottleneck is SwiftShader CPU rasterization. Production runs on m6a.12xlarge (CPU-only). Switching to g5.4xlarge (NVIDIA A10G, $1.62/hr — cheaper than current $1.94/hr) would give 10-30x speedup.

Files

  • packages/renderer/src/turbo-renderer.ts — Core renderer with pipelined CDP
  • packages/renderer/src/node-bridge.ts — Public API exports
  • packages/renderer/src/check-renderer.ts — Smoke test script
  • packages/engine/src/experiments/ — All 6 experiment benchmarks
  • docs/superpowers/specs/ — Design docs and results

Test plan

  • Run turbo renderer on CPU machine — verify produces valid MP4
  • Test on GPU instance (g5.xlarge) with useGpuRendering: true
  • Compare output quality (PSNR) against standard engine
  • Benchmark on GPU instance to validate 10-30x speedup estimate

🤖 Generated with Claude Code

miguel-heygen and others added 2 commits March 29, 2026 05:50
High-performance HTML-to-video renderer using pipelined CDP with pipe
transport and direct FFmpeg streaming.

Key optimizations:
- Pipe transport (--remote-debugging-pipe) instead of WebSocket
- Pipelined CDP: fire seek WITHOUT await, then beginFrame immediately
- Stream frames directly to FFmpeg stdin (zero disk I/O)
- Damage-aware frame reuse (skip screenshot for static frames)
- GPU auto-detection for rasterization and encoding

Designed for 10-30x speedup on GPU-equipped machines (NVIDIA A10G).
On CPU-only machines, bottleneck is SwiftShader - GPU hardware required
for maximum performance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Includes 6 experiments comparing rendering approaches:
- Exp 1: CDP pipelined seeks (1.47x)
- Exp 2: Streaming encode (1.05x)
- Exp 3: Xvfb framebuffer capture (dead end)
- Exp 4: Single-process multi-tab (2.38x)
- Exp 5: Smart frame skipping (1.22x)
- Exp 6: Resolution + encoding presets (2.09x)

Key finding: bottleneck is SwiftShader CPU rasterization (50%+ of
per-frame cost). Transport layer (pipe vs WebSocket) doesn't matter.
GPU hardware is required for 10x+ improvement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@miguel-heygen
miguel-heygen deleted the feat/turbo-renderer branch April 6, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant