Skip to content

Write HTML. Render video. Built for agents.

docs: refine media treatment guides

ukimsanov182862773187
diff --git a/docs/guides/color-grading.mdx b/docs/guides/color-grading.mdx
index 96cf52c318..f4a406160b 100644
--- a/docs/guides/color-grading.mdx
+++ b/docs/guides/color-grading.mdx
@@ -3,17 +3,11 @@ title: Color Grading
description: "Correct and creatively grade video or image media with presets, scopes, color wheels, curves, HSL selections, and custom LUTs."
---
-HyperFrames provides real-time, media-level color grading for project-local
-`<video>` and `<img>` elements.
+Use Color Grading to correct and creatively grade real `<video>` and `<img>`
+media in Studio or through an agent with the same validated SDR/Rec.709 shader
+contract in preview and render.
-Studio and AI agents use the same validated grading contract, and final
-rendering runs the same shader pipeline used by the preview.
-
-The current pipeline is designed for SDR/Rec.709-oriented work. It provides
-professional primary and selective grading tools, but it is not an ACES, OCIO,
-or native HDR finishing pipeline.
-
-## The Mental Model
+## Choose the Right Tool
| Stage | Purpose | HyperFrames tools |
| --- | --- | --- |
@@ -25,67 +19,68 @@ or native HDR finishing pipeline.
| Dress | Add an authored HUD, flash, light leak, or freeze-frame layer | [Media Overlays](/guides/media-overlays) |
All pixel-level stages are stored together on the selected media element. An
-overlay is different: it is an ordinary editable composition layer above the
-media.
-
-## Studio Workflow
-
-Select a real `<img>` or `<video>` element to open Color Grading in the Design
-panel.
-
-<Steps>
- <Step title="Inspect the source">
- Open **Scopes** and choose Histogram, Waveform, RGB Parade, or Vectorscope.
- Scopes refresh from the selected media frame and help identify clipped
- highlights, crushed shadows, channel imbalance, and saturation before you
- make creative changes.
- </Step>
- <Step title="Make the primary correction">
- Use Exposure, Contrast, Highlights, Shadows, White Point, Black Point,
- Warmth, Tint, Vibrance, and Saturation. Correct obvious source problems
- before applying a stronger look.
- </Step>
- <Step title="Shape tonal color">
- Use the Shadows, Midtones, and Highlights wheels. Each wheel provides hue,
- color amount, and level, so color and brightness can be adjusted within the
- same tonal zone.
- </Step>
- <Step title="Refine with curves">
- Use the Master curve for overall luminance, Red/Green/Blue curves for
- channel shaping, and Hue vs Hue, Hue vs Saturation, or Hue vs Luma for
- hue-selective adjustments.
- </Step>
- <Step title="Isolate a color when needed">
- Add a Color Selection, capture the current frame, and use the eyedropper to
- initialize its HSL qualifier. Switch to **Selection matte** to inspect the
- selected pixels, refine hue/saturation/luma range and softness, then apply
- bounded hue, saturation, luma, temperature, or tint correction. Up to four
- ordered selections are supported.
- </Step>
- <Step title="Choose a look and finish">
- Preview a built-in preset on the selected media or load a project-local 3D
- `.cube` LUT. Use vignette and grain only when they support the visual
- direction.
- </Step>
- <Step title="Compare and render">
- Hold the compare control to see the ungraded source. Scrub representative
- frames, verify faces and highlights, then render. The final render redraws
- the grading shader after exact video-frame injection.
- </Step>
-</Steps>
-
-To reuse the complete authored grade, use **Copy grade to** and choose
-**Current file media** or **All project media**, then click **Apply**. This
-copies the validated payload to other real media elements; it does not alter
-overlay, caption, or DOM layers.
-
-<Note>
- Color Grading is media-only. It processes real `<video>` and `<img>` elements,
- not captions, text, SVG, or arbitrary DOM. Use first-class media elements for
- visual assets that should remain editable and gradeable.
-</Note>
-
-## What Each Professional Tool Does
+overlay is different: it is an ordinary editable composition layer whose final
+paint order follows its authored track and CSS `z-index`.
+
+## Quick Start
+
+<Tabs>
+ <Tab title="Studio">
+ Select a real `<img>` or `<video>` element to open Color Grading in the
+ Design panel.
+
+ <Steps>
+ <Step title="Correct the source">
+ Open **Scopes**, then adjust exposure, tonal balance, white balance, and
+ saturation before applying a stronger look.
+ </Step>
+ <Step title="Shape the grade">
+ Use tonal wheels, curves, or an HSL Color Selection only where the
+ source needs more precise control.
+ </Step>
+ <Step title="Choose a look and verify">
+ Preview a preset or load a 3D `.cube` LUT, compare with the source, and
+ scrub representative frames before rendering.
+ </Step>
+ </Steps>
+ </Tab>
+ <Tab title="Agent / CLI">
+ Inspect the media, apply one validated payload, then verify representative
+ frames:
+
+ ```bash Terminal
+ npx hyperframes media-treatment \
+ --project . \
+ --file compositions/interview.html \
+ --selector '#interview' \
+ --analyze \
+ --json
+
+ npx hyperframes media-treatment \
+ --project . \
+ --file compositions/interview.html \
+ --selector '#interview' \
+ --grading '{"adjust":{"highlights":-0.08,"shadows":0.06},"wheels":{"midtones":{"hue":32,"amount":0.05}}}' \
+ --apply \
+ --json
+ ```
+
+ Use `--dry-run` when target or scope is uncertain. Use `--clear` to remove
+ the complete treatment.
+ </Tab>
+</Tabs>
+
+To reuse a grade in Studio, use **Copy grade to**, choose **Current file media**
+or **All project media**, then click **Apply**. Project-wide copy refuses
+project-relative LUT paths because the same path may resolve differently in
+another composition; use current-file copy or a project-root path/data URL. The
+copy changes only the treatment payload, not overlays, captions, or DOM layers.
+
+Project-local media is the reliable path. Remote media requires compatible CORS
+headers. Color Grading does not process captions, text, SVG, arbitrary DOM, or
+CSS background images.
+
+## Professional Controls
### Color Wheels
@@ -103,10 +98,10 @@ same tonal zone, while hue and amount introduce color.
- **Master** remaps overall luminance.
- **Red**, **Green**, and **Blue** remap individual channels.
-Curve points are normalized `[input, output]` pairs. Endpoints are implicit,
-and each curve supports up to 16 points. An S-curve increases contrast; lifting
-the lower-left region raises shadows; channel curves can build split-tone or
-cast-removal adjustments.
+Curve points are normalized `[input, output]` pairs. Every RGB curve must include
+input endpoints `0` and `1` and contain 2–16 points. An S-curve increases
+contrast; lifting the lower-left region raises shadows; channel curves can
+build split-tone or cast-removal adjustments.
### Hue Curves
@@ -115,7 +110,8 @@ cast-removal adjustments.
- **Hue vs Luma** changes brightness around a selected hue.
Hue curve points are `[hueDegrees, delta]` pairs and wrap around the color
-wheel.
+wheel. An authored hue curve requires 3–16 unique hue inputs from `0` up to,
+but not including, `360`.
### HSL Color Selections
@@ -137,10 +133,11 @@ facial recognition, or spatial masks.
| RGB Parade | Channel balance and clipped individual channels |
| Vectorscope | Hue direction and saturation |
-Studio scopes analyze a captured selected-media frame. They are inspection
-tools and do not change the grade.
+Studio scopes analyze a captured selected-media frame with the current
+treatment applied. They refresh as the grade changes, but are inspection tools
+and do not modify the grade.
-## Built-In Looks
+## Presets
HyperFrames ships tested shader-setting presets, not bundled LUT files:
@@ -154,7 +151,7 @@ Use these as starting points and tune them for the actual source. Presets that
also activate a stylized shader treatment are documented under
[Media Effects](/guides/media-effects).
-## Agent Workflow
+## Agent Guidance
Agents should use the CLI as the normal authoring surface. The
`data-color-grading` attribute is the persistence contract, not the first thing
@@ -166,56 +163,22 @@ look filtered"_ route through the `media-use` skill, which inspects the source,
discovers the relevant contract, applies a deterministic payload, and verifies
the result.
-<Steps>
- <Step title="Discover the relevant surface">
- ```bash Terminal
- hyperframes media-treatment --capabilities --json
- hyperframes media-treatment --capability grading --json
- ```
-
- The overview stays concise. Focused queries such as `wheels`, `curves`,
- `hue-curves`, `secondary`, `scopes`, or `lut` return exact controls, bounds,
- and examples.
- </Step>
- <Step title="Analyze the selected source">
- ```bash Terminal
- hyperframes media-treatment \
- --project . \
- --file compositions/interview.html \
- --selector '#interview' \
- --analyze \
- --json
- ```
-
- Analysis measures a local media source and returns metadata, warnings,
- diagnosis, and a bounded suggested primary-correction patch. It does not
- replace visual judgment or automatically invent a creative grade.
- </Step>
- <Step title="Apply a validated grade">
- ```bash Terminal
- hyperframes media-treatment \
- --project . \
- --file compositions/interview.html \
- --selector '#interview' \
- --grading '{"adjust":{"highlights":-0.08,"shadows":0.06},"wheels":{"midtones":{"hue":32,"amount":0.05}}}' \
- --apply \
- --json
- ```
+Start with the concise capability overview, then query only the contract needed
+for the current intent:
- Use `--dry-run` when target or scope is uncertain. Use `--clear` to remove
- the complete treatment from the target.
- </Step>
- <Step title="Verify representative frames">
- Inspect more than one frame for video, compare before and after, and render
- a short draft when the grade is important to the final result.
- </Step>
-</Steps>
+```bash Terminal
+npx hyperframes media-treatment --capabilities --json
+npx hyperframes media-treatment --capability grading --json
+npx hyperframes media-treatment --capability curves --json
+```
-Agents should normally start from source analysis or a tested preset, then add
-small, explainable adjustments. Directly inventing many unrelated curve and
-secondary values is difficult to review and easy to overcook.
+Focused queries such as `wheels`, `hue-curves`, `secondary`, `scopes`, or `lut`
+return exact controls, bounds, and examples. Start from source analysis or a
+tested preset, then add small, explainable adjustments. Avoid inventing many
+unrelated curve and secondary values: they are difficult to review and easy to
+overcook.
-## Advanced Data Shape
+## Low-Level HTML Contract
The CLI and Studio persist the resolved grade in `data-color-grading`:
@@ -267,8 +230,8 @@ bounds. Query the current contract instead of copying bounds into agent
instructions:
```bash Terminal
-hyperframes media-treatment --capability secondary --json
-hyperframes media-treatment --all --json
+npx hyperframes media-treatment --capability secondary --json
+npx hyperframes media-treatment --all --json
```
Use `--all` only for exhaustive tooling or contract inspection.
@@ -277,7 +240,7 @@ Use `--all` only for exhaustive tooling or contract inspection.
HyperFrames supports project-local 3D `.cube` LUTs:
-```json
+```json data-color-grading
{
"lut": {
"src": "assets/luts/product-look.cube",
@@ -307,8 +270,8 @@ validation, and rendered comparisons to evaluate it.
| 1080p SDR video | Supported | Recommended default path |
| 4K SDR video or image | Supported | Higher preview/render cost; output resolution still follows the composition |
| iPhone SDR video | Supported | Treated as normal browser-decoded SDR media |
-| iPhone HDR, HLG, or Dolby Vision-style upload | Partial | HDR metadata is detected and warned; the grading shader remains SDR |
-| HDR delivery render | Separate workflow | Use [HDR Rendering](/guides/hdr); grading controls are not HDR-aware |
+| iPhone HDR, HLG, or Dolby Vision-style upload | Partial | Studio can show an SDR shader preview, but native HDR delivery bypasses the SDR treatment for native HDR source pixels |
+| HDR delivery render | Separate workflow | The native HDR compositor preserves HDR source pixels and does not apply this SDR grading/effects pipeline to native HDR layers |
| LOG camera footage | Partial | Requires a known matching transform/LUT; no automatic camera profile management |
| Full-scene grade including DOM/text | Not supported | Current grading targets individual media elements |
| Face or region tracking | Not supported | Use a separate isolated media layer or external tracking/masking workflow |
@@ -323,6 +286,13 @@ the native source after a shader frame is ready. During final rendering,
HyperFrames injects exact video frames and waits for the grading runtime to
redraw before capture.
+That render-parity statement applies to SDR output. In the native HDR render
+path, HyperFrames keeps HDR source pixels out of the SDR DOM capture and
+composites them separately at higher bit depth. The current SDR grading canvas
+is therefore not applied to native HDR layers. Convert or tone-map the source to
+SDR first when these grading controls must appear in the result, or use
+[HDR Rendering](/guides/hdr) to preserve the untreated HDR source.
+
For 4K output, follow [4K Rendering](/guides/4k-rendering). A 1080p source does
not gain new detail merely because the composition is rendered at 4K.
@@ -334,7 +304,7 @@ Project-local media is the safest path. Remote media must provide compatible
CORS headers and should use `crossorigin="anonymous"` when pixel access is
required.
-## Related Guides
+## Next Steps
<CardGroup cols={2}>
<Card title="Media Effects" icon="wand-magic-sparkles" href="/guides/media-effects">
diff --git a/docs/guides/media-effects.mdx b/docs/guides/media-effects.mdx
index 2eadbad15a..49d29e54b0 100644
--- a/docs/guides/media-effects.mdx
+++ b/docs/guides/media-effects.mdx
@@ -3,42 +3,9 @@ title: Media Effects
description: "Apply deterministic shader effects to video and image media, combine them with color grading, and animate supported strengths with GSAP."
---
-Media Effects transform the pixels of a selected `<video>` or `<img>` beyond
-normal color correction.
-
-Blur, pixelation, VHS damage, ASCII, dither, halftone, engraving, crosshatch,
-and Kuwahara painting all run inside the same media shader used by
-[Color Grading](/guides/color-grading). Effects can be combined with correction,
-color grading, finishing, and a custom LUT in one validated payload.
-[Media Overlays](/guides/media-overlays) are separate editable composition
-layers.
-
-## Studio Workflow
-
-<Steps>
- <Step title="Select real media">
- Select a project-local `<img>` or `<video>` in the preview, Layers panel, or
- Timeline. Effects do not appear for arbitrary divs or CSS background images.
- </Step>
- <Step title="Choose a starting point">
- Preview an effect-bearing preset or open the Effects section. A preset is a
- tested starting payload; it does not restrict further adjustment.
- </Step>
- <Step title="Tune the relevant controls">
- Effects are grouped by intent: Essentials, Retro & Glitch, Print, and Art.
- Enabling an effect uses a calibrated default, while its related controls
- remain adjustable.
- </Step>
- <Step title="Choose a palette when supported">
- ASCII, Ordered Dither, Mono Screen, Engraving, and Crosshatch can use an
- authored two-to-six-color palette.
- </Step>
- <Step title="Verify motion and framing">
- Play and scrub videos. Check at least the beginning, middle, and end when an
- effect moves over time. Confirm that object-fit/object-position framing
- remains correct.
- </Step>
-</Steps>
+Use Media Effects to transform real `<video>` and `<img>` pixels with
+deterministic blur, retro, print, and art treatments that can share one payload
+with [Color Grading](/guides/color-grading).
## Effect Families
@@ -80,14 +47,67 @@ layers.
| Crosshatch | Translates media into layered hand-hatched lines |
| Kuwahara Paint | Applies edge-preserving painterly smoothing |
-## Effect-Bearing Presets
+## Quick Start
+
+<Tabs>
+ <Tab title="Studio">
+ <Steps>
+ <Step title="Select real media">
+ Select a real `<img>` or `<video>` in the preview, Layers panel, or
+ Timeline. Effects do not appear for arbitrary divs or CSS background
+ images.
+ </Step>
+ <Step title="Choose and tune an effect">
+ Preview an effect preset or open **Effects**. Enabling an effect uses a
+ calibrated default; expand it to adjust only the controls relevant to
+ the intended result.
+ </Step>
+ <Step title="Verify motion and framing">
+ Play and scrub videos at the beginning, middle, and end. Confirm that
+ moving effects and object-fit/object-position framing remain correct.
+ </Step>
+ </Steps>
+ </Tab>
+ <Tab title="Agent / CLI">
+ Discover the narrow effect contract, then apply the complete treatment in
+ one mutation:
+
+ ```bash Terminal
+ npx hyperframes media-treatment --capabilities --json
+ npx hyperframes media-treatment --capability digitalGlitch --json
+
+ npx hyperframes media-treatment \
+ --project . \
+ --file compositions/scene.html \
+ --selector '#hero' \
+ --grading '{"effects":{"digitalGlitch":0.55,"digitalGlitchColorSplit":0.25,"digitalGlitchLineTear":0.25,"digitalGlitchPixelate":0.15,"digitalGlitchBlockAmount":0.5,"digitalGlitchBlockDisplacement":0.25,"digitalGlitchSpeed":0.5}}' \
+ --apply \
+ --json
+ ```
+ </Tab>
+</Tabs>
+
+Project-local media is recommended; remote media requires compatible CORS.
+[Media Overlays](/guides/media-overlays) are separate editable composition
+layers rather than shader properties.
+
+<Warning>
+ Media Effects use the SDR/Rec.709 shader pipeline. Studio can preview that
+ pipeline on browser-decoded HDR media, but native HDR rendering preserves the
+ HDR source separately and does not apply these SDR effects to native HDR
+ layers. Convert or tone-map to SDR when an effect must appear in the final
+ output. See [Color Grading support](/guides/color-grading#support-matrix) and
+ [HDR Rendering](/guides/hdr).
+</Warning>
+
+## Effect Presets
`Creator Camcorder`, `VHS Playback`, `8mm Home Movie`, `Editorial Halftone`, and
`Two-Ink Print` provide tested combinations of effect, correction, and
finishing settings. Preview one as a starting point, then tune the underlying
controls. They are normal shader payloads, not baked media or bundled LUTs.
-## Agent Workflow
+## Agent Guidance
Agents should discover only the part of the toolbox relevant to the user's
intent:
@@ -98,9 +118,9 @@ classifies that intent, then queries the narrow effect or recipe details instead
of loading the exhaustive contract.
```bash Terminal
-hyperframes media-treatment --capabilities --json
-hyperframes media-treatment --capability retro-glitch --json
-hyperframes media-treatment --capability digitalGlitch --json
+npx hyperframes media-treatment --capabilities --json
+npx hyperframes media-treatment --capability retro-glitch --json
+npx hyperframes media-treatment --capability digitalGlitch --json
```
The concise overview lists capability families. A focused query returns the
@@ -108,28 +128,6 @@ effect's calibrated apply payload, controls, render lane, palette support, and
seek-safe animation path. Use the canonical payload instead of guessing
sub-control defaults.
-Apply a complete, validated combination in one mutation:
-
-```bash Terminal
-hyperframes media-treatment \
- --project . \
- --file compositions/scene.html \
- --selector '#hero' \
- --grading '{
- "adjust":{"contrast":0.05,"highlights":-0.06},
- "effects":{
- "tapeDamage":0.65,
- "tapeTracking":0.55,
- "tapeNoise":0.25,
- "tapeSpeed":0.5,
- "scanlines":0.2
- },
- "details":{"grain":0.08,"vignette":0.06}
- }' \
- --apply \
- --json
-```
-
Recipes are tested shortcuts, not a closed list. An agent may assemble a custom
payload when the source and intent justify it, but it should:
@@ -145,7 +143,7 @@ payload when the source and intent justify it, but it should:
Dark-to-light order creates normal luminance mapping; reversing the array
intentionally inverts that mapping.
-```json
+```json data-color-grading
{
"effects": {
"dither": 1,
@@ -161,8 +159,8 @@ Crosshatch. A palette alone does not activate an effect.
Discover built-in palettes without copying their values into instructions:
```bash Terminal
-hyperframes media-treatment --capability palettes --json
-hyperframes media-treatment --capability electric-ink --json
+npx hyperframes media-treatment --capability palettes --json
+npx hyperframes media-treatment --capability electric-ink --json
```
## Animation and Keyframes
@@ -229,7 +227,8 @@ the keyframeable paths above.
tears, Noise controls row jitter/noise, and Speed controls their deterministic
motion. Those subordinate controls do not activate tape damage by themselves.
- **Film Artifacts** adds sparse deterministic dust and scratches. Grain,
- vignette, color, and optional seek-safe gate weave are separate choices.
+ vignette, color, and optional wrapper motion such as a subtle gate weave are
+ separate choices.
- **Halftone** uses fixed print-oriented channel angles and edge behavior.
Cell size remains adjustable.
- **Two-Ink Print** is HyperFrames' own fixed two-ink mapping. Do not describe
@@ -277,7 +276,7 @@ For 4K delivery, verify the effect at the final composition size. Resolution-
aware effects preserve their intended scale, but 4K still processes more pixels
than 1080p.
-## Low-Level Data Shape
+## Low-Level HTML Contract
Media effects live in the same persisted contract as grading:
@@ -302,7 +301,7 @@ Media effects live in the same persisted contract as grading:
Unknown keys are rejected and values are normalized by the Core contract. The
CLI should remain the primary authoring surface for agents.
-## Related Guides
+## Next Steps
<CardGroup cols={2}>
<Card title="Color Grading" icon="palette" href="/guides/color-grading">
diff --git a/docs/guides/media-overlays.mdx b/docs/guides/media-overlays.mdx
index 3650bca22f..930926d68e 100644
--- a/docs/guides/media-overlays.mdx
+++ b/docs/guides/media-overlays.mdx
@@ -1,20 +1,13 @@
---
title: Media Overlays
-description: "Add editable, timeline-driven HUD, flash, light-leak, and freeze-frame dressing above video or image media."
+description: "Add editable, timeline-driven HUD, flash, light-leak, and freeze-frame dressing alongside video or image media."
---
-Media Overlays are authored HyperFrames composition blocks that sit above a
-video or image.
+Use Media Overlays to add editable, timeline-driven HUD, flash, light-leak, and
+freeze-frame dressing around a video or image without baking it into the source
+pixels.
-They add visual dressing such as a recording HUD, camera flash, light leak, or
-freeze-frame treatment without baking those pixels into the source media.
-Unlike [Color Grading](/guides/color-grading) and
-[Media Effects](/guides/media-effects), overlays are not shader properties.
-They are real HTML, CSS, and paused GSAP timelines installed from the
-HyperFrames Registry. Once inserted, they remain normal editable layers in the
-composition.
-
-## Shipped Overlays
+## Included Overlays
| Registry block | Purpose |
| --- | --- |
@@ -26,67 +19,56 @@ composition.
These are first-party authored blocks. Their Catalog poster/video assets are
previews only; the installed result is editable composition source.
-## Studio Workflow
-
-<Steps>
- <Step title="Select the media beat">
- Select the `<video>` or `<img>` the overlay should accompany.
- </Step>
- <Step title="Open Overlays">
- The Design panel shows responsive preview cards for media-treatment overlay
- blocks from the Registry.
- </Step>
- <Step title="Insert a block">
- Choose an overlay. Studio installs its composition source, aligns it to the
- selected media's start and duration, and places it on the next known visual
- track.
- </Step>
- <Step title="Edit it as a normal layer">
- Use Layers, Timeline, Design, or Code to change text, timing, color,
- opacity, animation, or placement. Removing the overlay does not alter the
- underlying media treatment.
- </Step>
- <Step title="Verify the complete beat">
- Play and scrub through the overlay's entrance, hold, and exit. Check the
- final render because the overlay, source media, and shader treatment are
- separate compositing layers.
- </Step>
-</Steps>
-
-The left Catalog remains the browse-all Registry surface. The Overlays section
-is the media-focused shortcut for the selected beat.
-
-## Agent Workflow
+Unlike [Color Grading](/guides/color-grading) and
+[Media Effects](/guides/media-effects), overlays are real HTML, CSS, and paused
+GSAP timelines installed from the HyperFrames Registry. Their final paint order
+follows authored track placement and CSS `z-index`.
+
+## Quick Start
+
+<Tabs>
+ <Tab title="Studio">
+ <Steps>
+ <Step title="Select the media beat">
+ Select the `<video>` or `<img>` the overlay should accompany.
+ </Step>
+ <Step title="Insert an overlay">
+ Open **Overlays** in the Design panel and choose a preview card. Studio
+ installs the composition source and aligns it to the selected beat.
+ </Step>
+ <Step title="Edit and verify">
+ Use Layers, Timeline, Design, or Code to change content, timing, color,
+ animation, or placement, then play through the entrance and exit.
+ </Step>
+ </Steps>
+ </Tab>
+ <Tab title="Agent / CLI">
+ Discover the available overlay blocks, then install the one that supports
+ the intended beat:
+
+ ```bash Terminal
+ npx hyperframes media-treatment --capabilities --json
+ npx hyperframes add camcorder-hud --no-clipboard
+ ```
+
+ The command installs editable composition source under the project. Embed
+ and time it with the host composition's normal sub-composition rules.
+ </Tab>
+</Tabs>
+
+When the selected media has an authored track, Studio starts the overlay on the
+next track. Otherwise, normal block placement defaults apply. The left Catalog
+remains the browse-all Registry surface; **Overlays** is the selected-media
+shortcut.
+
+## Agent Guidance
An agent may combine grading, a shader effect, treatment animation, and an
-overlay when they support one coherent intent. It should not treat them as
-mutually exclusive.
-
-For example, a restrained camcorder treatment can combine:
+overlay when they support one coherent intent. A restrained camcorder treatment
+can combine a small source correction, tape damage on the media, the
+`camcorder-hud` block, and a finite reveal or exit timed to the edit.
-1. A small source correction.
-2. Chroma softening and tape damage on the media.
-3. The `camcorder-hud` Registry block above it.
-4. A finite reveal or exit timed to the edit.
-
-Discover overlays through the media-treatment overview:
-
-```bash Terminal
-hyperframes media-treatment --capabilities --json
-```
-
-Install one through the Registry:
-
-```bash Terminal
-hyperframes add camcorder-hud --no-clipboard
-hyperframes add organic-light-leak-overlay --no-clipboard
-```
-
-The command installs composition source under the project. The agent then
-embeds and times that sub-composition according to the host composition's
-normal rules.
-
-Agents should:
+Use these constraints:
- Use an overlay when it adds information, motivated light, or useful visual
language.
@@ -127,8 +109,8 @@ flash dressing; it does not perform background removal itself.
For a transparent subject:
```bash Terminal
-hyperframes remove-background subject.mp4 -o subject.webm
-hyperframes add freeze-frame-dressing --no-clipboard
+npx hyperframes remove-background subject.mp4 -o subject.webm
+npx hyperframes add freeze-frame-dressing --no-clipboard
```
See [Remove Background](/guides/remove-background) for cutout and background
@@ -143,13 +125,15 @@ source <img>/<video>
-> color correction and grading
-> LUT and shader effects
-> visible media canvas
- -> HTML/CSS/GSAP overlay layers above it
- -> captions and other composition layers
+
+overlay, caption, and other composition layers
+ -> composed with the visible media canvas by authored track and z-index
```
Color grading does not recolor overlay text or graphics. This is intentional:
-HUD labels remain crisp, captions remain readable, and an organic light leak
-can be adjusted independently from the source grade.
+HUD labels remain crisp and an organic light leak can be adjusted independently
+from the source grade. Place captions, HUD fields, and other important graphics
+on the intended track and verify their final stacking in Studio.
If an overlay should appear behind a subject, separate the subject into its own
transparent media layer and place the overlay between the background and
@@ -169,7 +153,7 @@ time. This keeps rendering deterministic and lets teams:
Keep host-specific timing and placement in the host composition when possible.
That preserves the Registry block as a reusable visual unit.
-## Related Guides
+## Next Steps
<CardGroup cols={2}>
<Card title="Color Grading" icon="palette" href="/guides/color-grading">
diff --git a/docs/packages/cli.mdx b/docs/packages/cli.mdx
index 617de057dd..989d9b7be1 100644
--- a/docs/packages/cli.mdx
+++ b/docs/packages/cli.mdx
@@ -21,6 +21,7 @@ npx hyperframes <command>
- Lint compositions for structural issues (`lint`)
- Inspect rendered visual layout for text overflow, clipped containers, and overlapping text, plus verify motion intent against the seeked timeline (`inspect`)
- Capture key frames as PNG screenshots (`snapshot`)
+- Discover, analyze, and apply media grading/effects (`media-treatment`)
- Check your environment for missing dependencies (`doctor`)
**Use a different package if you want to:**
@@ -797,6 +798,53 @@ Word-level transcripts (whisper output) are grouped into readable caption cues o
Runs multiple render configurations (varying fps, quality, and worker count) and compares timing and file size for each.
</Tab>
<Tab title="Utilities">
+ ### `media-treatment`
+
+ Discover the media-treatment contract, analyze a local media source, and
+ apply validated grading or effects to a real `<img>` or `<video>`:
+
+ ```bash Terminal
+ # Concise capability index, then one focused contract
+ npx hyperframes media-treatment --capabilities --json
+ npx hyperframes media-treatment --capability grading --json
+
+ # Analyze and update one selected media element
+ npx hyperframes media-treatment \
+ --project . \
+ --file compositions/scene.html \
+ --selector '#hero' \
+ --analyze \
+ --json
+ npx hyperframes media-treatment \
+ --project . \
+ --file compositions/scene.html \
+ --selector '#hero' \
+ --grading '{"adjust":{"exposure":0.05},"effects":{"bloom":0.15}}' \
+ --apply \
+ --json
+ ```
+
+ | Flag | Description |
+ |------|-------------|
+ | `--capabilities` | Print the concise capability-family index |
+ | `--capability <id>` | Print exact controls and examples for one family, preset, palette, adjustment, or effect |
+ | `--all` | Print the exhaustive contract for tooling; avoid for routine agent context |
+ | `--project <dir>` | Project directory; defaults to the current directory |
+ | `--file <path>` | HTML composition containing the target; defaults to `index.html` |
+ | `--selector <css>` | CSS selector for the target real media element |
+ | `--selector-index <n>` | Zero-based match when the selector is intentionally non-unique |
+ | `--analyze` | Measure a local source and return metadata, warnings, diagnosis, and bounded correction suggestions |
+ | `--grading <json>` | Validated grading/effects patch to merge into the target |
+ | `--apply` | Persist the validated patch; without it, no file is written |
+ | `--clear` | Remove the complete media treatment from the target |
+ | `--dry-run` | Report the mutation without writing |
+ | `--json` | Output a machine-readable result |
+
+ Use the [Color Grading](/guides/color-grading) and
+ [Media Effects](/guides/media-effects) guides for workflow guidance. The
+ command authors the low-level `data-color-grading` persistence contract so
+ agents do not need to construct HTML mutations by hand.
+
### `doctor`
Check your environment for required dependencies:
diff --git a/docs/reference/html-schema.mdx b/docs/reference/html-schema.mdx
index 5e876eb07c..7b46ef4193 100644
--- a/docs/reference/html-schema.mdx
+++ b/docs/reference/html-schema.mdx
@@ -63,6 +63,7 @@ Common sizes:
| `data-variable-values` | div | No | JSON object of values passed to a nested composition. Read via `getVariables()` in scripts, or consumed automatically by declarative bindings. |
| `data-var-src` | img, video, audio | No | Binds the element's `src` to a declared variable id — the runtime substitutes the value (URL string or image `{url}`); the authored `src` is the fallback. |
| `data-var-text` | any | No | Binds the element's own text to a scalar variable id. Element children are preserved. |
+| `data-color-grading` | img, video | No | Validated JSON payload for media-level correction, grading, LUT, finishing, and shader effects. Prefer Studio or `hyperframes media-treatment` to author it. |
| `data-width` | div | On compositions | Composition width in pixels. |
| `data-height` | div | On compositions | Composition height in pixels. |
@@ -162,6 +163,34 @@ Common sizes:
</Accordion>
</AccordionGroup>
+## Media Treatments
+
+Real `<img>` and `<video>` elements may carry a `data-color-grading` payload:
+
+```html index.html
+<video
+ id="hero"
+ src="assets/hero.mp4"
+ data-start="0"
+ data-track-index="0"
+ muted
+ playsinline
+ data-color-grading='{
+ "preset":"clean-studio",
+ "intensity":0.8,
+ "adjust":{"highlights":-0.08,"shadows":0.06},
+ "effects":{"bloom":0.12},
+ "colorSpace":"rec709"
+ }'
+></video>
+```
+
+The runtime renders the complete payload on a sibling WebGL canvas. It does not
+apply to text, SVG, arbitrary DOM, or CSS background images. Use Studio or
+[`media-treatment`](/packages/cli#media-treatment) for normal authoring; see
+[Color Grading](/guides/color-grading) and [Media Effects](/guides/media-effects)
+for the supported workflow and current SDR/HDR boundary.
+
## Relative Timing
Reference another clip's ID in `data-start` to mean "start when that clip ends":