Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
docs(4k): add asset-scaling reality check and reflect Studio dropdown
James5260429dd9a5
diff --git a/docs/guides/4k-rendering.mdx b/docs/guides/4k-rendering.mdxindex c8346ccffa..dd91700368 100644--- a/docs/guides/4k-rendering.mdx+++ b/docs/guides/4k-rendering.mdx@@ -79,12 +79,29 @@ The composition stays at its authored dimensions. Hyperframes computes a `device| 1080×1920 | `portrait-4k` | 2 | 2160×3840 || 3840×2160 | `4k` | 1 (no-op) | 3840×2160 |-Chrome then renders the page at the higher DPR — effectively rendering each CSS pixel as 2×2 device pixels — so the captured screenshot is at the requested resolution. Text, SVG, and images served at higher intrinsic resolutions all benefit from the upsample. Pre-rasterized assets (a 1920×1080 PNG, for example) won't gain detail they don't have but won't be visibly blurred either.+Chrome then renders the page at the higher DPR — effectively rendering each CSS pixel as 2×2 device pixels — so the captured screenshot is at the requested resolution.<Tip>This approach is intentionally simple — no composition edits, no second authoring pass. The tradeoff: 4K renders take roughly 4× as long per frame because there are 4× the pixels to capture and encode.</Tip>+## What scales, what doesn't++Supersampling re-renders the page at higher DPR. That genuinely helps anything the browser rasterizes from a vector or high-resolution source, and does nothing for content already locked to a fixed pixel grid. Knowing which is which sets correct expectations before a 4K render:++| Asset type | Behavior at `--resolution 4k` |+|------------|------------------------------|+| Text (HTML, SVG `<text>`, web fonts) | ✅ **Re-rasterized at 4K.** Glyphs are vector and the browser shapes/rasterizes them at the new DPR. Crisp at any scale. |+| SVG / vector graphics | ✅ **Re-rasterized at 4K.** Same story as text — paths are vector. |+| CSS shapes, gradients, borders, shadows | ✅ **Re-rasterized at 4K.** Browser-generated raster. |+| Images with intrinsic dimensions ≥ 4K | ✅ **Full benefit.** A 3840×2160 source serves all the detail. |+| Images smaller than 4K (e.g. a 1920×1080 PNG) | ⚠️ **No new detail.** Browser upscales the source bitmap; output is no sharper than rendering at 1080p and upscaling externally — but no worse either. |+| `<video>` elements | ❌ **Locked to source resolution.** A 1080p MP4 stays 1080p; the supersample only helps the surrounding DOM. Encode source video at the target resolution if you need 4K throughout. |+| `<canvas>` (2D and WebGL) | ❌ **Locked to canvas's intrinsic dimensions.** `<canvas width="1920" height="1080">` is a 1080p bitmap regardless of DPR. To render canvas content at 4K, multiply `canvas.width` / `canvas.height` by your target DPR and scale the drawing context (`ctx.scale(2, 2)` for a 2× canvas with the same logical layout). |+| Pre-rendered video frames injected by the engine | ❌ **Locked to extraction resolution.** When the producer pre-extracts `<video>` frames via ffmpeg, they're decoded at the source video's dimensions. |++**Rule of thumb**: if the asset is *vector or generated by the browser*, supersampling helps. If it's a *bitmap with fixed pixel dimensions* (video, canvas, low-res PNG), it doesn't — author it at the target resolution instead.+## Constraints`--resolution` enforces three guards before any frames are captured. If any fail, the render exits before doing work.@@ -126,7 +143,11 @@ For a 4K render of a 30-second composition, plan on a few minutes of wall time o## Studio support-A resolution selector in Studio is on the way (tracked separately). For now, switch resolution from the CLI:+The Renders panel in Studio includes a resolution dropdown next to the format and quality selectors. Pick `4K` (or `4K ↕` for portrait) and hit **Export** — the same supersampling path runs as the CLI flag, no composition edits required.++The dropdown defaults to `Auto` (render at the composition's authored size). The resolution applies per render, not per project — your composition files are unchanged.++You can also drive resolution from the CLI:- **New project**: `hyperframes init my-video --resolution 4k`- **Existing project**: `hyperframes render --resolution 4k --output 4k.mp4`