Spiral gives your agent every tool with one account. Browse the tools →

How to Add the HyperFrames Video Skill to Your AI Agent

Video skillUse when writing any NEW custom video composition (one HTML document rendered to MP4 by the HTML video renderer) — text and title animation, word-timed captions, mixed video/image/audio timelines, music and voiceover, transitions, charts, numeric tickers, logos and end cards, 3D or canvas. Covers the HTML composition format, GSAP timelines, clip timing, audio mixing, fonts, emoji and determinism rules.

How to add HyperFrames Video to your agent

Pick the way that suits you. Each takes about two minutes.

Save SKILL.md into your agent's skills

  1. Download the skill

    Claude Code, and other agents that read Agent Skills, load it from this folder when they start.

    mkdir -p ~/.claude/skills/hyperframes-video
    curl -fsSL https://spiral.ai/skills/hyperframes-video/SKILL.md -o ~/.claude/skills/hyperframes-video/SKILL.md
    curl -fsSL https://spiral.ai/skills/hyperframes-video/audio-visualization.md -o ~/.claude/skills/hyperframes-video/audio-visualization.md
    curl -fsSL https://spiral.ai/skills/hyperframes-video/captions.md -o ~/.claude/skills/hyperframes-video/captions.md
    curl -fsSL https://spiral.ai/skills/hyperframes-video/durations-and-assets.md -o ~/.claude/skills/hyperframes-video/durations-and-assets.md
  2. Connect Spiral

    The skill runs its tools through Spiral. Send your agent this message once to set it up.

    set up https://spiral.ai/SKILL.md

Use the Spiral CLI

  1. Install and sign in

    Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

    npx -y spiral-cli@latest init
  2. Read the skill

    Built-in skills are on for every organization: the CLI prints this one with all its files.

    spiral agent-skills get hyperframes-video --json

Read it from the Spiral API

  1. Create an API key

    In the console, under API keys.

  2. Fetch the skill

    The answer holds SKILL.md and every other file of the skill, in path order.

    curl https://api.spiral.ai/v1/skills/hyperframes-video \
      -H "Authorization: Bearer $SPIRAL_API_KEY"

Then ask your agent for the task: it loads HyperFrames Video when a request matches the skill's description.

When to use (description)

Use when writing any NEW custom video composition (one HTML document rendered to MP4 by the HTML video renderer) — text and title animation, word-timed captions, mixed video/image/audio timelines, music and voiceover, transitions, charts, numeric tickers, logos and end cards, 3D or canvas. Covers the HTML composition format, GSAP timelines, clip timing, audio mixing, fonts, emoji and determinism rules.

Instructions

HyperFrames Video

New custom compositions are written as one HTML document and rendered to MP4 by HTML Video Renderer. Read its input schema, estimate the cost, then run it with { code, durationInFrames, fps, width, height }.

  • Changing a video you already rendered: keep the document you rendered, change only what the user asked, and render the whole changed document again.
  • Re-rendering without changes: reuse the existing video; do not render again.
  • Frame rate and size: pass fps: 30 and 1920×1080 (or the requested aspect at 1080 on the short side) unless the user asks otherwise. Use 60 fps only for fast motion the user wants extra smooth; it doubles render time.
  • The tool result is the final MP4. Its cost depends on the video's duration.
Which guide to load

Our render contract below always wins over the vendored upstream guides. Each of them starts with a "Rendering with HTML Video Renderer" section that says what to ignore.

NeedLoad
Contract details: data-* attributes, clips, tracks, determinism rules, common pitfallshyperframes-core
Motion rules, scene blueprints, transitions, text effects, Lottie/3D/canvas/other runtimeshyperframes-animation
Mixing, fades, ducking music under a voiceover, effects on a trackhyperframes-audio
Actual media durations, asset inclusion, public URLsdurations-and-assets.md
Captions: base layer, word timing, SRT, grouping, stylingcaptions.md
Audio-reactive visuals (waveforms, bars) in a custom compositionaudio-visualization.md

