Deterministic HTML/CSS to MP4 Video Rendering via Playwright & FFmpeg
Direct Answer
Instead of heavy After Effects or React bundler pipelines, single-file HTML motion templates controlled by a deterministic
window.seek(t) clock can step every frame cleanly in headless Chromium and pipe PNG buffers directly into FFmpeg (libx264 -pix_fmt yuv420p) with zero dropped frames.
1. Core Seek Architecture
Every animation curve derives solely from elapsed time t, making previews in the browser match final exported MP4 frames pixel for pixel.
for frame in range(total_frames):
t = frame / fps
page.evaluate(f"window.seek({t:.4f})")
png_bytes = page.screenshot(type="png")
ffmpeg_proc.stdin.write(png_bytes)
2. Scrub 5 Live Templates in Browser
MotionReel Studio ships 5 self-contained 16:9 and 9:16 templates (Vox Editorial, Changelog Launch, Vertical Shorts 9:16, Metric Bar Race, Kinetic Typography Essay) plus the local Python Playwright + FFmpeg exporter.