mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-15 13:58:20 +00:00
* feat: add video frame format render option * refactor: single source of truth for video-frame-format allow-list Addresses PR review (Via) on #1481: the ["auto","jpg","png"] set was declared three times — render.ts (VIDEO_FRAME_FORMATS), server.ts (inline includes), and renderConfigValidation.ts (ALLOWED_VIDEO_FRAME_FORMATS) — three boundaries to update when a new extraction format lands. Hoist the constant + a reusable `isVideoFrameFormat` type guard into @hyperframes/engine (where VideoFrameFormat is defined) and route all three call sites through them. Behavior unchanged; also drops two `as RenderConfig[...]` casts in favor of the guard (narrowing over assertion, per repo TS conventions). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Xuelong Mu <xuelongmu@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1.8 KiB
1.8 KiB
Rendering
Render compositions to MP4 with npx hyperframes render.
Local Mode (default)
Uses Puppeteer (bundled Chromium) + system FFmpeg. Fast for iteration.
Requires: FFmpeg installed (brew install ffmpeg or apt install ffmpeg).
Docker Mode (--docker)
Deterministic output with exact Chrome version and fonts. For production. Requires: Docker installed and running.
Options
-f, --fps— 24, 30, or 60 (default: 30)-q, --quality— draft, standard, high (default: standard)-w, --workers— Parallel workers 1-8 (default: auto)--crf— Override encoder CRF (mutually exclusive with--video-bitrate)--video-bitrate— Target video bitrate such as10M(mutually exclusive with--crf)--video-frame-format— Source video frame extraction format:auto,jpg, orpng(default:auto). Usepngfor UI recordings, screen captures, and color-sensitive source videos.--gpu— Use GPU encoding (NVENC, VideoToolbox, AMF, VAAPI, QSV)--browser-gpu/--no-browser-gpu— Force host GPU or software (SwiftShader) for Chrome/WebGL capture. Default for local renders isauto— probe WebGL availability on first launch and fall back to software if no GPU is reachable. Docker mode always uses software.-o, --output— Custom output path
Tips
- Use
draftquality for fast previews during development - Local renders auto-detect GPU on first launch; use
--browser-gputo force hardware (errors if no GPU) or--no-browser-gputo force SwiftShader - Use
--gpuwhen a local render also benefits from hardware FFmpeg encoding - Use
--video-frame-format pngwhen source videos contain saturated UI colors that should avoid JPEG extraction - Use
npx hyperframes benchmarkto find optimal settings - 4 workers is usually the sweet spot for most compositions