Conflicts, where ours wins: one HTML document only (no project files, no sub-compositions), the root id is root with timeline key root, and no CLI, Studio or registry commands.

Repeating a clip

Clips have no loop attribute (only <audio> supports data-loop="true"). To fill a window with a shorter video of probed length L, place consecutive <video> clips with data-start = k * L, data-media-start = 0, and trim the last data-duration to the remainder. If the source does not loop seamlessly (any AI-generated motion: dance, walking, running, character motion, music-video panels, backgrounds you cannot inspect), overlap adjacent clips by about 0.4 seconds and crossfade (tl.to(outgoing, { opacity: 0, duration: 0.4 }, boundary - 0.4) with the incoming clip starting at boundary - 0.4). Trim awkward startup frames with data-media-start.

The render contract

The renderer opens the document in a browser, seeks a paused timeline to each frame and captures it. Nothing plays in real time.

  1. Exactly one root element: <div id="root" data-composition-id="root" data-start="0" data-width="W" data-height="H" data-duration="SECONDS">.
  2. data-width/data-height must equal the call's width/height, and data-duration must equal durationInFrames / fps in seconds. Omit data-fps, or set it equal to fps. Validation rejects any mismatch before charging.
  3. Every timed element has class="clip", a unique id, data-start and data-duration (seconds) and data-track-index (an integer; higher draws on top only through CSS z-index, which you set yourself).
  4. Animation lives in one paused GSAP timeline registered as window.__timelines.root. Load GSAP with <script src="gsap.min.js"></script> — the renderer provides that file. No other local files exist.
  5. All media src values are public https URLs. Other scripts must be pinned versions from cdn.jsdelivr.net, cdnjs.cloudflare.com or unpkg.com.
Skeleton
<!doctype html>
<html>
  <head>
    <meta charset="utf-8" />
    <style>
      html,
      body {
        margin: 0;
        background: #000;
      }
      #root {
        position: relative;
        width: 1080px;
        height: 1920px;
        overflow: hidden;
        font-family: Inter, system-ui, sans-serif;
      }
      .fill {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
      #title {
        position: absolute;
        top: 260px;
        width: 100%;
        text-align: center;
        color: #fff;
        font-size: 104px;
        font-weight: 800;
        z-index: 10;
      }
    </style>
  </head>
  <body>
    <div
      id="root"
      data-composition-id="root"
      data-start="0"
      data-width="1080"
      data-height="1920"
      data-duration="12"
    >
      <video
        id="broll"
        class="clip fill"
        src="VIDEO_URL"
        data-start="0"
        data-duration="12"
        data-media-start="2"
        data-track-index="0"
        muted
      ></video>
      <audio
        id="voice"
        class="clip"
        src="VOICE_URL"
        data-start="0.5"
        data-duration="11"
        data-track-index="1"
        data-volume="1"
      ></audio>
      <audio
        id="music"
        class="clip"
        src="MUSIC_URL"
        data-start="0"
        data-duration="12"
        data-track-index="2"
        data-volume="0.15"
        data-loop="true"
      ></audio>
      <div id="title" class="clip" data-start="0" data-duration="12" data-track-index="3">Launch day 🚀</div>
    </div>
    <script src="gsap.min.js"></script>
    <script>
      const tl = gsap.timeline({ paused: true });
      tl.from("#title", { y: -120, opacity: 0, duration: 0.8, ease: "back.out(2)" }, 0);
      tl.to("#title", { scale: 1.1, duration: 0.4, yoyo: true, repeat: 1 }, 6);
      window.__timelines = { root: tl };
    </script>
  </body>
</html>
Media clips
NeedHow
Trim a sourcedata-media-start = seconds into the source where playback begins.
Picture only<video … muted>. Every <video> is either muted or data-has-audio="true".
Video with its own sound<video … data-has-audio="true"> (no muted).
Volumedata-volume (1 = unchanged, 0 = silent, up to ~4 to boost). Voice ≈ 1, music under voice ≈ 0.1–0.2.
Fadesdata-fade-in / data-fade-out in seconds on audio or video clips.
Speeddata-playback-rate (0.1–10).
Loop music for the whole videodata-loop="true" on the <audio>; the renderer repeats it to fill data-duration.
Still image for a time window<img class="clip" …> with its own start/duration.

Clips are hidden outside their window automatically; you only animate what happens inside it. Size and position media with CSS (object-fit: cover|contain).

Durations (non-negotiable)

Full rules and probe commands: durations-and-assets.md.

Never guess media durations. Use the duration from the generation or word-timing result, or probe the file with your own FFprobe (ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 '<url>'); with Spiral tools only, see durations-and-assets.md (media understanding, labelled approximate). Then:

  • data-duration of each clip ≤ the remaining source length after data-media-start.
  • The root data-duration covers the last clip end; set durationInFrames = round(seconds × fps) from that same number.
  • Caption timestamps are milliseconds (normalised as in captions.md, "Getting word timing"); divide by 1000 for timeline positions.
Asset inclusion (non-negotiable)

Every generated and user-supplied asset the video needs must be in the FIRST render: base footage or images, voiceover, music, logo, end card. Captions alone are not a video; include their base layer. A render that succeeds without the user's media is still a failed task.

Animation rules
  • Tween with the timeline only: tl.from/to/fromTo/set(target, vars, positionSeconds). Position every tween explicitly (third argument) so timing never depends on order.
  • Use eases and staggers freely (stagger: 0.08, ease: "power3.out"). yoyo/repeat must be finite.
  • Forbidden (they break frame-accurate rendering): Date.now(), performance.now(), requestAnimationFrame, setTimeout/setInterval for motion, unseeded Math.random(), fetch/XHR after load, autoplaying media, CSS transition.
  • Randomness: use a seeded generator, for example const rnd = (s) => ((Math.sin(s * 9301 + 49297) * 233280) % 1 + 1) % 1;.
Per-frame logic (tickers, charts, counters, waveforms)

When state is a function of time rather than a tween, drive it from the timeline's onUpdate. The renderer fires it for every seeked frame:

const FPS = 30;
function draw(t) {
  const frame = Math.round(t * FPS);
  document.getElementById("count").textContent = Math.round(Math.min(1, t / 3) * 12500).toLocaleString(
    "en-US",
  );
  document.getElementById("bar").style.width = `${Math.min(100, t * 25)}%`;
}
const tl = gsap.timeline({ paused: true, onUpdate: () => draw(tl.time()) });
tl.set({}, {}, 12); // timeline length = composition duration
draw(0);
window.__timelines = { root: tl };
Word-timed captions

See captions.md for the base-layer rule, SRT input, grouping and styling. Minimal version:

Group words into short lines (about 3–6 words), show the active line, and highlight the active word:

const WORDS = /* normalised words { text, start, end } in ms */ [];
const cap = document.getElementById("captions");
function drawCaptions(t) {
  const ms = t * 1000;
  const i = WORDS.findIndex((w, k) => ms >= w.start && (k === WORDS.length - 1 || ms < WORDS[k + 1].start));
  if (i < 0 || ms > WORDS[WORDS.length - 1].end) {
    cap.innerHTML = "";
    return;
  }
  const start = Math.floor(i / 4) * 4;
  cap.innerHTML = WORDS.slice(start, start + 4)
    .map((w, k) => `<span class="${start + k === i ? "on" : ""}">${w.text.replace(/</g, "&lt;")}</span>`)
    .join(" ");
}

Style .on with a contrasting background (for example #FFFF00 on black text) and keep captions inside the safe area (≥ 80px from the bottom on vertical video, clear of platform UI). Call drawCaptions(t) from draw(t) as above.

Text, fonts and emoji
  • Google Fonts work: <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;800&display=swap" rel="stylesheet">. Always end the font-family stack with a generic family.
  • Emoji render in color; put them directly in the text.
  • Size text for the frame: on 1080×1920, headlines 90–140px, captions 56–72px, never below 40px. Exact copy (URLs, prices, legal text) belongs in HTML text, not in generated imagery.
Transitions and layout
  • Crossfade: overlap two clips by the transition length and tween the outgoing one to opacity: 0 and the incoming one from opacity: 0.
  • Slide or zoom: tween x, y, scale on the clip element.
  • Ken Burns on stills: tl.fromTo("#img1", { scale: 1 }, { scale: 1.08, duration: clipSeconds, ease: "none" }, clipStart).
  • Split screens, picture-in-picture and grids are plain CSS: absolute positioning, clip-path, border-radius, box-shadow.
Libraries

Load pinned builds only from the allowed CDNs, initialize them before the timeline is registered, and drive them from draw(t):

  • Charts: d3 (https://cdn.jsdelivr.net/npm/[email protected]/dist/d3.min.js) — compute layouts once, update attributes in draw(t).
  • 3D: three.js — render the scene inside draw(t) with the camera/object state derived from t.
  • Lottie: lottie-web — load with autoplay: false, then anim.goToAndStop(t * 1000) in draw(t). Inline the animation JSON in the script (no fetch).
When validation fails

The renderer refuses a composition that breaks the rules at no charge, naming each problem (root size/duration mismatch, missing id on media, a non-https src, a disallowed script host, lint findings with fixes). Fix all of them and render again.

Files · 3

audio-visualization.md
# Audio-Reactive Visuals

The page cannot analyse audio at render time (no fetch after load, no autoplay). Pre-compute the loudness curve instead, embed it as a constant, and draw from it.

1. Probe the actual duration (`durations-and-assets.md`).
2. Before writing the composition, sample the audio into amplitude values (for example 30 per second): decode it to mono PCM and take the RMS per window, normalised to 0-1. For per-band bars, compute a few band energies per window.
3. Embed the array: `const AMP = [0.12, 0.31, ...]; // 30 values per second`.
4. In `draw(t)` read `AMP[Math.min(AMP.length - 1, Math.floor(t * 30))]` and set bar heights, a radial scale or a path from it. Smooth by averaging neighbouring samples.
5. Keep the audio itself as a normal `<audio class="clip">` element.
captions.md
# Captions in Custom Mode

For "add captions to a video" the default is the one-call subtitle model `fal/veed/subtitles` (see the **video-captions** Skill). Use a custom composition only for active-word highlighting, a bespoke animation, audio-only input, or existing word-timed data that needs a custom look.

## Captions are an overlay, never the content

Pick the base layer first and include it in the same render.

| User provides                       | Base layer                                  |
| ----------------------------------- | ------------------------------------------- |
| A source video                      | That video, full frame                      |
| Audio only                          | Waveform, cover art or image plus the audio |
| A script (we generate narration)    | Ken Burns image slideshow plus narration    |
| Mixed media the user gave           | Ordered timeline                            |
| Multi-scene AI clips plus narration | Clips plus per-scene audio                  |
| Nothing                             | Stop and ask what to caption over           |

## Getting word timing

Priority: existing word-timed data (normalise to milliseconds once) -> a word-timing transcription tool (below) -> approximate timing from TTS text and actual audio duration (say it is approximate) (say so). Words are `{ text, start, end }` in milliseconds. A source audio URL alone creates no captions, and labels without speech (an "#ad" tag) are authored directly as timed text. When several clips were transcribed separately, add each clip's start offset (ms) to its words and sort by `start`.

**Word-timing transcription tool.** Run a transcription tool whose input schema offers word-level timestamps, such as `elevenlabs/scribe_v3`, `deepgram/nova-3` or `assemblyai/universal-3-5-pro`; read its input schema and estimate the cost first. Normalise its words once into the caption contract: one `{ text, start, end }` per spoken word, in result order, with times in milliseconds (multiply seconds by 1000 and round; keep values already in ms). Drop entries that are not words, such as spacing or sound-event tags, and keep any reported audio duration for the timeline. Every skill that needs word captions uses this step.

Caption text is the exact spoken words, never a summary: for narration you generated, that is each segment's TTS input text, timed with the word-timing tool on that segment's audio before the first render. Say in the reply whether the timing was measured or approximate, and before claiming sync, compare a few late caption times with the finished file's audio.

### SRT input

Read the `.srt` file and convert it to the word array before writing the HTML (the page cannot fetch at render time). Each cue `HH:MM:SS,mmm --> HH:MM:SS,mmm` becomes `{ text, start, end }` in ms; split a cue into words by dividing its time range evenly if no finer timing exists. Embed the array as a constant.

## Rendering

Embed the array as `const WORDS = [...]` and draw from the timeline's `onUpdate` (see `SKILL.md`). Rules:

- Group words into short lines: start a new line after a pause over 700 ms, or when a line spans 1200 ms or 4-6 words. Do not chunk by fixed word count alone.
- Active word: `ms >= w.start && ms < next.start` (use the next word's start so there is no flicker between words). Show nothing during silence.
- Keep `white-space: pre` so leading spaces in word tokens survive.
- Captions sit above the base layer (`z-index`), inside the safe area (at least 80 px from the bottom on vertical video).
- Ask whether the style applies to all words on screen or only the word being spoken; do not assume.
- Style knobs: position (`top`, centre, bottom via flex alignment and padding), background (semi-transparent box or text shadow only), highlight (colour change, background pill, scale pop with a short `gsap` tween at the word's start, underline).
- Guard against zero-length words: when tweening a line in and out, make every fade boundary strictly later than the previous one (`Math.max(prev + 0.001, candidate)`).
durations-and-assets.md
# Durations and Asset Inclusion

Two non-negotiable rules for every render.

## Actual media duration

Never assume, guess or hardcode the duration of an audio or video URL. Wrong durations cause desynced audio, frozen frames and cut-off content. Obtain the real value first, then use that exact number in `data-duration` and `durationInFrames`.

1. **Generation responses.** TTS and video-model results include duration metadata. Use it; do not discard it for a guess.
2. **Word-timing results.** A transcription tool may report the audio duration; use it. Normalised word `start`/`end` values are milliseconds (`captions.md`, "Getting word timing"), and the last word end is only a lower bound because trailing silence may remain.
3. **Probe the file** for any user-provided or pre-existing URL. This needs FFprobe in your own environment (`spiral/ffmpeg` returns only a file, never printed numbers, and its results carry no duration). With Spiral tools only, ask a media understanding tool (`gemini/gemini-3.8-flash`) for the duration and size, label them approximate, and leave a little slack at clip ends. With your own FFprobe:

```
ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 'https://...'
ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 'https://...'
```

Violations to avoid: hardcoding "about 10 seconds", assuming AI clips are ~5 s, copying clip 1's duration to clip 2, rounding.

Flow: generate or receive the URL, read the duration, store it, then use that exact value everywhere. Convert once: `durationInFrames = round(seconds * fps)`. Transitions that overlap clips shorten the total by the overlap.

## Asset inclusion

Every required item must be in the FIRST render: each generated asset URL (images, clips, lipsync videos, narration, music, logo, end card) and each user-provided source the request implies (the video to caption, the audio to transcribe, the image to animate). No placeholders, empty arrays or "next iteration".

Pre-flight before every call:

1. List the required items: generated this turn, provided by the user (including earlier in the thread), implied by the request.
2. For each item, point to the exact field or element that references it. If you cannot, add it.
3. Every `<video>`, `<audio>` and `<img>` `src` must be a real public `https` URL. Never emit a media element with an empty, undefined or placeholder `src`; omit the element instead (an audio-only scene gets a colour, image or waveform base layer).
4. A lipsync video replaces the source image. Use the lipsync URL.
5. Overlays (captions, hook text, lower-thirds, watermarks) need a base layer. Captions on a black background are a bug.
  • Use when producing a narrative video about historical figures, fictional stories, day-in-the-life pieces, educational explainers with a protagonist, brand mascot stories, and any narrative video that depends on a consistent main character across scenes. Methodology for producing multi-scene character-driven short films: covers the full 11-phase pipeline — creative brief, style reference, character sheet, scene stills, animation, voiceover, per-clip audio mix, stitching, music with proper fade technique, optional subtitles, and optional Fin card — plus approval gates, parallelization strategy, asset naming, and the prompting principles that hold across video models. Tool and model selection is delegated to model-recommendations.

  • Use whenever the inferred intent is a continuous tracking shot or a long single-take video built from chained clips, including character-following journeys ("the character walks from room to room", "follow the figure across the city"), or an AI transition between two known frames (a first-to-last-frame clip from a start image to an end image, seamless loops from one image, chains of transitions A→B→C). Frame chaining: extract last frame → feed as next input → repeat → stitch. Covers workflow modes (all-at-once vs step-by-step), prompting rules, aspect ratio discipline, last-frame quality control, stitching, character continuity (original reference on every clip through reference-to-video, the handoff frame as an extra reference only, locked character description string, locomotion-through-space rule, the rear-facing danger, corrective stills), the morphing problem and visual bridges, and prompting cheat sheets for style/audio/camera.

  • Use when the user explicitly asks for Gemini Omni, Omni Flash or Google's Omni video model: text-to-video, image-to-video, reference-to-video or editing a short video with Gemini Omni. Covers finding the tools, duration format, edit-video preparation, prompt structure, media role tags, audio behavior, text rendering, timing, and how to prepare source media.

  • Use when a HyperFrames composition needs any motion or animation: atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.

Questions about HyperFrames Video

What does the HyperFrames Video skill do?

Use when writing any NEW custom video composition (one HTML document rendered to MP4 by the HTML video renderer) — text and title animation, word-timed captions, mixed video/image/audio timelines, music and voiceover, transitions, charts, numeric tickers, logos and end cards, 3D or canvas. Covers the HTML composition format, GSAP timelines, clip timing, audio mixing, fonts, emoji and determinism rules.

Which tools does HyperFrames Video use?

It runs HTML Video Renderer, VEED Subtitles, Scribe v3, Nova-3 Speech to Text, Universal-3.5 Pro Speech to Text, FFmpeg Media Editor, Gemini 3.8 Flash Media Understanding (image, video, audio, PDF) through Spiral, each at the price on its tool page.

Does the HyperFrames Video skill cost anything?

The skill is free. The tools it runs are billed pay-as-you-go from your Spiral balance at each tool's stated price, with no plan.

How does my agent know when to use HyperFrames Video?

An agent reads each skill's description and loads its instructions when a request matches it.

How do I add HyperFrames Video to Claude Code?

Save its files into ~/.claude/skills/hyperframes-video/ with the commands on this page; Claude Code loads it when it starts.

Can I use HyperFrames Video in other agents?

Yes. Any agent that reads Agent Skills folders loads the same files, and any other agent reads the skill with `spiral agent-skills get hyperframes-video --json` or the Spiral API.

Is HyperFrames Video on for my Spiral organization?

Yes. Built-in skills are on for every organization; an admin can turn HyperFrames Video off on the console's Skills page.

Where is the HyperFrames Video SKILL.md file?

At https://spiral.ai/skills/hyperframes-video/SKILL.md, with no key needed. On the console's Skills page, Customize saves a copy you can edit as your organization's own skill.