⏳ This skill is pending AI review.

Scores will appear once the review pipeline completes.

v1.9.0

video-director

sallyrs@sallyrs⭐ 33 stars· last commit 19d ago· 0 open issues

>

Choose how to use this skill

You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.

1. Native installer

This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.

Do not guess an installer command or replace an existing version without reviewing the diff.

2. Complete package recommended

Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.

No complete ProSkills package is published for this listing yet.

3. Prompt-only

Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.

Need only the instruction file?

Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.

No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.

—/10

// RATINGS

⭐GitHub Stars
⭐⭐ 33 on GitHubGitHub ↗

Growing

🟢ProSkills Score
—
📍

Not yet listed on ClawHub or SkillsMP

// README

Video Director

A Claude Code skill that directs short videos from brief to finished render. Product launch films, explainers, brand films, designed demos, vertical social shorts, event and data videos, and live-action story ads, from about 6 seconds to 3 minutes, mixing motion graphics with photos, footage and generated clips.

You direct; Claude designs and builds. Nothing is animated until you have approved it as still frames, and every visual decision is a pick from 2-3 real options, never a reaction to one take.

Reviewing a storyboard: flipping through a scene's frames and pinning a note to one

The storyboard and film examples on this page are from a real project: a 52-second ad for Best Light, a Mac webcam app. All the people in it are AI-generated.

What's inside

  • Rules measured from real films, not guessed. Text sizes, positions, reading times and motion rules come from measuring 59 films across seven types. The visual ideas come from studying 34 films and ads. The lessons from building real films were checked against 56 more before they became rules.
  • 8 video types, each with its own defaults, films worth studying, and a "default versus better" table: product launch, explainer, brand film, demo or tutorial, social short, event, recap or data, showcase, and live-action story.
  • 57 animation styles in five groups (motion design; drawn and illustrated; paper, craft and physical; graphic and type-led; 3D and texture), each with an example picture and a film to look up.
  • A zoomable storyboard page you can pin notes to, a motion spec with a named move, timing and easing for every change, and an animated test before the full build.
  • Sound made by film type. Live-action films take their sound and spoken lines from the video model, checked with speech-to-text. Motion-design films get a few real recorded effects. Every film's music is fitted to the cut on its bar lines (scripts/fit_music.py). Every sound file is listed with its source and licence, and scripts/check_sources.py checks the list.
  • A sound engineering step for effects. Every sound is planned with the motion spec, one moment at a time. The scripts of real-sfx by Clipwing, built into Video Director, place a real recording from your own sound library on each planned frame. scripts/sound_handoff.py hands them the plan and brings the effects track back. It checks every sound against the plan (nothing missing, nothing extra, nothing off its frame) and fills in the sources list. Then the levels are measured against the music, and you listen.
  • Render checks in Python: frames on both sides of every cut, choppy motion, text size and reading time by role, sound levels, continuity between shots, delivery specs, and an optional motion watch by a video model.

How it works

1. Brief and script. It asks what the film is for, who it's for, what tools you have, and whether to study reference films or build from scratch.

2. Pick a style. For a film with motion graphics, Claude builds a page with a picture of every animation style and puts the 3-4 that suit your film at the top. Pick one or more, describe the look you want in your own words, or say "you choose". Every picture shows the same desk by a window, so the styles are easy to compare.

Ten of the 57 styles, each showing the same desk by a window: isometric, soft 3D icons, duotone, watercolour, comic book, clay stop motion, origami, pixel art, neon grid and painterly 3D

The pictures were made for the library with image generation; they show a look, not how a film moves. All 57 are in skills/video-director/assets/style-library/.

3. Direction options. Before any storyboard, you pick a direction from 2-3 labeled still frames of the same moment.

Two direction options for the same moment, labeled A and B

4. The storyboard page. One HTML page you open in a browser. It shows the whole film in order, with each tile showing how its scene ends.

The storyboard overview: eight scene tiles with times and lines

It shows every change between scenes, side by side, with the move that connects them: the camera, what carries over, the timing and the easing.

The last frame of one scene beside the first frame of the next, with the cut described

Then it shows each scene as a card. Flip through its frames, zoom in, pin numbered notes to any spot, and copy or download every note to hand back to Claude.

A scene card with frame tabs, an Add pin button and the frame

5. Motion spec and sound plan. Every change on screen gets a named move, timing and easing before anything is animated. The sound is planned at the same time: where each sound comes from, and Suno prompts for the music.

6. Animated test, then the full film, with its sound, built with HyperFrames.

7. Render checks and polish rounds until you sign off.

Frames from the finished ad

Install

In Claude Code:

/plugin marketplace add SallyRS/video-director
/plugin install video-director@video-director

Or copy skills/video-director/ into ~/.claude/skills/.

Needs

  • Python 3 and ffmpeg for the render checks.
  • HyperFrames for the build.
  • Optional: yt-dlp to study reference films, a clip tool such as Higgsfield for generated footage, Codex for stills, and a Gemini API key for the motion watch (scripts/watch_cut.py). The skill works without them and says what it can't check.
  • Optional, for sound: Suno for music (a paid plan for anything commercial), whisper.cpp to check what generated clips say, aubio or librosa to find a track's bar lines, and your own sound library for the included real-sfx (it needs ffmpeg with the drawtext and rubberband filters, on macOS Homebrew's ffmpeg-full, and numpy for some scripts). Its settings live in ~/.config/real-sfx/, so plugin updates keep them.

The only sound files included are real-sfx's interface pack (uisfx, CC0). Sounds from the free libraries aren't included: their licences don't allow sharing the files on their own. references/sound-stage.md lists where to get sounds and what each licence allows.

Credits

Built on and informed by other people's open work:

  • HyperFrames by HeyGen: the HTML-to-video engine every film is built with.
  • motion-video-kit by echris6 (MIT): its measured rules from professional launch films shaped how this skill carries objects across cuts and treats reference films as something to measure, not imitate.
  • saas-motion-kit by tugrawork-creator (MIT): its variety rules for shot length, easing and transitions in HyperFrames films.
  • motionmaxxing by Tejashmakwana (Apache-2.0): the finding that a gallery of example films makes every brand look the same, which is why this skill pairs a default with a better decision instead.
  • onetake by feitangyuan: its numbers on rhythm and what carries across a cut. Ideas only; no text or code is used.
  • real-sfx by Alexander Korban

// HOW IT'S BUILT

// FILES

157 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.

  • skills/video-director/SKILL.md31 KB5adb2b295602upstream ↗
    ---
    name: video-director
    description: >
      Direct any short video (about 6 seconds to 3 minutes) that mixes motion graphics with generated or supplied
      photos, footage and clips, such as a product launch film, an explainer, a brand film, a designed demo or
      tutorial, a vertical social short, an event, recap or data video, or a live-action story or comedy ad with
      a character and a product moment. Take it from brief and script through
      design options, a zoomable storyboard page with reviewer notes, a motion spec with a named move, timing and
      easing for every change, an animated test, and a HyperFrames build. Show 2-3 options at every design
      decision. Use whenever someone wants to make, storyboard, restyle or rescue a video like this, even if they
      only say "animate this script", "make an explainer", "cut a 15-second version", "I want to see the
      storyboard first" or "it feels like slides". Not for recording a real product screen as a demo, adding
      captions to existing footage, or a single standalone animation such as a logo sting or lower third.
    ---
    
    > **Bundled scripts run with `python3`.**
    
    # Video Director
    
    You design and build the video; the user directs it. Nothing gets animated until the user has seen and approved it as still frames, and every visual decision is made by picking from 2-3 real options rather than by reacting to one take.
    
    The failure this skill exists to prevent is a video that feels like slides: separate layouts replacing each other with the same blur, everything dumped on screen at once, then a frozen picture. Every type of video avoids it differently, so the first decision is what type this is.
    
    ## Ground rules
    
    - **Talk plainly.** Say what changed and what it means. Give full absolute paths for every file you make.
    - **The script belongs to the user.** Keep its wording and order. If a new script arrives together with feedback on an older cut, that feedback was about the old version: apply it to how the film is made, not to the script. If the script seems to repeat an old problem, ask in one line.
    - **"Transformation" means on screen.** When the user says a video "doesn't show transformation", nothing visibly changes form. One element should become the next.
    - **Load taste first.** Before designing, read the project's `direction-notes.md` and any notes the user keeps about their design taste (memory files or project notes on design, color, layout, video). Earlier corrections live there; create an empty notes file for a new project.
    - **Version everything.** Every review page gets a new version number; the builder refuses to overwrite.
    - **Record decisions.** Each time the user picks an option or corrects something, add a dated line to `direction-notes.md` with the exact values. Later sessions read it instead of the chat.
    - **Before generating images or clips,** say what you will make and where it goes.
    
    ## Video types
    
    Pick the type in stage 1, then read its file in full before writing anything else. The type sets the structure and overrides the defaults below where they differ.
    
    | Type | What it is | File |
    |---|---|---|
    | Product launch | A product or feature shown through UI, motion and sometimes people; 30-90 s | `references/types/product-launch.md` |
    | Explainer | A concept or process made visible; usually narrated; 60-180 s | `references/types/explainer.md` |
    | Brand film | What a company stands for; one idea, people and places; often no product; 30-90 s | `references/types/brand-film.md` |
    | Demo or tutorial | Teaching a task with staged, zoomed UI; 60-180 s | `references/types/demo-tutorial.md` |
    | Social short | Vertical or square, 6-30 s, watched muted, hook in the first frame | `references/types/social-short.md` |
    | Event, recap or data | Openers, recaps, year-in-review, stories told with numbers; about 60-120 s | `references/types/event-recap-data.md` |
    | Showcase | A visual tour of something built; no captions, no explanation | `references/types/showcase.md` |
    | Live-action story ad | A character with a problem, a real setting and a product moment; usually comedy; 30-60 s | `references/types/live-action-story.md` |
    
    A film can mix types (a launch film with a data beat). Pick the main type and borrow single rules from another, saying which.
    
    ### Numbers that change by type
    
    Starting values drawn from the films studied. Live-action story ads keep theirs in their type file.
    
    | | Product launch | Explainer | Brand film | Demo / tutorial | Social short (9:16) | Event / recap / data |
    |---|---|---|---|---|---|---|
    | Where lines sit | top-center ~9% (continuous film), or dead-center claim cards (chapter film) | labels beside the thing they name | over the picture, about 40-57% down | beside the target; cards centered | about 15-30% down, or about 42-60% centered | titles centered, names lower-left |
    | Kept clear | bottom 17% | bottom 17% when captions or platform overlays apply | below 60%, except the end logo | bottom 17% for added text (UI may reach the edge) | top 14%, bottom 35%, sides 6%, extra room on the right | bottom 17%, except one name bar per speaker |
    | Scene or unit length | 4-6 s scenes, or a short claim card then a proof of several seconds | one narrated sentence (3-6 s in the films measured) | a steady unit of about 1-3 s | one step: 6-12 s with voice, 3-5 s without | beats of about 1-3 s, up to 4 s for calm films | shots of about 0.5-2 s; numbers hold long enough to read |
    | Hard cuts | 1-2 accents (continuous) or about 10-20 (chapter) | 0-5 (one world) or many with a thread (montage) | the main transition in footage films | few; more only when the backdrop holds | the main transition | the main transition in footage recaps |
    | Close | logo 1-3 s; whole close about 3-11 s | still card about 2-5 s | claim held on its own, then logo 1-4 s | about 3-9 s: the logo, or one line and the logo | no card, a loop, or a short tag (~1.5 s) | still lockup 1.5-3.5 s; longer over a moving ground |
    
    ## Project layout
    
    At stage 1, create the project folders as laid out in `references/project-layout.md`: brief, script, direction notes, ideas, references, storyboard, motion spec, assets, build and output.
    
    ## The stages
    
    Read `references/checkpoints.md` for response templates and stage-specific loading. Stop at every gate and wait for the user; reuse explicit decisions already made.
    
    | # | Stage | You make | Gate |
    |---|---|---|---|
    | 1 | Brief | `brief.md`: type, format, narration, people, footage, length, reference videos or none | Brief right? |
    | 1b | Style | for films with motion graphics: a page with a picture of every animation style and 3-4 suggested | Which styles? |
    | 2 | Script and story | `script.md` with the hook, the structure from the type file, one job per beat | Script locked? |
    | 3 | References | only when the user chose reference videos: notes on 3+ accessible real films, or an explicit reference-input hold | (no stop; feeds stage 4) |
    | 4 | Direction options | 2-3 directions as real frames of the opening | Which direction? |
    | 5 | Look decisions | one decision at a time, 2-3 options each | Each pick |
    | 6 | Storyboard | every scene, start and end frames, notes page | Approved, or notes |
    | 7 | Motion spec | scene lengths, then a named move, timing and easing for every change | Approved |
    | 7-9 | Sound | a sound plan, clip sound by film type, library effects placed with real-sfx, fitted music, `assets/audio/SOURCES.md` | Does it sound right? |
    | 8 | Animated test | the 2-4 hardest scenes in HyperFrames (a run from the start for live-action story ads) | Does it move right? |
    | 9 | Full build | the whole film and its cutdowns, checked frame by frame | Final |
    | 10 | Polish rounds | one new numbered render per round of notes, each note checked against its frames first | Each round signed off |
    
    ### 1. Brief
    
    Ask these as explicit decisions; never infer them or bury them in a settings list:
    - **Type** (table above), and whether it is explained or a pure showcase.
    - **Format**: 16:9, 9:16, 1:1 or 4:5, and any cutdowns (6, 15, 30, 60 s).
    - **Narration**: voiceover, on-screen lines only, or no words at all.
    - **Made of**: ask in these words: "What will the film be made of: motion graphics, footage, screen recordings, or a mix?" Footage can be real or generated; which part leads is yours to propose at stage 4.
    - **People**: real-looking people, illustrated characters, hands only, or faceless, and whether their own voices are heard.
    - **What must be real**: logo file, font, the real product's screens or a demo account, real footage or photos of real named people or events (recaps, and brand films with named people, need real material), music (their own track, or Suno on a paid plan). How people, B-roll, places and 3D are made is yours to propose at stage 4.
    - **Viewer**: who watches, what they know and doubt, where it's posted (this sets captions), what they should think or do afterward.
    - **Length**: check it against the type's usual range.
    - **Names and logos**: which may be shown.
    - **Media tools**: their clip tool (Higgsfield, another, or none) and stills (Codex or their own photos). If the proof needs real motion and there's no clip tool, say so (`references/media.md`). Also ask whether cuts may be uploaded to Google's Gemini API for the motion watch (`references/build-and-qa.md`).
    - **Reference videos**: ask in these words: "Are there any videos you'd like me to study before designing, or shall I start without reference videos? (We'll choose the look separately.)" Yes: ask which films (a named film counts), for an OK to download, and "Is it the look of these you want, or something else about them, like the pacing?" No: the film is built from scratch; skip stage 3. Unsure: recommend one in a line (from scratch for a common type; references for an uncovered look or a high-stakes film).
    
    Write the answers into `brief.md`; never invent them.
    
    ### 1b. Style
    
    For a film with any motion graphics, the user picks the look from a page with a picture of every animation style: follow "Stage 1b" in `references/animation-styles.md`. Never pick the style without asking. Skip it for a film made only of footage (its look is planned at stage 4), and when the reference videos show the look: name that style in one line so the user can correct it.
    
    ### 2. Script and story
    
    If the user brings a script, put it in `script.md` as a table (scene, name, lines, narration, and for launch and demo films a proof column) and keep it. If you draft lines, write plain sentences a person would say: no stacked fragments, no triplets of parallel lines, no "Meet X", "Introducing" or "Not just X, it's Y". Run `python3 <skill>/scripts/scan_script.py script.md --out output/script-language-review.json`; review each candidate in context and preserve supplied wording unless the user approves an edit. Then check the story against the type file's structure:
    - **Hook**: the first 1-3 seconds show the strongest picture or a felt situation, not a logo or a company description.
    - **One promise**, made by the second beat; everything after is evidence.
    - **One job per beat.** The key moment gets about twice the time of minor beats.
    - **One turn or change of energy** somewhere past the middle.
    - **The opening device and the closing device** are chosen on purpose, not added by reflex.
    - **It makes sense with the sound off**, unless it is narration-led.
    - **Product launch and demo films: name the proof for each claim.** Beside every claim in `script.md`, write what on screen will prove it, found with the beat method in `references/visual-ideas.md`.
    
    ### 3. References
    
    Skip this stage for a film built from scratch, saying so in one line. Otherwise study three accessible real films before drawing. If the user named a film, it is one of the three; if they picked styles at stage 1b, at least one film is in a picked style (studied for its look only), and the rest are of this type; follow `references/reference-films.md` if access is unavailable. The type file names starting points and what to look for. Pull stills with ffmpeg and note the mechanism: what carries across cuts, where text sits (as a percentage of frame height), shot lengths, how the close is built. Borrow mechanisms, never a film's look, logo or footage. Method: `references/reference-films.md`.
    
    ### 4. Direction options
    
    Turn the stage 1b picks into directions as "Stage 4" in `references/animation-styles.md` says; plan any footage's look with `references/footage-looks.md`. If the user named a film, at least one direction uses that film's style and mechanisms, never its look. The house rules still apply. Show the user actual still options.
    
    Make 2-3 directions that differ in their central idea (the type file says which kind of difference matters), not three colors of one layout. Each direction states its whole visual plan in the option's `plan` field:
    - the idea in one sentence, with the product in it;
    - what the product does at the turn;
    - the media mix: one lead medium, plus inserts with one job each;
    - one named drawing style;
    - the recurring element (or none, on purpose);
    - one way of moving between ideas;
    - the end line.
    
    Find the idea and run the five checks in `references/visual-ideas.md` before drawing. You propose the media yourself (B-roll, 3D, how any people are shown); the brief says whether people appear and what must be real.
    
    Draw the start and end frames of the first one or two scenes with the frame kit and build an options page:
    
    ```bash
    python3 <skill>/scripts/render_frames.py storyboard/frames.html --ids 01a,01b,02a --out storyboard/options-direction-v0.1
    python3 <skill>/scripts/build_storyboard.py storyboard/options-direction-v0.1.json storyboard/options-direction-v0.1.html
    ```
    
    Start the JSON from `assets/options-direction-starter.json`. Name the style behind each direction, and the reference technique too when references were studied, then recommend one in one or two sentences.
    
    ### 5. Look decisions
    
    Settle the look one decision at a time, each with 2-3 options on the same frames: in product launch, demo and live-action story films, how the product is shown (recorded screens, the real interface rebuilt, or people and illustration with little interface; the type file says what each costs), then color treatment, then the signature scene's layout, then where text sits. Use the variant switch for color (render with `--variant <name>`, start from `assets/options-color-starter.json`). Reading the answers:
    - When an answer is ambiguous ("1 looks nicer"), say which option you took it to mean.
    - "I like 1 and 3 but it feels too X": keep both, fix X on both, show them again.
    - Fix the thing the user pointed at; an idea they call "interesting" is a bonus, not the main ask.
    - If they dislike every option, name what all the options shared before making new ones.
    
    More: `references/options-rounds.md`.
    
    ### 6. Storyboard
    
    Design every scene: a start frame and an end frame, plus an in-between frame whenever the change can't be pictured from the two ends. Use the frame kit (`references/frame-kit.md`) with `BRAND.size` set to the format; the renderer reads it and renders at that size. Render, read the check output, fix, then build the page. Before drawing a scene, run the beat method in `references/visual-ideas.md` (section 3) on its key line. Plan generated people and products with `references/generated-clips.md` before counting clips.
    
    ```bash
    python3 <skill>/scripts/render_frames.py storyboard/frames.html --all --out storyboard/frames-v0.3
    python3 <skill>/scripts/build_storyboard.py storyboard/storyboard-v0.3.json storyboard/storyboard-v0.3.html --previous-notes <notes downloaded from v0.2>
    ```
    
    The page shows the whole film in order, each scene change as the last frame beside the next first frame, and a card per scene with full-width frames, 8x zoom, pins and a notes box. Tell the user they can pin comments and use **Copy all notes**. When notes come back, answer every point in a numbered list before redrawing. JSON format: `references/storyboard-format.md`.
    
    ### 7. Motion spec
    
    Read `references/motion-library.md`, `references/motion-spec.md` and the type file's motion section, then check the storyboard's motion notes against them and list every conflict. Then:
    
    1. **Fix scene lengths first**, by the type's rule (shot shape, narrated sentence, unit, step or beat), so every line stays readable (`references/text-and-captions.md` has the reading times). Short scenes force everything on screen in the first second. Tell the user the new total.
    2. Give **every change inside a scene and every change between scenes** a named move, timing, easing, and what carries over.
    3. Plan sound with the picture (`references/sound-and-voice.md`): write the sound plan, every moment that makes a sound, and start the Sound stage (`references/sound-stage.md`).
    4. Write it into the storyboard JSON and `motion-spec.md`, rebuild with `--strict`, and show the user.
    
    `--strict` checks the motion fields (`references/storyboard-format.md`); review its fade/blur candidates and NOTE lines.
    
    ### 8. Animated test
    
    Build the 2-4 hardest scenes in HyperFrames first (the type file may say otherwise), with `data-text-role` on every element that holds words. Read the HyperFrames docs before writing composition HTML (`references/build-and-qa.md`). Run the outside comparison described there (a reference film of the same type, or the type's numbers for a film built from scratch) and report where ours loses. Ask the user to watch for pacing and for anything that still feels like slides, and to listen to the sound. Run the stage 9 checks on the test too.
    
    **Every render the user sees** opens by saying which scenes it covers and what is still a placeholder. In a film with people shown as footage, a person's action is moving footage (a generated or supplied clip), never a still with a push; a shot not ready is left out or marked as a placeholder on screen. In live-action story ads, the product's screen is a screen recording of the real app unless a rebuilt interface was approved at stage 5.
    
    ### 9. Full build and checks
    
    Build the rest and any cutdowns and render. **No render goes to the user until the render check passes:**
    
    ```bash
    python3 <skill>/scripts/check_render.py build/ --motion --video output/cut-v3.mp4 --out output/checks-v3
    python3 <skill>/scripts/cut_frames.py output/cut-v3.mp4 --out output/cuts-v3
    python3 <skill>/scripts/action_frames.py --actions build/actions.json --motion-spec motion-spec.md --build build/ --video output/cut-v3.mp4 --out output/actions-v3
    python3 <skill>/scripts/continuity_sheet.py output/cut-v3.mp4 --items build/continuity.json --out output/continuity-v3
    python3 <skill>/scripts/sound_handoff.py collect build/audio/sound-plan.json --resolved build/audio/sfx/result/fx_resolved_cues.json --track build/audio/sfx/result/fx_sfx_track.wav --fps 30
    python3 <skill>/scripts/check_sources.py assets/audio
    python3 <skill>/scripts/sound_balance.py --music build/audio/music.wav --effects build/audio/effects.wav --voice build/audio/voice.wav --events build/audio/events.json --out output/sound-v3
    python3 <skill>/scripts/watch_cut.py output/cut-v3.mp4 --out output/watch-v3 --upload-allowed --notes direction-notes.md
    ```
    
    Exact render-check failures must be fixed; candidates need a recorded visual judgment (`references/build-and-qa.md`). Required on every render the user sees from stage 8, every strip and sheet opened:
    - **Cut strips** at every cut; **action strips** at every click, press or touch inside a shot (a pointer off its target fails), or an empty `actions.json` for a film with none.
    - **Continuity sheets** for films with generated clips of recurring people, places or props: one verdict line per recurring prop and garment; `--verify` passes.
    - **Sound** for films with effects or voice: effects made by Sound engineering (`references/sound-stage.md`), the plan matched (`sound_handoff.py collect`), and the balance from the stems. Claude can't hear: report the numbers.
    - **A fresh read** by a new agent, or a build-log line saying why not.
    
    The motion watch is extra coverage (`--upload-allowed` only if the brief allows; confirm findings in frames; otherwise say "not watched in motion"). A clean watch is never proof: it sees low-resolution frames.
    
    Every element holding on-screen words carries `data-text-role`: `opening`, `line`, `emphasis`, `card`, `label`, `caption`, `name`, `typed`, `legal`, or a named UI role (`ui-title`, `ui-row`, `ui-pill`; one role per kind of UI text, so each is checked for one size). `ui-read` marks UI text the viewer must read.
    
    Then check the rest: overlaps during transitions, frozen stretches, text too small at phone size, warped hands or faces in generated clips, measured spacing, the close against the type's numbers, and a muted watch. Then repeat the outside comparison.
    
    ### 10. Polish rounds
    
    Once the full film exists, most of the work is rounds of notes against timestamps. Each round runs the same way (details: `references/polish-rounds.md`):
    
    1. **Find each note in the frames before changing anything.** Pull frames at the time given, 1 s either side, and say back the moment by what is on screen and what you will change. When a word in the note could mean a line of text or an object on screen, say which one you took it to mean.
    2. **Show design changes as stills first.** Any change to how something looks gets labeled stills next to the current frame, with a recommendation, before it is built.
    3. **One new numbered render per round**, with the stage 9 checks, a phone copy under 30 MB, and one build-log line.
    4. **When a check disagrees with something the user chose on purpose**, list it as the user's call with the evidence; don't quietly undo their choice.
    5. **Choppiness the render check missed**: follow `references/polish-rounds.md`, don't guess.
    6. **After every third round, and before calling a cut final, do an ideas pass**: run the beat method in `references/visual-ideas.md` on each key line and offer the best ideas as stills. Rounds that only answer notes make a film smoother, not stronger.
    
    ## Design rules for every type
    
    A type file says where it loosens one of these house rules; anything marked "ask first" there needs the user's OK.
    
    **Continuity, not slides**
    - At every change, something survives and carries into the next shot: an object (a chip becomes a tile), the words (a line stays while the picture changes), an eye line, or a system that rides every clip (a typed query, a name bar, a chapter color). If nothing survives, it is a slide change.
    - During a change, the content or the shape carries over. Never show an empty card or panel in motion; if its text clears first, the shape itself carries the change.
    - In a build-up of items, the first item stays sharp and on screen until the build is done. It may slide or scale once to make room, or move with a camera push; it never blurs, dims or leaves early. (A build made of cuts is exempt.)
    - No bounce or elastic easing on text. Replace any recipe's `back.out`. A drawn character may squash and overshoot as acting.
    - Pieces arrive one after another through the middle of a scene (on the spoken cue when narrated), then the result holds still for at least a second. In fast types (brand units, recap shots, short beats, teaser openers) the one-second hold applies to the claim, numbers and lines, not to every shot. No slow drift, breathing or floating as filler. A character may blink and breathe, a live product output may keep moving, and a carrier may keep moving while a number holds.
    
    **Style choices made per film** (record each in the storyboard's `style` field; the defaults follow the film's style)
    - How scenes change: one kind of change for the whole film with variety underneath, or a small set used with intent. Default: one kind for footage-led films that hard-cut on action and for single-camera motion films; chapter and mixed-media films may change kind per chapter.
    - Dissolves and blur: default none between scenes in hard-cut footage films (still allowed: a dissolve into the end card, a short text blur-out, real camera motion blur). Calm text-led films may fade text in place. Motion-graphics and UI films may use motion blur on fast moves.
    - How content leaves: default it leaves because the camera moves, because it turns into the next thing, or on the cut. Calm text-led films may fade lines out first; lower thirds may wipe out before their shot ends.
    
    **Visual ideas and media** (details: `references/visual-ideas.md`)
    - Each picture says the line before anyone reads it: a fan of lines into one hub says "connected"; a scatter only says "many". Write at least 8 ideas for a key line before picking.
    - One drawing style for the whole film. Footage, photos, UI and 3D may mix; a second drawing style needs one job and the film's own ground and colors (or a look viewers already know), never a one-off.
    - One lead medium for at least half the film; every other medium is an insert with one job. The recurring element, if there is one, appears in each medium.
    - One kind of join between media, hard cuts by default; join on a shared subject, shape or color where you can.
    - Whiteboard and hand-drawn films keep footage around the drawing or on the end card, never cut in mid-film.
    
    **Layout and look**
    - No card grids, sidebar app screens, or "headline left, product right". One big white panel per scene is still card-heavy. A grid is allowed only when the idea is "many" and every cell is alive.
    - No colored accent borders or stripes, no small labels above headlines, no gradient text, no glow around logos.
    - Show activity, not screens: typing, results arriving, a hand or cursor causing each change, objects moving and docking.
    - Depth is a strong tool (layers at different distances, slabs with thickness, far things blurred), not a requirement. Flat 2D works when the object keeps changing form.
    - Designed backgrounds are flat: black, white, or one brand color per scene or chapter. Offer a gradient or glow only if the brand already uses one. Edge darkening is optional, not a default. In footage-led films the picture is the background; designed backgrounds appear mostly on title and end cards.
    - Color has a job: state (problem vs. fixed), category, or chapter. Take it from the brand's own colors and shapes; never blur brand colors together.
    - End on one line or the logo alone, never a two-sentence tagline. Add a web address only when the viewer can act on a page now; the type file says when, and how long to hold the end.
    - The logo appears with a job: once at the end as a signature on the film's own surface, or as something the film forms. Never as decoration, never repeated.
    - The brand's own logo comes from its official file from the first frame it appears in, storyboard frames included. A redrawn copy gets details wrong. With no file yet, label every frame that shows it as a placeholder.
    - Items in one list or pile are the same kind of thing (all tasks, or all messages). A property of an item, such as a due date, is a tag on that item, not an item of its own.
    
    **People and pictures** (making them, and other companies' logos: `references/media.md`)
    - People are a brief decision. When people appear: show the face of anyone named on screen; cast deliberately diverse people; show what each person is doing; show hierarchy by size and position.
    - Generated stills and clips never contain text, UI or logos. Type, UI and data are built in the frame, where they can be edited and are correct.
    - When the product's interface is shown, it matches the real product, and it never shows an invented result as if the product produced it.
    
    **Text on screen** (the full rules, sizes and reading times: `references/text-and-captions.md`; read it before any text appears)
    - Keep the text systems apart, each in one home position for the film (the type table above gives the default); never stack three at once.
    - One size per text role, above each role's minimum (`scripts/check_render.py` enforces both); one capitalization rule for every line; everything inside the format's safe area.
    - A line never covers eyes, a mouth, an icon, a logo or the thing being taught.
    - Typed product text builds up as it is typed and finishes within about 2 s.
    
    
    ## Tools
    
    Which tool makes what, with each tool's notes: `references/tools.md`.
    
    ## Before you show anything
    
    Before sending any page or render, go through every frame against `references/pre-show-checklist.md` and tell the user what changed, what you could not do or check, and the open questions.
    
    ## Reference files
    
    | File | Read when |
    |---|---|
    | `references/types/<type>.md` | Stage 1 onward: structure, defaults and references for the chosen type |
    | `references/project-layout.md` | Stage 1: the project's folders and what goes in each |
    | `references/pre-show-checklist.md` | Before sending any page or render |
    | `references/tools.md` | Which tool makes what, with notes |
    | `references/checkpoints.md` | Each stage: response template, approval gate and next permitted reference loads |
    | `references/animation-styles.md` | Stages 1b and 4, and stage 3 for a picked style: animation styles by group, each with a picture (`assets/style-library/`), an example film and how it's made |
    | `references/footage-looks.md` | Stage 4 for films with footage: ideas for how footage looks, not shown to the user as a menu |
    | `references/visual-ideas.md` | Stages 2, 4, 6 and 10: finding the film's idea, mixing media, turning each line into a picture, rules for whiteboard and 3D |
    | `references/options-rounds.md` | Stages 4-5: how to make and present options |
    | `references/frame-kit.md` | Stage 4 onward: the frame helpers, formats, rendering, common errors |
    | `references/storyboard-format.md` | Writing storyboard or options JSON; the notes round trip |
    | `references/text-and-captions.md` | Any on-screen text: the text systems, reading times, safe areas by format |
    | `references/sound-and-voice.md` | Stages 2 and 7: narration, music, effects, silence, mix |
    | `references/sound-stage.md` | Stages 7-9: the sound plan, making the sound by film type, Sound engineering with real-sfx, fitting music, sound sources and licences |
    | `references/real-sfx-scripts.md` | real-sfx's scripts (Clipwing), which Sound engineering runs: event kinds, typing, library search, a sound's settings and levels |
    | `references/motion-library.md` | Stage 7: proven shot shapes and transition families |
    | `references/motion-spec.md` | Stage 7: scene length, house settings, named moves, spec format |
    | `references/text-treatments.md` | Choosing how text looks and moves: the treatments seen in strong films, with sizes and timings |
    | `references/media.md` | Making images, clips and logos; prompting; casting; checking generated media |
    | `references/generated-clips.md` | Stage 6 and every clip prompt with generated people or products: actions that fail, cuts, continuity; clips that keep failing |
    | `references/reference-films.md` | Stage 3, when the user chose reference videos: how to study a film; general techniques |
    | `references/build-and-qa.md` | Stages 8-9: HyperFrames build, retiming, cutdowns, render checks, blind comparison with a reference |
    | `references/polish-rounds.md` | Stage 10: reading timestamped notes, rounds and renders, checks against user choices, choppiness the check missed, the ideas pass |
    | `assets/frames-starter.html`, `assets/frame-kit.js` | Copy to start `frames.html` |
    | `assets/storyboard-starter.json`, `assets/options-direction-starter.json`, `assets/options-color-starter.json` | Copy to start the JSON for a page |
    | `assets/codex-image-brief.md` | Template for each image set |
    
  • skills/video-director/scripts/action_frames.py19 KBc3fb7558490bupstream ↗
    #!/usr/bin/env python3
    """Look at the frame where an action happens inside a shot: a click, a press, a hand reaching a knob.
    
    python3 <skill>/scripts/action_frames.py --actions build/actions.json --video output/cut-v3.mp4 --out output/actions-v3
    python3 <skill>/scripts/action_frames.py --actions build/actions.json --build build/ --video output/cut-v3.mp4 --out output/actions-v3
    
    cut_frames.py only looks around cuts. This script looks at the moments in between, where something is meant to
    touch something else. The actions file is a JSON list, one entry per moment:
    
      {"time": 36.94, "label": "picks the app's camera in the camera menu", "box": [1410, 360, 220, 70]}
      {"time": 36.94, "label": "picks the app's camera in the camera menu",
       "composition": "compositions/join.html", "pointer": "#ptr", "target": "#opt"}
    
    time      film time in seconds (where the click or touch happens)
    box       optional target box in video pixels [x, y, width, height]; the strip is cropped around it
    composition, pointer, target   (HyperFrames UI scenes, needs --build) the composition file holding the pointer,
              and CSS selectors for the pointer and the thing it should land on. The script loads that composition in
              headless Chrome, seeks it to the click and reads both boxes from the page. It FAILS when the pointer's tip
              is not inside the target, or the pointer or target is not visible.
    local_time  optional time inside that composition; by default film time minus the data-start of the clip in
              build/index.html that loads it (give local_time when the composition is loaded more than once)
    tip       optional [x, y]: where the pointer's tip sits in the pointer element's own box, in CSS pixels before any
              scaling (default [3, 3]: an arrow drawn from the element's top-left corner). Check it against the SVG.
    slack     optional pixels of leeway around the target (default 0)
    
    With --video, each action gets a strip: the whole frame at the action with the target boxed, then zoomed crops
    at -0.2 s, -0.07 s, the action, and +0.07 s, with the target boxed (red) and, when read from the page, the pointer's
    tip marked (yellow). Open every strip. actions.json in --out lists each result.
    
    A film with no click, press or touch inside a shot (most films without a pointer or a hand on a control) lists
    none: an empty list [] writes a record saying so and passes. With --motion-spec, an empty list is flagged (exit 2)
    when the spec mentions a click, tap, press, touch or pointer. A missing actions file is still an error.
    
    Sub-compositions are assumed to fill the frame (their pixels are the film's pixels, scaled to the video's size).
    
    Exit 0 all strips written and every pointer on its target; 2 a pointer off its target (fix the move); 1 an error.
    """
    from __future__ import annotations
    
    import argparse
    import json
    from pathlib import Path
    import re
    import shutil
    import subprocess
    import sys
    import tempfile
    
    HERE = Path(__file__).resolve().parent
    sys.path.insert(0, str(HERE))
    
    OFFSETS = (-0.2, -0.07, 0.0, 0.07)
    DEFAULT_TIP = (3.0, 3.0)
    
    PROBE = r"""
    <script id="vd-action-src">
    (function () {
      const ACTIONS = %(actions)s;
      function root() { return document.querySelector("[data-composition-id]"); }
      function timelines() {
        const all = window.__timelines || {};
        const id = root() && root().getAttribute("data-composition-id");
        if (id && all[id]) return [all[id]];
        return Object.values(all);
      }
      const clips = [...document.querySelectorAll("[data-start]")].filter(el => el !== root());
      function applyClips(t) {
        for (const el of clips) {
          const s = parseFloat(el.getAttribute("data-start")) || 0;
          const d = parseFloat(el.getAttribute("data-duration"));
          el.style.visibility = (t >= s - 1e-6 && (isNaN(d) || t < s + d - 1e-6)) ? "" : "hidden";
        }
      }
      function seek(t) { applyClips(t); for (const tl of timelines()) tl.seek(t, false); }
      function opacityChain(el) {
        let o = 1;
        for (let n = el; n && n.nodeType === 1; n = n.parentElement) {
          const cs = getComputedStyle(n);
          if (cs.display === "none" || cs.visibility === "hidden") return 0;
          o *= parseFloat(cs.opacity);
        }
        return o;
      }
      function box(r) { return [r.left, r.top, r.width, r.height].map(v => +v.toFixed(1)); }
      function run() {
        const out = [];
        for (const a of ACTIONS) {
          seek(a.local_time);
          const p = document.querySelector(a.pointer), g = document.querySelector(a.target);
          const row = { index: a.index, pointer_found: !!p, target_found: !!g };
          if (p) {
            const r = p.getBoundingClientRect(), cs = getComputedStyle(p);
            const w = parseFloat(cs.width) || r.width, h = parseFloat(cs.height) || r.height;
            row.pointer_box = box(r);
            row.tip = [+(r.left + a.tip[0] * r.width / w).toFixed(1), +(r.top + a.tip[1] * r.height / h).toFixed(1)];
            row.pointer_opacity = +opacityChain(p).toFixed(3);
          }
          if (g) { row.target_box = box(g.getBoundingClientRect()); row.target_opacity = +opacityChain(g).toFixed(3); }
          out.push(row);
        }
        const r = root();
        const size = [parseFloat(r && r.getAttribute("data-width")) || innerWidth, parseFloat(r && r.getAttribute("data-height")) || innerHeight];
        const el = document.createElement("script"); el.type = "application/json"; el.id = "vd-action";
        el.textContent = JSON.stringify({ size, rows: out });
        document.body.appendChild(el);
      }
      function go() { try { run(); } catch (e) { const el = document.createElement("script"); el.type = "application/json"; el.id = "vd-action"; el.textContent = JSON.stringify({ error: String(e && e.stack || e) }); document.body.appendChild(el); } }
      window.addEventListener("load", () => setTimeout(() => (document.fonts ? document.fonts.ready : Promise.resolve()).then(go), 300));
    })();
    </script>
    """
    
    
    def ffmpeg(*args: str) -> None:
        subprocess.run(["ffmpeg", "-v", "error", "-y", *args], capture_output=True, text=True, check=True)
    
    
    def probe_video(video: Path) -> tuple[float, int, int]:
        run = subprocess.run(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries", "stream=width,height:format=duration",
                              "-of", "json", str(video)], capture_output=True, text=True, check=True)
        d = json.loads(run.stdout)
        s = d["streams"][0]
        return float(d["format"]["duration"]), int(s["width"]), int(s["height"])
    
    
    def load_actions(path: Path) -> list[dict]:
        data = json.loads(path.read_text(encoding="utf-8"))
        if isinstance(data, dict):
            data = data.get("actions")
        if not isinstance(data, list):
            raise ValueError(f"{path}: expected a JSON list of actions ([] when the film has no click, press or touch)")
        out = []
        for i, a in enumerate(data, 1):
            if not isinstance(a, dict) or not isinstance(a.get("time"), (int, float)) or isinstance(a.get("time"), bool):
                raise ValueError(f"action {i}: needs a numeric 'time'")
            if not str(a.get("label", "")).strip():
                raise ValueError(f"action {i}: needs a 'label' saying what should happen")
            box = a.get("box")
            if box is not None and not (isinstance(box, list) and len(box) == 4 and all(isinstance(v, (int, float)) for v in box) and box[2] > 0 and box[3] > 0):
                raise ValueError(f"action {i}: 'box' must be [x, y, width, height] with a positive size")
            ui = [k for k in ("composition", "pointer", "target") if a.get(k)]
            if ui and len(ui) != 3:
                raise ValueError(f"action {i}: a pointer check needs all of composition, pointer and target")
            tip = a.get("tip", list(DEFAULT_TIP))
            if not (isinstance(tip, list) and len(tip) == 2 and all(isinstance(v, (int, float)) for v in tip)):
                raise ValueError(f"action {i}: 'tip' must be [x, y]")
            out.append({**a, "index": i, "label": str(a["label"]).strip(), "tip": [float(tip[0]), float(tip[1])],
                        "slack": float(a.get("slack", 0))})
        return out
    
    
    def clip_start(build: Path, composition: str) -> float:
        """data-start of the clip in build/index.html that loads this composition."""
        index = build / "index.html"
        if not index.is_file():
            raise ValueError(f"no {index}: give local_time for each action, or a --build folder with index.html")
        html = index.read_text(encoding="utf-8")
        starts = []
        for tag in re.findall(r"<[^>]+data-composition-src=[^>]+>", html):
            src = re.search(r'data-composition-src="([^"]+)"', tag)
            if src and Path(src.group(1)).as_posix() == Path(composition).as_posix():
                start = re.search(r'data-start="([0-9.]+)"', tag)
                if start:
                    starts.append(float(start.group(1)))
        if len(starts) > 1:
            raise ValueError(f"{composition} is loaded {len(starts)} times in {index}; give local_time for each of its actions")
        if not starts:
            raise ValueError(f"no clip in {index} loads {composition}; give local_time for that action")
        return starts[0]
    
    
    def read_pointers(build: Path, actions: list[dict], budget: int) -> dict[int, dict]:
        from check_render import dump_with_script  # Chrome loader shared with the render check
    
        by_file: dict[str, list[dict]] = {}
        for a in actions:
            if a.get("composition"):
                if "local_time" not in a:
                    a["local_time"] = round(a["time"] - clip_start(build, a["composition"]), 3)
                by_file.setdefault(a["composition"], []).append(a)
        found: dict[int, dict] = {}
        for comp, group in by_file.items():
            path = build / comp
            if not path.is_file():
                raise ValueError(f"composition not found: {path}")
            html = path.read_text(encoding="utf-8")
            w = re.search(r'data-width="(\d+)"', html)
            h = re.search(r'data-height="(\d+)"', html)
            size = (int(w.group(1)) if w else 1920, int(h.group(1)) if h else 1080)
            payload = [{"index": a["index"], "local_time": a["local_time"], "pointer": a["pointer"], "target": a["target"], "tip": a["tip"]} for a in group]
            script = PROBE % {"actions": json.dumps(payload).replace("<", "\<")}
            data = dump_with_script(path, size, budget, script, "vd-action")
            for row in data["rows"]:
                found[row["index"]] = {**row, "page_size": data["size"]}
        return found
    
    
    def judge(a: dict, row: dict) -> tuple[bool, str]:
        if not row.get("pointer_found"):
            return False, f"pointer {a['pointer']} not found in {a['composition']}"
        if not row.get("target_found"):
            return False, f"target {a['target']} not found in {a['composition']}"
        if row["pointer_opacity"] < 0.05:
            return False, f"pointer {a['pointer']} is not visible at {a['local_time']:.2f}s"
        if row["target_opacity"] < 0.05:
            return False, f"target {a['target']} is not visible at {a['local_time']:.2f}s (menu not open yet?)"
        x, y = row["tip"]
        bx, by, bw, bh = row["target_box"]
        s = a["slack"]
        dx = (bx - s - x) if x < bx - s else (x - (bx + bw + s)) if x > bx + bw + s else 0.0
        dy = (by - s - y) if y < by - s else (y - (by + bh + s)) if y > by + bh + s else 0.0
        if dx == 0 and dy == 0:
            return True, f"tip at ({x:.0f}, {y:.0f}) inside {a['target']} [{bx:.0f}, {by:.0f}, {bw:.0f}x{bh:.0f}]"
        where = []
        if dy:
            where.append(f"{dy:.0f} px {'above' if y < by else 'below'}")
        if dx:
            where.append(f"{dx:.0f} px {'left of' if x < bx else 'right of'}")
        return False, f"tip at ({x:.0f}, {y:.0f}) is {' and '.join(where)} {a['target']} [{bx:.0f}, {by:.0f}, {bw:.0f}x{bh:.0f}]"
    
    
    def crop_for(box: list[float] | None, vw: int, vh: int) -> tuple[int, int, int, int]:
        """A crop around the box with room to see what is nearby; the whole frame with no box."""
        if not box:
            return 0, 0, vw, vh
        x, y, w, h = box
        cw = min(vw, max(w * 1.6, h * 3 * 16 / 9, vw * 0.15))
        ch = min(vh, cw * 9 / 16)
        cx, cy = x + w / 2, y + h / 2
        left = min(max(cx - cw / 2, 0), vw - cw)
        top = min(max(cy - ch / 2, 0), vh - ch)
        return int(left), int(top), int(cw) // 2 * 2, int(ch) // 2 * 2
    
    
    def strip(video: Path, total: float, a: dict, box: list[float] | None, tip: list[float] | None, vw: int, vh: int,
              out: Path, width: int, tmp: Path) -> tuple[Path, list[float]]:
        cx, cy, cw, ch = crop_for(box, vw, vh)
        marks = []
        if box:
            marks.append(f"drawbox=x={box[0]:.0f}:y={box[1]:.0f}:w={box[2]:.0f}:h={box[3]:.0f}:[email protected]:t=3")
        if tip:
            marks.append(f"drawbox=x={tip[0] - 4:.0f}:y={tip[1] - 4:.0f}:w=9:h=9:[email protected]:t=fill")
        mark = ",".join(marks) + "," if marks else ""
        pngs, times = [], []
        whole = tmp / f"a{a['index']:02d}-whole.png"
        t0 = min(max(a["time"], 0.0), max(total - 0.04, 0.0))
        ffmpeg("-ss", f"{t0:.3f}", "-i", str(video), "-frames:v", "1", "-vf", f"{mark}scale=-2:{int(width * 9 / 16) // 2 * 2}", str(whole))
        pngs.append(whole)
        for i, off in enumerate(OFFSETS):
            t = min(max(a["time"] + off, 0.0), max(total - 0.04, 0.0))
            png = tmp / f"a{a['index']:02d}-{i}.png"
            ffmpeg("-ss", f"{t:.3f}", "-i", str(video), "-frames:v", "1", "-vf",
                   f"{mark}crop={cw}:{ch}:{cx}:{cy},scale=-2:{int(width * 9 / 16) // 2 * 2}:flags=lanczos", str(png))
            pngs.append(png)
            times.append(round(t, 3))
        slug = re.sub(r"[^a-z0-9]+", "-", a["label"].lower()).strip("-")[:40]
        dest = out / f"action-{a['index']:02d}-{a['time']:.2f}s-{slug}.jpg"
        inputs = [x for p in pngs for x in ("-i", str(p))]
        ffmpeg(*inputs, "-filter_complex", "".join(f"[{i}:v]" for i in range(len(pngs))) + f"hstack=inputs={len(pngs)}", str(dest))
        return dest, times
    
    
    def main() -> int:
        ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
        ap.add_argument("--actions", type=Path, required=True, help="JSON list of action moments")
        ap.add_argument("--out", type=Path, required=True)
        ap.add_argument("--video", type=Path, help="the render; each action gets a zoomed strip")
        ap.add_argument("--build", type=Path, help="the HyperFrames project folder, for pointer checks")
        ap.add_argument("--motion-spec", type=Path, help="motion-spec.md; with an empty actions list, any click, tap, "
                        "press, touch or pointer it mentions is flagged")
        ap.add_argument("--width", type=int, default=480, help="width of each crop in the strip")
        ap.add_argument("--budget", type=int, default=8000, help="Chrome virtual time budget in ms")
        args = ap.parse_args()
        actions = load_actions(args.actions)
        if not actions:
            hits = []
            if args.motion_spec:
                words = re.compile(r"\b(click\w*|tap\w*|press(es|ed|ing)?|touch\w*|cursor|pointer)\b", re.I)
                hits = [f"{args.motion_spec}:{n}: {line.strip()[:120]}"
                        for n, line in enumerate(args.motion_spec.read_text(encoding="utf-8").splitlines(), 1)
                        if words.search(line)]
            args.out.mkdir(parents=True, exist_ok=True)
            (args.out / "actions.json").write_text(json.dumps({"video": str(args.video.resolve()) if args.video else None,
                                                              "actions": [], "none": True, "motion_spec_mentions": hits},
                                                             indent=2), encoding="utf-8")
            if hits:
                print("REVIEW the actions list is empty, but the motion spec mentions a click, tap, press, touch or "
                      "pointer. List each real one in the actions file, or confirm these lines aren't actions:")
                for h in hits:
                    print(f"  {h}")
                return 2
            print("No action moments listed: the film has no click, press or touch inside a shot. Nothing to check.")
            return 0
        ui = [a for a in actions if a.get("composition")]
        if ui and not args.build:
            raise ValueError("actions with a composition need --build <HyperFrames project folder>")
        if not args.video and not ui:
            raise ValueError("nothing to do: give --video for strips, or pointer checks (composition, pointer, target) with --build")
        if args.video and not (shutil.which("ffmpeg") and shutil.which("ffprobe")):
            raise RuntimeError("ffmpeg and ffprobe are required for strips")
        pointers = read_pointers(args.build, actions, args.budget) if ui else {}
        total, vw, vh = probe_video(args.video) if args.video else (0.0, 0, 0)
        if args.video:
            late = [a["time"] for a in actions if not 0 <= a["time"] < total]
            if late:
                raise ValueError(f"action time(s) outside the video (0-{total:.2f}s): {late}")
        args.out.mkdir(parents=True, exist_ok=True)
        rows, failed = [], 0
        with tempfile.TemporaryDirectory() as tmp:
            for a in actions:
                row = {"index": a["index"], "time": a["time"], "label": a["label"]}
                box, tip = a.get("box"), None
                if a["index"] in pointers:
                    p = pointers[a["index"]]
                    ok, why = judge(a, p)
                    row.update({"check": "pointer", "pass": ok, "result": why, "local_time": a["local_time"],
                                "composition": a["composition"], "pointer_tip_page": p.get("tip"), "target_box_page": p.get("target_box")})
                    failed += not ok
                    if args.video and p.get("target_box"):
                        sx, sy = vw / p["page_size"][0], vh / p["page_size"][1]
                        bx, by, bw, bh = p["target_box"]
                        box = box or [bx * sx, by * sy, bw * sx, bh * sy]
                        if p.get("tip"):
                            tip = [p["tip"][0] * sx, p["tip"][1] * sy]
                if args.video:
                    dest, times = strip(args.video, total, a, box, tip, vw, vh, args.out, args.width, Path(tmp))
                    row.update({"strip": str(dest), "frames_at": times})
                rows.append(row)
        (args.out / "actions.json").write_text(json.dumps({"video": str(args.video.resolve()) if args.video else None,
                                                            "actions": rows}, indent=2), encoding="utf-8")
        for r in rows:
            if "check" in r:
                print(f"{'PASS' if r['pass'] else 'FAIL'} {r['time']:7.2f}s  {r['label']}: {r['result']}")
            if r.get("strip"):
                print(f"STRIP {r['time']:7.2f}s  {r['strip']}")
        print(f"{len(rows)} action moment(s); {sum('check' in r for r in rows)} pointer check(s), {failed} failed. "
              "Open every strip: frames at -0.2, -0.07, 0 and +0.07 s around each action.")
        return 2 if failed else 0
    
    
    if __name__ == "__main__":
        try:
            raise SystemExit(main())
        except (OSError, ValueError, RuntimeError, KeyError, json.JSONDecodeError, subprocess.CalledProcessError) as exc:
            detail = exc.stderr.strip()[-400:] if isinstance(exc, subprocess.CalledProcessError) and exc.stderr else str(exc)
            print(f"ERROR: action frames incomplete: {detail}", file=sys.stderr)
            raise SystemExit(1)
    
  • skills/video-director/scripts/build_storyboard.py44 KBd65a03c56691upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/scripts/build_style_library.py9.4 KB9c008a395b38upstream ↗
    #!/usr/bin/env python3
    """Build the animation style page: one example picture per style in references/animation-styles.md, by group.
    
    python3 <skill>/scripts/build_style_library.py --out <project>/references/styles-v1.html \
        [--suggest "flat-vector=Clear for a process with many parts" --suggest "..."]
    
    Every style is always shown. --suggest puts a style at the top with a one-line reason; give it 3-4 times, for
    different styles. The style id is the picture's file name without its extension. The pictures are copied into
    a style-library/ folder next to the page, so the page still works when the project is moved or shared.
    It never overwrites a page: use a new version number. The one exception is the library's own index.html.
    Exit 0: page written; 1: a style's picture is missing, the page exists, or an argument is wrong.
    """
    from __future__ import annotations
    
    import argparse
    import html
    import os
    from pathlib import Path
    import re
    import shutil
    import sys
    
    SKILL = Path(__file__).resolve().parent.parent
    STYLES = SKILL / "references" / "animation-styles.md"
    LIBRARY = SKILL / "assets" / "style-library"
    SHOWCASE = "https://www.tiktok.com/@jesseeisenbart/video/7697657520793324818"
    LINK = re.compile(r"\[[^\]]*\]\(([^)]+)\)")
    
    
    def parse(text: str) -> list[dict]:
        """Return [{group, styles: [{id, name, looks, example, good_for, picture}]}] from the style tables."""
        groups, group, header = [], None, None
        for line in text.splitlines():
            if line.startswith("## "):
                group, header = {"group": line[3:].strip(), "styles": []}, None
                groups.append(group)
                continue
            if group is None or not line.startswith("|"):
                continue
            cells = [c.strip() for c in line.strip().strip("|").split("|")]
            if header is None:
                header = [c.lower() for c in cells]
                continue
            if set(cells[0]) <= set("-: "):
                continue
            row = dict(zip(header, cells))
            link = LINK.search(row.get("picture", ""))
            if not link:
                raise ValueError(f"{row.get('style', cells[0])}: no picture link in the Picture column")
            picture = (STYLES.parent / link.group(1)).resolve()
            group["styles"].append({"id": picture.stem, "name": row["style"], "looks": row["what it looks like"],
                                    "example": row["example to study"], "good_for": row["consider for"],
                                    "picture": picture})
        return [g for g in groups if g["styles"]]
    
    
    def inline(text: str) -> str:
        """Escape a table cell and keep its *italics*."""
        return re.sub(r"\*([^*]+)\*", r"<em>\1</em>", html.escape(text))
    
    
    def example(text: str) -> str:
        if text.startswith("Showcase "):
            return f'<a href="{SHOWCASE}">Jesse Eisenbart\'s 20-style showcase</a>, {inline(text[9:])}'
        return inline(text)
    
    
    def src(picture: Path, out: Path) -> str:
        try:
            return os.path.relpath(picture, out.parent)
        except ValueError:
            return picture.as_uri()
    
    
    def card(s: dict, out: Path, reason: str | None = None) -> str:
        why = f'<p class="why">{html.escape(reason)}</p>' if reason else ""
        anchor = f'suggested-{s["id"]}' if reason else s["id"]
        return (f'<figure class="card" id="{anchor}"><button class="pic" type="button" aria-label="Enlarge {html.escape(s["name"])}">'
                f'<img src="{html.escape(src(s["picture"], out))}" alt="{html.escape(s["name"])} example" loading="lazy" width="768" height="432"></button>'
                f'<figcaption><h3>{html.escape(s["name"])}</h3>{why}<p>{inline(s["looks"])}.</p>'
                f'<p class="meta"><span>Good for:</span> {inline(s["good_for"])}</p>'
                f'<p class="meta"><span>Look up:</span> {example(s["example"])}</p></figcaption></figure>')
    
    
    PAGE = """<!doctype html>
    <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Animation styles</title>
    <style>
    :root{--bg:#f4f6f8;--card:#fff;--ink:#16191d;--muted:#5b6470;--line:#dde2e8;--accent:#2357d9}
    @media (prefers-color-scheme:dark){:root{--bg:#111418;--card:#1b1f25;--ink:#eef1f4;--muted:#9aa4b0;--line:#2b313a;--accent:#7ea2ff}}
    *{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif}
    main{max-width:1320px;margin:0 auto;padding:28px 16px 64px}
    h1{font-size:26px;margin:0 0 6px}.lede{color:var(--muted);margin:0 0 14px;max-width:760px}
    nav{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 8px}nav a{color:var(--ink);text-decoration:none;border:1px solid var(--line);background:var(--card);border-radius:999px;padding:4px 12px;font-size:13px}
    h2{font-size:20px;margin:36px 0 4px}.count{color:var(--muted);font-weight:400;font-size:14px}
    .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(270px,1fr));gap:16px;margin-top:12px}
    .card{margin:0;background:var(--card);border:1px solid var(--line);border-radius:10px;overflow:hidden}
    .suggested .card{border:2px solid var(--accent)}
    .pic{display:block;width:100%;padding:0;border:0;background:#000;cursor:zoom-in}.pic img{display:block;width:100%;height:auto;aspect-ratio:16/9;object-fit:cover}
    figcaption{padding:10px 12px 12px}h3{font-size:15px;margin:0 0 4px}figcaption p{margin:0 0 6px}
    .why{color:var(--accent);font-weight:600}.meta{color:var(--muted);font-size:13px}.meta span{font-weight:600}
    a{color:var(--accent)}
    dialog{border:0;padding:0;background:transparent;max-width:min(1200px,96vw)}dialog::backdrop{background:rgba(0,0,0,.85)}
    dialog img{display:block;max-width:100%;max-height:80vh;border-radius:6px}dialog p{color:#fff;margin:8px 0 0;font-size:15px}
    </style></head><body><main>
    <h1>Animation styles</h1>
    <p class="lede">Ways of drawing or building the pictures in motion graphics and animation. Most pictures show the same desk by a window, so you can compare styles side by side. Pick one or more to see as directions for your film, describe the look you want in your own words, or say "you choose". Click a picture to see it larger.</p>
    __NAV__
    __BODY__
    </main>
    <dialog id="big"><img alt=""><p></p></dialog>
    <script>
    const d=document.getElementById('big');
    document.querySelectorAll('.pic').forEach(b=>b.addEventListener('click',()=>{const i=b.querySelector('img');d.querySelector('img').src=i.src;d.querySelector('p').textContent=i.alt.replace(/ example$/,'');d.showModal();}));
    d.addEventListener('click',()=>d.close());
    </script></body></html>
    """
    
    
    def main() -> int:
        ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
        ap.add_argument("--out", type=Path, required=True)
        ap.add_argument("--suggest", action="append", default=[], metavar="ID=REASON")
        args = ap.parse_args()
        out = args.out.resolve()
        if out.exists() and out != LIBRARY / "index.html":
            print(f"FAIL {out} exists. Use a new version number; earlier pages stay as the record.", file=sys.stderr)
            return 1
        try:
            groups = parse(STYLES.read_text(encoding="utf-8"))
        except (ValueError, KeyError) as e:
            print(f"FAIL animation-styles.md: a table row is wrong ({e})", file=sys.stderr)
            return 1
        by_id = {s["id"]: s for g in groups for s in g["styles"]}
        missing = [s["name"] for s in by_id.values() if not s["picture"].is_file()]
        if missing:
            print("FAIL missing pictures: " + ", ".join(missing), file=sys.stderr)
            return 1
        suggestions = []
        for item in args.suggest:
            sid, _, reason = item.partition("=")
            if sid.strip() not in by_id:
                print(f"FAIL unknown style id: {sid.strip()}", file=sys.stderr)
                return 1
            if not reason.strip():
                print(f"FAIL no reason given for {sid.strip()}: write ID=one plain line", file=sys.stderr)
                return 1
            suggestions.append((by_id[sid.strip()], reason.strip()))
        ids = [s["id"] for s, _ in suggestions]
        if suggestions and not 3 <= len(ids) <= 4:
            print(f"FAIL suggest 3-4 styles, not {len(ids)}", file=sys.stderr)
            return 1
        if len(set(ids)) != len(ids):
            print("FAIL the same style is suggested twice", file=sys.stderr)
            return 1
        if out.parent != LIBRARY:
            folder = out.parent / "style-library"
            folder.mkdir(parents=True, exist_ok=True)
            for s in by_id.values():
                dest = folder / s["picture"].name
                if not dest.is_file() or dest.stat().st_size != s["picture"].stat().st_size:
                    shutil.copy2(s["picture"], dest)
                s["picture"] = dest
        parts, nav = [], []
        if suggestions:
            nav.append('<a href="#suggested">Suggested</a>')
            parts.append('<section class="suggested" id="suggested"><h2>Suggested for this film</h2><div class="grid">'
                         + "".join(card(s, out, r) for s, r in suggestions) + "</div></section>")
        for i, g in enumerate(groups):
            nav.append(f'<a href="#g{i}">{html.escape(g["group"])}</a>')
            parts.append(f'<section id="g{i}"><h2>{html.escape(g["group"])} <span class="count">{len(g["styles"])}</span></h2>'
                         '<div class="grid">' + "".join(card(s, out) for s in g["styles"]) + "</div></section>")
        out.parent.mkdir(parents=True, exist_ok=True)
        out.write_text(PAGE.replace("__NAV__", "<nav>" + "".join(nav) + "</nav>").replace("__BODY__", "\n".join(parts)), encoding="utf-8")
        print(f"PASS {len(by_id)} styles in {len(groups)} groups, {len(suggestions)} suggested: {out}")
        return 0
    
    
    if __name__ == "__main__":
        sys.exit(main())
    
  • skills/video-director/scripts/check_delivery.py2.9 KB9f6ac5e4033cupstream ↗
    #!/usr/bin/env python3
    """Check delivery file bytes and optional decoded frame count.
    
    python3 <skill>/scripts/check_delivery.py output/cut-vN-phone.mp4 --max-mb 30
    python3 <skill>/scripts/check_delivery.py output/loop.gif --max-mb 5 --max-frames 400
    MB uses decimal bytes (1 MB = 1,000,000 bytes). Exit 0 passes measured limits; 1 input/limit/coverage error.
    """
    from __future__ import annotations
    
    import argparse
    import json
    from pathlib import Path
    import shutil
    import subprocess
    import sys
    
    
    def main() -> int:
        ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
        ap.add_argument("file", type=Path)
        ap.add_argument("--max-mb", type=float)
        ap.add_argument("--max-frames", type=int)
        args = ap.parse_args()
        if args.max_mb is None and args.max_frames is None:
            raise ValueError("supply --max-mb and/or --max-frames")
        if args.max_mb is not None and (args.max_mb <= 0 or args.max_mb == float("inf") or args.max_mb != args.max_mb):
            raise ValueError("--max-mb must be a finite positive number")
        if args.max_frames is not None and args.max_frames < 1:
            raise ValueError("--max-frames must be positive")
        if not args.file.is_file():
            raise ValueError(f"not a regular delivery file: {args.file}")
        size = args.file.stat().st_size
        limit = args.max_mb * 1_000_000 if args.max_mb is not None else None
        if size <= 0 or (limit is not None and size > limit):
            print(f"FAIL: {args.file}: {size} bytes; limit {limit} bytes; file must be nonempty")
            return 1
        frames = None
        if args.max_frames is not None:
            if not shutil.which("ffprobe"):
                raise RuntimeError("frame-count coverage unavailable: ffprobe is required for --max-frames")
            run = subprocess.run(["ffprobe", "-v", "error", "-select_streams", "v:0", "-count_frames", "-show_entries",
                                  "stream=nb_read_frames", "-of", "json", str(args.file)], capture_output=True, text=True, check=True)
            streams = json.loads(run.stdout).get("streams", [])
            if len(streams) != 1 or not str(streams[0].get("nb_read_frames", "")).isdigit():
                raise RuntimeError("frame-count coverage unavailable: ffprobe returned no exact decoded frame count")
            frames = int(streams[0]["nb_read_frames"])
            if frames < 1 or frames > args.max_frames:
                print(f"FAIL: {frames} frames; limit {args.max_frames}; must be nonempty")
                return 1
        print(f"PASS: {args.file.resolve()}: {size} bytes" + (f" <= {limit:g}" if limit is not None else "") + (f"; {frames} frames <= {args.max_frames}" if frames is not None else "") + "; bytes/frame limits only")
        return 0
    
    
    if __name__ == "__main__":
        try:
            raise SystemExit(main())
        except (OSError, ValueError, TypeError, KeyError, RuntimeError, subprocess.CalledProcessError) as exc:
            print(f"ERROR: delivery measurement incomplete: {exc}", file=sys.stderr)
            raise SystemExit(1)
    
  • skills/video-director/scripts/check_render.py34 KBee89637ce40bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/scripts/check_sources.py3.7 KB5d8e87b3b9a2upstream ↗
    #!/usr/bin/env python3
    """Check that every sound and music file in a project's assets/audio/ has a row in assets/audio/SOURCES.md.
    
    python3 <skill>/scripts/check_sources.py assets/audio
    
    Each file's source and licence is what lets the film be published, and the free libraries' licences differ (some
    need a credit, some forbid sharing the files). SOURCES.md holds a Markdown table whose first column is the file's
    path relative to assets/audio/ (backticks allowed), with a column whose header contains "licence" or "license":
    
      | File | Source | Page or id | Made by | Licence, and what it allows | Downloaded | Used for |
      |---|---|---|---|---|---|---|
      | `effects/door-close.wav` | Freesound | sound <id> | <uploader> | CC0: any use, no credit needed | <date> | the door at 0:12 |
    
    It reports:
      missing  a sound or music file with no row
      orphan   a row whose file is not there
      licence  a row with an empty licence cell
    Sound and music files are found by extension (wav, mp3, m4a, aac, aif, aiff, flac, ogg, opus, caf). Exit 0 all
    present; 2 something to fix; 1 an error (no folder, no SOURCES.md, no table).
    """
    from __future__ import annotations
    
    import argparse
    from pathlib import Path
    import sys
    
    AUDIO = {".wav", ".mp3", ".m4a", ".aac", ".aif", ".aiff", ".flac", ".ogg", ".opus", ".caf"}
    
    
    def cells(line: str) -> list[str]:
        return [c.strip() for c in line.strip().strip("|").split("|")]
    
    
    def read_rows(sources: Path) -> list[tuple[str, str]]:
        """(file, licence) for every row of every table that has a licence column."""
        rows: list[tuple[str, str]] = []
        lines = sources.read_text(encoding="utf-8").splitlines()
        i = 0
        while i < len(lines):
            line = lines[i]
            if line.lstrip().startswith("|") and i + 1 < len(lines) and set(lines[i + 1].replace("|", "").strip()) <= set("-: "):
                head = [h.lower() for h in cells(line)]
                lic = next((k for k, h in enumerate(head) if "licen" in h), None)
                i += 2
                while i < len(lines) and lines[i].lstrip().startswith("|"):
                    c = cells(lines[i])
                    name = c[0].strip("`").strip()
                    if name:
                        rows.append((name, c[lic] if lic is not None and lic < len(c) else ""))
                    i += 1
                continue
            i += 1
        return rows
    
    
    def main() -> int:
        ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
        ap.add_argument("folder", type=Path, help="the project's assets/audio folder")
        args = ap.parse_args()
        folder = args.folder
        sources = folder / "SOURCES.md"
        if not folder.is_dir():
            print(f"error: {folder} is not a folder", file=sys.stderr)
            return 1
        if not sources.is_file():
            print(f"error: {sources} is missing; every project keeps one (sound-stage.md)", file=sys.stderr)
            return 1
        rows = read_rows(sources)
        if not rows:
            print(f"error: {sources} has no table rows with a file in the first column", file=sys.stderr)
            return 1
        files = sorted(p.relative_to(folder).as_posix() for p in folder.rglob("*")
                       if p.is_file() and p.suffix.lower() in AUDIO)
        listed = {name for name, _ in rows}
        problems = [f"missing  {f}: no row in SOURCES.md" for f in files if f not in listed]
        problems += [f"orphan   {name}: listed in SOURCES.md but not in {folder}" for name, _ in rows
                     if name not in files]
        problems += [f"licence  {name}: the licence cell is empty" for name, lic in rows if not lic.strip()]
        for line in problems:
            print(f"REVIEW {line}")
        print(f"{len(files)} files, {len(rows)} rows: " + (f"{len(problems)} to fix" if problems else "all listed"))
        return 2 if problems else 0
    
    
    if __name__ == "__main__":
        sys.exit(main())
    
  • skills/video-director/scripts/continuity_sheet.py9.7 KBb6dad47c6e85upstream ↗
    #!/usr/bin/env python3
    """Put every recurring prop and piece of clothing side by side across the shots it appears in.
    
    python3 <skill>/scripts/continuity_sheet.py output/cut-v3.mp4 --items continuity.json --out output/continuity-v3
    python3 <skill>/scripts/continuity_sheet.py --verify output/continuity-v3
    
    Between shots of a generated live-action film, objects and clothes change with nobody noticing: a water bottle
    becomes a different bottle, a door that was shut is open again, a crop top becomes a sports bra. Cut strips don't
    show it, because the change is often many shots apart.
    
    The items file lists each recurring thing named in the brief or storyboard, and one moment from every shot it
    appears in:
    
      {"items": [
        {"name": "water bottle", "note": "big bottle with a straw",
         "shots": [{"time": 3.1, "label": "hallway", "box": [820, 400, 260, 420]},
                   {"time": 12.4, "label": "desk", "box": [1300, 520, 200, 330]}]},
        {"name": "front door", "note": "shut once she is inside", "shots": [{"time": 2.0}, {"time": 30.5}]}]}
    
    box is optional [x, y, width, height] in video pixels around the item in that shot; without it the whole frame
    is used. Every tile in an item's sheet is the same size, so the item is seen at the same scale in each shot. Tiles run left to right in
    the order the shots are listed (printed, and kept in continuity.json).
    
    Writes one sheet per item (sheet-NN-<name>.jpg) and continuity.json with an empty "verdict" for each item. Open
    every sheet and write one line per item in continuity.json, starting with one of:
      same:      the item looks the same in every shot (say what you compared)
      changed:   it changes between shots (say where); fix it before anyone sees the render
      accepted:  it changes, and the user said that is fine (quote their words in quotation marks, with the date
                 as YYYY-MM-DD)
    Then run --verify. A verdict carries over to a new run only when the video file is unchanged (same path, size and
    time); a re-render needs new verdicts. Exit 0 sheets written (or, with --verify, every item has a same/accepted
    verdict); 1 an error, an empty verdict, a "changed" verdict, or an "accepted" verdict without a quote and a date.
    """
    from __future__ import annotations
    
    import argparse
    import json
    from pathlib import Path
    import re
    import shutil
    import subprocess
    import sys
    import tempfile
    
    VERDICTS = ("same:", "changed:", "accepted:")
    
    
    def ffmpeg(*args: str) -> None:
        subprocess.run(["ffmpeg", "-v", "error", "-y", *args], capture_output=True, text=True, check=True)
    
    
    def probe_video(video: Path) -> tuple[float, int, int]:
        run = subprocess.run(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries", "stream=width,height:format=duration",
                              "-of", "json", str(video)], capture_output=True, text=True, check=True)
        d = json.loads(run.stdout)
        return float(d["format"]["duration"]), int(d["streams"][0]["width"]), int(d["streams"][0]["height"])
    
    
    def load_items(path: Path) -> list[dict]:
        data = json.loads(path.read_text(encoding="utf-8"))
        items = data.get("items") if isinstance(data, dict) else data
        if not isinstance(items, list) or not items:
            raise ValueError(f"{path}: expected {{\"items\": [...]}} with at least one item")
        for i, it in enumerate(items, 1):
            if not isinstance(it, dict) or not str(it.get("name", "")).strip():
                raise ValueError(f"item {i}: needs a 'name'")
            shots = it.get("shots")
            if not isinstance(shots, list) or len(shots) < 2:
                raise ValueError(f"item {i} ({it['name']}): list at least two shots it appears in")
            for s in shots:
                if not isinstance(s, dict) or not isinstance(s.get("time"), (int, float)) or isinstance(s.get("time"), bool):
                    raise ValueError(f"item {i} ({it['name']}): every shot needs a numeric 'time'")
                box = s.get("box")
                if box is not None and not (isinstance(box, list) and len(box) == 4 and all(isinstance(v, (int, float)) for v in box) and box[2] > 0 and box[3] > 0):
                    raise ValueError(f"item {i} ({it['name']}): 'box' must be [x, y, width, height] with a positive size")
        return items
    
    
    def tile_size(item: dict, vw: int, vh: int, height: int) -> tuple[int, int]:
        """One tile shape for the whole item: the widest box's shape, or the frame's when no box is given."""
        boxes = [s["box"] for s in item["shots"] if s.get("box")]
        ratio = max(b[2] / b[3] for b in boxes) if boxes and len(boxes) == len(item["shots"]) else vw / vh
        return max(2, int(height * ratio) // 2 * 2), height
    
    
    def make_sheet(video: Path, total: float, item: dict, n: int, vw: int, vh: int, out: Path, height: int, tmp: Path) -> Path:
        tw, th = tile_size(item, vw, vh, height)
        tiles = []
        for k, s in enumerate(item["shots"]):
            t = min(max(float(s["time"]), 0.0), max(total - 0.04, 0.0))
            x, y, w, h = s.get("box") or [0, 0, vw, vh]
            crop = f"crop={int(w) // 2 * 2}:{int(h) // 2 * 2}:{int(x)}:{int(y)}," if s.get("box") else ""
            png = tmp / f"{n:02d}-{k:02d}.png"
            ffmpeg("-ss", f"{t:.3f}", "-i", str(video), "-frames:v", "1", "-vf",
                   f"{crop}scale={tw}:{th}:force_original_aspect_ratio=decrease:flags=lanczos,pad={tw}:{th}:(ow-iw)/2:(oh-ih)/2:color=black,"
                   f"pad={tw + 8}:{th}:0:0:color=white", str(png))
            tiles.append(png)
        slug = re.sub(r"[^a-z0-9]+", "-", item["name"].lower()).strip("-")[:40]
        dest = out / f"sheet-{n:02d}-{slug}.jpg"
        inputs = [x for p in tiles for x in ("-i", str(p))]
        ffmpeg(*inputs, "-filter_complex", "".join(f"[{i}:v]" for i in range(len(tiles))) + f"hstack=inputs={len(tiles)}", str(dest))
        return dest
    
    
    def verify(folder: Path) -> int:
        path = folder / "continuity.json"
        data = json.loads(path.read_text(encoding="utf-8"))
        problems = 0
        for it in data["items"]:
            v = str(it.get("verdict", "")).strip()
            kind = next((p for p in VERDICTS if v.lower().startswith(p)), None)
            if not kind or len(v) <= len(kind) + 2:
                print(f"OPEN    {it['name']}: no verdict. Open {it['sheet']} and write one line starting same:, changed: or accepted:")
                problems += 1
            elif kind == "changed:":
                print(f"CHANGED {it['name']}: {v[len(kind):].strip()}")
                problems += 1
            elif kind == "accepted:" and not (re.search(r'["“].+["”]', v) and re.search(r"\b\d{4}-\d{2}-\d{2}\b", v)):
                print(f"OPEN    {it['name']}: an accepted: line must quote the user in quotation marks and give the date (YYYY-MM-DD)")
                problems += 1
            else:
                print(f"{kind[:-1].upper():<7} {it['name']}: {v[len(kind):].strip()}")
        print(f"{len(data['items'])} item(s); {problems} open or changed.")
        return 1 if problems else 0
    
    
    def main() -> int:
        ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
        ap.add_argument("video", type=Path, nargs="?")
        ap.add_argument("--items", type=Path, help="JSON list of recurring props and clothes with the shots they appear in")
        ap.add_argument("--out", type=Path)
        ap.add_argument("--verify", type=Path, metavar="FOLDER", help="check the verdicts in FOLDER/continuity.json")
        ap.add_argument("--height", type=int, default=360, help="height of each tile")
        args = ap.parse_args()
        if args.verify:
            return verify(args.verify)
        if not (args.video and args.items and args.out):
            raise ValueError("give VIDEO --items FILE --out FOLDER, or --verify FOLDER")
        if not (shutil.which("ffmpeg") and shutil.which("ffprobe")):
            raise RuntimeError("ffmpeg and ffprobe are required")
        items = load_items(args.items)
        total, vw, vh = probe_video(args.video)
        late = [s["time"] for it in items for s in it["shots"] if not 0 <= s["time"] < total]
        if late:
            raise ValueError(f"shot time(s) outside the video (0-{total:.2f}s): {late}")
        out_json = args.out / "continuity.json"
        old = {}
        if out_json.is_file():
            old = {it["name"]: it for it in json.loads(out_json.read_text(encoding="utf-8")).get("items", [])}
        args.out.mkdir(parents=True, exist_ok=True)
        rows = []
        st = args.video.stat()
        stamp = [st.st_size, int(st.st_mtime)]
        vpath = str(args.video.resolve())
        with tempfile.TemporaryDirectory() as tmp:
            for n, it in enumerate(items, 1):
                sheet = make_sheet(args.video, total, it, n, vw, vh, args.out, args.height, Path(tmp))
                prev = old.get(it["name"], {})
                # a verdict carries over only for the same shots of the same, unchanged video file
                keep = prev.get("shots") == it["shots"] and prev.get("video") == vpath and prev.get("stamp") == stamp
                rows.append({"name": it["name"], "note": it.get("note", ""), "shots": it["shots"], "sheet": str(sheet),
                             "verdict": prev.get("verdict", "") if keep else "", "video": vpath, "stamp": stamp})
        out_json.write_text(json.dumps({"video": str(args.video.resolve()), "items": rows}, indent=2), encoding="utf-8")
        for r in rows:
            order = ", ".join(f"{s['time']:.2f}s {s.get('label', '')}".strip() for s in r["shots"])
            print(f"SHEET {r['name']}: {r['sheet']}\n      tiles left to right: {order}")
        print(f"{len(rows)} sheet(s). Open every one, write a one-line verdict per item in {out_json} "
              f"(same:, changed: or accepted:), then run --verify {args.out}.")
        return 0
    
    
    if __name__ == "__main__":
        try:
            raise SystemExit(main())
        except (OSError, ValueError, RuntimeError, KeyError, json.JSONDecodeError, subprocess.CalledProcessError) as exc:
            detail = exc.stderr.strip()[-400:] if isinstance(exc, subprocess.CalledProcessError) and exc.stderr else str(exc)
            print(f"ERROR: continuity sheet incomplete: {detail}", file=sys.stderr)
            raise SystemExit(1)
    
  • skills/video-director/scripts/cut_frames.py4.6 KB1f825e242fe5upstream ↗
    #!/usr/bin/env python3
    """Show the frames on both sides of every cut, side by side.
    
    python3 <skill>/scripts/cut_frames.py output/cut-v3.mp4 --out output/cuts-v3
    python3 <skill>/scripts/cut_frames.py output/cut-v3.mp4 --out output/cuts-v3 --times 4.2,9.8,15.0
    
    Finds the cuts (ffmpeg scene detection, or --times from the motion spec, which also catches dissolves that
    detection misses), then for each one writes a strip of four
    frames: 0.2 s and 0.07 s before the cut, 0.07 s and 0.2 s after it. Look at every strip for a jump in where a person
    or object is, a pop, a doubled pointer or a flash. cuts.json lists each strip with its time.
    
    Exit 0 strips written; 1 error.
    """
    from __future__ import annotations
    
    import argparse
    import json
    from pathlib import Path
    import re
    import shutil
    import subprocess
    import sys
    import tempfile
    
    OFFSETS = (-0.2, -0.07, 0.07, 0.2)
    
    
    def ffmpeg(*args: str) -> subprocess.CompletedProcess:
        return subprocess.run(["ffmpeg", "-v", "error", "-y", *args], capture_output=True, text=True, check=True)
    
    
    def duration_s(video: Path) -> float:
        run = subprocess.run(["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "json", str(video)],
                             capture_output=True, text=True, check=True)
        return float(json.loads(run.stdout)["format"]["duration"])
    
    
    def detect_cuts(video: Path, threshold: float) -> list[float]:
        run = subprocess.run(["ffmpeg", "-i", str(video), "-vf", f"select='gt(scene,{threshold})',showinfo", "-f", "null", "-"],
                             capture_output=True, text=True)
        if run.returncode != 0:
            raise RuntimeError(f"cut detection failed: {run.stderr.strip()[-300:]}")
        times = [float(t) for t in re.findall(r"pts_time:([0-9.]+)", run.stderr)]
        out: list[float] = []
        for t in times:
            if not out or t - out[-1] > 0.25:
                out.append(round(t, 3))
        return out
    
    
    def main() -> int:
        ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
        ap.add_argument("video", type=Path)
        ap.add_argument("--out", type=Path, required=True)
        ap.add_argument("--times", help="comma-separated cut times in seconds, in place of detection")
        ap.add_argument("--threshold", type=float, default=0.3, help="scene-change threshold for detection")
        ap.add_argument("--width", type=int, default=480, help="width of each frame in the strip")
        args = ap.parse_args()
        if not (shutil.which("ffmpeg") and shutil.which("ffprobe")):
            raise RuntimeError("ffmpeg and ffprobe are required")
        if not args.video.is_file():
            raise ValueError(f"not a file: {args.video}")
        total = duration_s(args.video)
        cuts = [float(t) for t in args.times.split(",") if t.strip()] if args.times else detect_cuts(args.video, args.threshold)
        late = [t for t in cuts if not 0 < t < total]
        if late:
            raise ValueError(f"cut time(s) outside the video (0-{total:.2f}s): {late}")
        args.out.mkdir(parents=True, exist_ok=True)
        rows = []
        with tempfile.TemporaryDirectory() as tmp:
            for n, cut in enumerate(cuts, 1):
                frames = []
                for i, off in enumerate(OFFSETS):
                    t = min(max(cut + off, 0.0), max(total - 0.04, 0.0))
                    png = Path(tmp) / f"{n:02d}-{i}.png"
                    ffmpeg("-ss", f"{t:.3f}", "-i", str(args.video), "-frames:v", "1", "-vf", f"scale={args.width}:-2", str(png))
                    frames.append((t, png))
                strip = args.out / f"cut-{n:02d}-{cut:.2f}s.jpg"
                inputs = [x for _, png in frames for x in ("-i", str(png))]
                ffmpeg(*inputs, "-filter_complex", "".join(f"[{i}:v]" for i in range(len(frames))) + f"hstack=inputs={len(frames)}", str(strip))
                rows.append({"cut": cut, "frames_at": [round(t, 3) for t, _ in frames], "strip": str(strip)})
        (args.out / "cuts.json").write_text(json.dumps({"video": str(args.video.resolve()), "cuts": rows}, indent=2), encoding="utf-8")
        print(f"{len(rows)} cut strip(s) in {args.out}; frames at -0.2, -0.07, +0.07, +0.2 s. Open every one.")
        if not rows:
            print("WARN no cuts found. Scene detection misses dissolves and slow moves; pass --times from the motion spec.")
        for r in rows:
            print(f"CUT {r['cut']:7.2f}s  {r['strip']}")
        return 0
    
    
    if __name__ == "__main__":
        try:
            raise SystemExit(main())
        except (OSError, ValueError, RuntimeError, subprocess.CalledProcessError) as exc:
            detail = exc.stderr.strip()[-400:] if isinstance(exc, subprocess.CalledProcessError) and exc.stderr else str(exc)
            print(f"ERROR: cut frames incomplete: {detail}", file=sys.stderr)
            raise SystemExit(1)
    
  • skills/video-director/scripts/fit_music.py18 KB2a9fe2231bc1upstream ↗
    #!/usr/bin/env python3
    """Fit a music track to the film: cut it into pieces on its bar lines, place each piece at a film time, stretch
    each piece a little if needed, and dip the music where lines are spoken.
    
    python3 <skill>/scripts/fit_music.py assets/audio/track.wav --plan build/audio/music-plan.json \
        --bars build/audio/track-beats.txt --beats-per-bar 4 --first-bar 0.46 --out build/audio/music.wav
    python3 <skill>/scripts/fit_music.py assets/audio/track.wav --bars build/audio/track-beats.txt --beats-per-bar 4 \
        --first-bar 0.46 --clicks build/audio/track-bar-clicks.wav
    
    The plan says which seconds of the track go where in the film. Each piece has "track": [from, to] in track seconds
    and one of:
      "film": [from, to]   stretch or squeeze the piece to fill exactly these film seconds
      "at": seconds        play it unstretched, starting at this film time
      "land": [t, f]       play it unstretched, placed so track second t is heard at film second f (use it to put the
                           track's own last note on the logo)
    
      {"film": 51.8,
       "pieces": [{"track": [0.0, 11.70], "film": [0.0, 11.5]},
                  {"track": [27.44, 47.68], "film": [11.5, 31.6]},
                  {"track": [91.56, 97.13], "land": [95.55, 51.0]}],
       "dips": [{"from": 40.55, "to": 42.45, "db": -8}],
       "fade_out": 0.25}
    
    Pieces are joined with a short crossfade (--crossfade, default 0.012 s). A film gap between pieces is silence: use
    it for a dead stop. "dips" lower the music by "db" (below 0; about -8 under a spoken line), fully down from "from" to "to",
    ramping down over "ramp" seconds (default 0.15) before "from" and back up over the same after "to". "fade_out" fades the last seconds of the film.
    
    --bars is the track's bar lines (the first beat of each bar), so every cut can be checked against them. It takes
    a JSON list of times, a JSON object with "downbeats" or "bars", or a text file with one time per line. A beat
    tracker gives beats, not bars: pass its beats with --beats-per-bar 4 (and --first-bar, the time of a bar's first
    beat you have checked by ear or against a section map) and every fourth beat from there is used (3 for a waltz). With --snap,
    cuts within half a bar move to the nearest bar line before anything is made.
    
    Claude can't hear whether --first-bar is right, and a wrong guess moves every bar line while the off-bar check still
    passes against the wrong grid. --clicks OUT.wav writes the whole track with a short tick on every bar line (no plan
    needed): send it to the user, ask whether the ticks fall on the first beat of each bar all the way through, and write
    their answer in the build log before fitting.
    
    Checks, reported per piece:
      stretch  a piece stretched or squeezed by more than --max-stretch (default 0.03, 3%): the tempo change can be heard
      off-bar  a cut more than --bar-slack seconds (default 0.03) from a bar line, except at the track's very start
               or end, or an end heard only after the film's end. Each cut is reported once. Only with --bars
      overlap  two pieces playing over each other for longer than the crossfade
      unchecked  no --bars given, so no cut was checked against the bar lines
    Gaps between pieces (silence, as for a dead stop) and music ending before the film are noted, not flagged.
    A piece reaching past the track's end is an error.
    Writes the fitted music (48 kHz, 24-bit stereo WAV) and OUT.json beside it with each piece's placement and
    stretch. Needs ffmpeg and ffprobe. Exit 0 all clear; 2 something to review (the music is still written); 1 an error,
    including a wrong command line.
    """
    from __future__ import annotations
    
    import argparse
    import array
    import json
    import math
    from pathlib import Path
    import shutil
    import subprocess
    import sys
    import tempfile
    import wave
    
    SR = 48000
    
    
    def duration(path: Path) -> float:
        run = subprocess.run(["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0", str(path)],
                             capture_output=True, text=True)
        try:
            return float(run.stdout.strip())
        except ValueError:
            raise RuntimeError(f"could not read the length of {path}: {run.stderr.strip()[-200:]}")
    
    
    def load_bars(path: Path, per_bar: int, first: float | None) -> list[float]:
        text = path.read_text().strip()
        times: list[float]
        try:
            data = json.loads(text)
            if isinstance(data, dict):
                data = data.get("downbeats") or data.get("bars") or []
            times = [float(t) for t in data]
        except json.JSONDecodeError:
            times = [float(line.split()[0]) for line in text.splitlines() if line.strip() and not line.startswith("#")]
        times.sort()
        if per_bar > 1 and times:
            start = 0 if first is None else min(range(len(times)), key=lambda i: abs(times[i] - first))
            times = times[start % per_bar::per_bar]
        if len(times) < 2:
            raise RuntimeError(f"{path}: fewer than two bar lines")
        return times
    
    
    def nearest(times: list[float], t: float) -> float:
        return min(times, key=lambda b: abs(b - t))
    
    
    def place(piece: dict, i: int) -> dict:
        """Film start, film length and stretch factor (track seconds per film second) for one piece."""
        try:
            a, b = (float(v) for v in piece["track"])
        except (KeyError, TypeError, ValueError):
            raise RuntimeError(f"piece {i + 1}: needs \"track\": [from, to]")
        if b <= a:
            raise RuntimeError(f"piece {i + 1}: track end {b} is not after its start {a}")
        if "film" in piece:
            fa, fb = (float(v) for v in piece["film"])
            if fb <= fa:
                raise RuntimeError(f"piece {i + 1}: film end {fb} is not after its start {fa}")
            return {"track": [a, b], "start": fa, "length": fb - fa, "speed": (b - a) / (fb - fa)}
        if "at" in piece:
            return {"track": [a, b], "start": float(piece["at"]), "length": b - a, "speed": 1.0}
        if "land" in piece:
            t, f = (float(v) for v in piece["land"])
            return {"track": [a, b], "start": f - (t - a), "length": b - a, "speed": 1.0}
        raise RuntimeError(f"piece {i + 1}: needs \"film\", \"at\" or \"land\"")
    
    
    def tempo_chain(speed: float) -> str:
        """atempo takes 0.5-100 per filter; a piece is only ever changed a few percent, but chain to be safe."""
        parts = []
        while speed > 2.0:
            parts.append("atempo=2.0")
            speed /= 2.0
        while speed < 0.5:
            parts.append("atempo=0.5")
            speed /= 0.5
        if abs(speed - 1.0) > 1e-6:
            parts.append(f"atempo={speed:.6f}")
        return ",".join(parts)
    
    
    def write_clicks(track: Path, bars: list[float], out: Path) -> int:
        """The whole track with a short 1.5 kHz tick on every bar line, for the user to check by ear."""
        length = duration(track)
        n = int(length * SR) + 1
        ticks = array.array("h", bytes(2 * n))
        tick = [int(12000 * math.sin(2 * math.pi * 1500 * k / SR) * (1 - k / (0.03 * SR))) for k in range(int(0.03 * SR))]
        for t in bars:
            s0 = int(t * SR)
            for k, v in enumerate(tick):
                if 0 <= s0 + k < n:
                    ticks[s0 + k] = v
        out.parent.mkdir(parents=True, exist_ok=True)
        with tempfile.TemporaryDirectory() as tmp:
            tick_wav = Path(tmp) / "ticks.wav"
            with wave.open(str(tick_wav), "wb") as w:
                w.setnchannels(1)
                w.setsampwidth(2)
                w.setframerate(SR)
                w.writeframes(ticks.tobytes())
            run = subprocess.run(["ffmpeg", "-hide_banner", "-loglevel", "error", "-y", "-i", str(track), "-i", str(tick_wav),
                                  "-filter_complex", f"[0:a]aresample={SR},aformat=channel_layouts=stereo,volume=0.6[m];"
                                  f"[1:a]aformat=channel_layouts=stereo[k];[m][k]amix=inputs=2:normalize=0:duration=first[o]",
                                  "-map", "[o]", "-c:a", "pcm_s16le", str(out)], capture_output=True, text=True)
        if run.returncode != 0:
            raise RuntimeError(f"ffmpeg failed: {run.stderr.strip()[-300:]}")
        print(f"{len(bars)} bar lines ticked; first at {bars[0]:.3f} s. Ask the user whether every tick falls on the first "
              f"beat of a bar: {out}")
        return 0
    
    
    def gain_expr(dips: list[dict]) -> str | None:
        """The music is fully down from "from" to "to"; it ramps down before "from" and back up after "to"."""
        terms = []
        for i, d in enumerate(dips, 1):
            try:
                lo, hi, db = float(d["from"]), float(d["to"]), float(d["db"])
                ramp = max(float(d.get("ramp", 0.15)), 0.001)
            except (KeyError, TypeError, ValueError):
                raise RuntimeError(f"dip {i}: needs \"from\", \"to\" and \"db\" as numbers")
            if hi <= lo:
                raise RuntimeError(f"dip {i}: \"to\" {hi} is not after \"from\" {lo}")
            if db >= 0:
                raise RuntimeError(f"dip {i}: \"db\" must be below 0 (a dip lowers the music), got {db}")
            drop = 1 - 10 ** (db / 20)
            terms.append(f"(1-{drop:.6f}*clip((t-{lo - ramp:.4f})/{ramp:.4f},0,1)*clip(({hi + ramp:.4f}-t)/{ramp:.4f},0,1))")
        return "*".join(terms) if terms else None
    
    
    class _Parser(argparse.ArgumentParser):
        def error(self, message):  # a usage error is exit 1, so exit 2 always means "music written, review it"
            self.print_usage(sys.stderr)
            self.exit(1, f"error: {message}\n")
    
    
    def main() -> int:
        ap = _Parser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
        ap.add_argument("track", type=Path)
        ap.add_argument("--plan", type=Path)
        ap.add_argument("--out", type=Path)
        ap.add_argument("--clicks", type=Path, help="write the track with a tick on every bar line, then stop")
        ap.add_argument("--bars", type=Path)
        ap.add_argument("--beats-per-bar", type=int, default=1)
        ap.add_argument("--first-bar", type=float)
        ap.add_argument("--snap", action="store_true")
        ap.add_argument("--max-stretch", type=float, default=0.03)
        ap.add_argument("--bar-slack", type=float, default=0.03)
        ap.add_argument("--crossfade", type=float, default=0.012)
        args = ap.parse_args()
    
        if not shutil.which("ffmpeg") or not shutil.which("ffprobe"):
            print("ffmpeg and ffprobe are needed", file=sys.stderr)
            return 1
        if args.first_bar is not None and args.beats_per_bar == 1:
            print("warning: --first-bar does nothing without --beats-per-bar", file=sys.stderr)
        if args.clicks:
            if not args.bars:
                ap.error("--clicks needs --bars")
            try:
                return write_clicks(args.track, load_bars(args.bars, args.beats_per_bar, args.first_bar), args.clicks)
            except (OSError, ValueError, RuntimeError) as e:
                print(f"error: {e}", file=sys.stderr)
                return 1
        if not args.plan or not args.out:
            ap.error("--plan and --out are needed (or --clicks to hear the bar lines)")
        try:
            plan = json.loads(args.plan.read_text())
            film = float(plan["film"])
            if not plan.get("pieces"):
                raise RuntimeError("the plan has no pieces")
            track_len = duration(args.track)
            bars = load_bars(args.bars, args.beats_per_bar, args.first_bar) if args.bars else None
            if args.snap and bars:
                half = (bars[-1] - bars[0]) / (len(bars) - 1) / 2
                for i, p in enumerate(plan["pieces"]):
                    if not isinstance(p, dict) or not isinstance(p.get("track"), list) or len(p["track"]) != 2:
                        raise RuntimeError(f"piece {i + 1}: needs \"track\": [from, to]")
                    a, b = (float(v) for v in p["track"])
                    na = nearest(bars, a) if a > 0.05 and abs(nearest(bars, a) - a) <= half else a
                    nb = nearest(bars, b) if b < track_len - 0.05 and abs(nearest(bars, b) - b) <= half else b
                    p["track"] = [na, nb]
            pieces = [place(p, i) for i, p in enumerate(plan["pieces"])]
            for i, p in enumerate(pieces):
                if p["track"][1] > track_len + 0.01:
                    raise RuntimeError(f"piece {i + 1}: reaches track {p['track'][1]:.2f} s, past the track's end at "
                                       f"{track_len:.2f} s")
            gexpr = gain_expr(plan.get("dips", []))
            fade_out = float(plan.get("fade_out", 0))
            if bars and args.beats_per_bar == 1 and len(bars) > 2:
                gaps = sorted(b - a for a, b in zip(bars, bars[1:]))
                if gaps[len(gaps) // 2] < 1.0:
                    print("warning: these bar lines are under 1 s apart, so they look like beats; pass --beats-per-bar "
                          "(4 for most music, 3 for a waltz)", file=sys.stderr)
        except (OSError, KeyError, TypeError, ValueError, RuntimeError) as e:
            print(f"error: {e}", file=sys.stderr)
            return 1
    
        xf = args.crossfade
        flags: list[str] = []
        order = sorted(range(len(pieces)), key=lambda i: pieces[i]["start"])
        reported: list[float] = []
        for n, i in enumerate(order):
            p = pieces[i]
            a, b = p["track"]
            p["stretch"] = p["speed"] - 1.0
            p["issues"] = []
            if abs(p["stretch"]) > args.max_stretch:
                p["issues"].append(f"stretch: {abs(p['stretch']) * 100:.1f}% "
                                   f"({'faster' if p['stretch'] > 0 else 'slower'}), over {args.max_stretch * 100:.0f}%")
            if bars:
                for name, t in (("start", a), ("end", b)):
                    if (name == "start" and t <= 0.05) or (name == "end" and t >= track_len - 0.05):
                        continue
                    if name == "end" and p["start"] + p["length"] >= film - 0.01:
                        continue  # this end is after the film's end, so it is never heard
                    if any(abs(t - c) < 0.001 for c in reported):
                        continue  # the same cut, already reported as the previous piece's end
                    reported.append(t)
                    off = t - nearest(bars, t)
                    if abs(off) > args.bar_slack:
                        p["issues"].append(f"off-bar: cut at track {t:.3f} s ({name}) is {off * 1000:+.0f} ms from "
                                           f"the bar line at {nearest(bars, t):.3f} s")
            p["notes"] = []
            if p["start"] < -0.001:
                p["notes"].append(f"starts {-p['start']:.2f} s before 0:00; that part is left out")
            if p["start"] + p["length"] > film + 0.01:
                p["notes"].append(f"runs {p['start'] + p['length'] - film:.2f} s past the film's end and is cut there")
            for j in order[n + 1:]:
                ov = p["start"] + p["length"] - pieces[j]["start"]
                if ov > xf + 0.001:
                    p["issues"].append(f"overlap: plays {ov:.2f} s over piece {j + 1}")
            if n + 1 < len(order):
                q = pieces[order[n + 1]]
                over = p["start"] + p["length"] - q["start"]
                if over < -xf - 0.001:
                    p["notes"].append(f"silence for {-over:.2f} s after it, until film {q['start']:.2f} s")
                # carry on past the join by one crossfade so the next piece fades in over it
                p["tail"] = xf if abs(over) <= xf + 0.001 and b + xf * p["speed"] <= track_len else 0.0
            else:
                p["tail"] = 0.0
    
        for p in pieces:  # a piece placed before 0:00 starts where the film does
            if p["start"] < 0:
                p["track"][0] -= p["start"] * p["speed"]
                p["length"] += p["start"]
                p["start"] = 0.0
    
        # One ffmpeg graph: trim, stretch, fade and place each piece, add them, dip, fade out, cut to the film's length.
        chains, labels = [], []
        for i, p in enumerate(pieces):
            a, b = p["track"]
            src_end = min(b + p["tail"] * p["speed"], track_len)
            length = p["length"] + p["tail"]
            filt = [f"atrim=start={a:.6f}:end={src_end:.6f}", "asetpts=PTS-STARTPTS", f"aresample={SR}",
                    "aformat=sample_fmts=fltp:channel_layouts=stereo"]
            if tempo_chain(p["speed"]):
                filt.append(tempo_chain(p["speed"]))
            filt += [f"atrim=end={length:.6f}", "asetpts=PTS-STARTPTS",
                     f"afade=t=in:d={xf:.4f}:curve=tri", f"afade=t=out:st={max(length - xf, 0):.6f}:d={xf:.4f}:curve=tri"]
            start = p["start"]
            delay = round(start * SR)
            if delay:
                filt.append(f"adelay=delays={delay}S:all=1")
            chains.append(f"[0:a]{','.join(filt)}[p{i}]")
            labels.append(f"[p{i}]")
        mix = f"{''.join(labels)}amix=inputs={len(pieces)}:normalize=0:duration=longest" if len(pieces) > 1 else \
            f"{labels[0]}anull"
        post = [f"apad=whole_dur={film:.6f}", f"atrim=end={film:.6f}", "asetnsamples=n=64"]
        if gexpr:
            post.append(f"volume='{gexpr}':eval=frame")
        if fade_out > 0:
            post.append(f"afade=t=out:st={film - fade_out:.6f}:d={fade_out:.6f}")
        graph = ";".join(chains) + f";{mix},{','.join(post)}[out]"
        args.out.parent.mkdir(parents=True, exist_ok=True)
        run = subprocess.run(["ffmpeg", "-hide_banner", "-loglevel", "error", "-y", "-i", str(args.track),
                              "-filter_complex", graph, "-map", "[out]", "-ar", str(SR), "-ac", "2",
                              "-c:a", "pcm_s24le", str(args.out)], capture_output=True, text=True)
        if run.returncode != 0:
            print(f"error: ffmpeg failed: {run.stderr.strip()[-400:]}", file=sys.stderr)
            return 1
    
        for i in order:
            p = pieces[i]
            a, b = p["track"]
            print(f"piece {i + 1}: track {a:7.3f}-{b:7.3f} s -> film {p['start']:6.2f}-{p['start'] + p['length']:6.2f} s, "
                  f"stretch {p['stretch'] * 100:+.1f}%")
            for note in p["notes"]:
                print(f"  note: {note}")
            for issue in p["issues"]:
                print(f"  REVIEW {issue}")
                flags.append(f"piece {i + 1}: {issue}")
        report = {"track": str(args.track.resolve()), "track_length": track_len, "film": film, "out": str(args.out.resolve()),
                  "bars_checked": bool(bars),
                  "pieces": [{"piece": i + 1, "track": pieces[i]["track"], "film_start": round(pieces[i]["start"], 4),
                              "film_end": round(pieces[i]["start"] + pieces[i]["length"], 4),
                              "stretch": round(pieces[i]["stretch"], 5), "issues": pieces[i]["issues"]} for i in order],
                  "dips": plan.get("dips", []), "flags": flags}
        args.out.with_suffix(".json").write_text(json.dumps(report, indent=1) + "\n")
        end = max(p["start"] + p["length"] for p in pieces)
        if end < film - 0.01:
            print(f"note: the music ends at film {end:.2f} s, {film - end:.2f} s before the film does")
        if not bars:
            print("REVIEW unchecked: bar lines not checked; pass --bars to check every cut against them.")
            flags.append("unchecked: no --bars, so no cut was checked against the bar lines")
        print(f"{len(flags)} to review; music in {args.out}" if flags else f"All clear; music in {args.out}")
        return 2 if flags else 0
    
    
    if __name__ == "__main__":
        sys.exit(main())
    
  • skills/video-director/scripts/motion_check.py19 KB6d6da633db9eupstream ↗
    #!/usr/bin/env python3
    """Choppy-motion checks for check_render.py --motion.
    
    Two parts:
      timeline probe  steps the composition every frame and watches every element a tween moves
      flicker scan    reads the rendered video frame by frame, region by region
    
    Candidates require contextual visual review before delivery; they are not semantic failures:
      pop       a tweened value jumps most of its change in a single frame, or a stroke tween never animates
      stall     words of one line arrive with visible pauses between them; or motion stops and restarts inside a move
      stepping  an element creeps slower than about half a pixel per frame for over a second (it steps visibly)
      abrupt    a visible element switches on, off or its clip changes in one frame, away from a cut
      edge-on   an element turned in 3D passes edge-on to the camera while visible
      flash     two large light elements are both half-faded over each other (reads as a white flash)
      flicker   a region of the video changes on one frame and changes back on the next (A-B-A)
    """
    from __future__ import annotations
    
    import json
    import shutil
    import subprocess
    import sys
    from pathlib import Path
    
    
    class CoverageError(RuntimeError):
        """A requested measurement was unavailable; no quality verdict is possible."""
    
    
    # Thresholds. Names say what they measure; units are pixels, frames, seconds or opacity (0-1).
    POP_SHARE = 0.6            # one frame carries more than this share of a tween's total change
    POP_MIN_FRAMES = 6         # only tweens at least this many frames long can pop
    POP_MIN_CHANGE = {"x": 6, "y": 6, "w": 6, "h": 6, "op": 0.25, "dash": 6}
    WORD_GAP = 0.1             # seconds between two words of one line arriving
    CREEP_SPEED = 0.5          # px per frame
    CREEP_SECONDS = 1.0
    ABRUPT_OPACITY = 0.5       # opacity change in one frame
    MIN_AREA = 0.005           # share of the frame an element must cover to count as visible for abrupt checks
    EDGE_RATIO = 0.15          # a 3D turn counts as edge-on when its narrower side shrinks below 15% of the element's own size
    FLASH_AREA = 0.10          # two overlapping elements must each cover 10% of the frame before a half-fade reads as a white flash
    FLASH_OPACITY = (0.2, 0.8) # both elements partly faded in this range at once; outside it one of them is clearly in front
    FLICKER_DIFF = 6.0         # mean grey-level difference (0-255) in one region
    FLICKER_RETURN = 0.35      # frame N-1 and N+1 must match this closely relative to their difference from N
    
    MOTION_PROBE = r"""
    <script id="vd-motion-src">
    (function () {
      const T = %(thresholds)s;
      function root() { return document.querySelector("[data-composition-id]"); }
      function timelines() { const all = window.__timelines || {}; const id = root() && root().getAttribute("data-composition-id"); return id && all[id] ? [all[id]] : Object.values(all); }
      const clips = [...document.querySelectorAll("[data-start]")].filter(el => el !== root());
      function applyClips(t) { for (const el of clips) { const s = parseFloat(el.getAttribute("data-start")) || 0, d = parseFloat(el.getAttribute("data-duration")); el.style.visibility = (t >= s - 1e-6 && (isNaN(d) || t < s + d - 1e-6)) ? "" : "hidden"; } }
      function seek(t) { applyClips(t); for (const tl of timelines()) { tl.seek(t, false); } }
      function chain(el) { let o = 1; for (let n = el; n && n.nodeType === 1; n = n.parentElement) { const cs = getComputedStyle(n); if (cs.display === "none" || cs.visibility === "hidden") return 0; o *= parseFloat(cs.opacity); } return o; }
      function sel(el) { if (el.id) return "#" + el.id; let p = el.parentElement, path = el.tagName.toLowerCase(); while (p && !p.id && p !== document.body) { path = p.tagName.toLowerCase() + ">" + path; p = p.parentElement; } return (p && p.id ? "#" + p.id + " " : "") + path; }
      function lum(c) { const m = c.match(/rgba?\(([^)]+)\)/); if (!m) return [0, 0]; const v = m[1].split(",").map(parseFloat); return [(0.2126 * v[0] + 0.7152 * v[1] + 0.0722 * v[2]) / 255, v.length > 3 ? v[3] : 1]; }
      function run() {
        const r = root(), W = innerWidth, H = innerHeight, FA = W * H;
        const dur = parseFloat(r && r.getAttribute("data-duration")) || 0;
        const fps = Math.min(60, parseFloat(r && r.getAttribute("data-fps")) || 30), dt = 1 / fps;
        const cuts = [...new Set(clips.flatMap(el => { const s = parseFloat(el.getAttribute("data-start")), d = parseFloat(el.getAttribute("data-duration")); return [s, s + d]; }).filter(x => !isNaN(x)))];
        const nearCut = t => cuts.some(c => Math.abs(c - t) <= dt * 1.5);
        // which elements are tweened, when, and what properties
        const tw = new Map();
        for (const tl of timelines()) {
          if (!tl.getChildren) continue;
          for (const c of tl.getChildren(true, true, false)) {
            if (!c.targets) continue;
            let start = c.startTime(), p = c.parent; while (p && p !== tl && p.startTime) { start += p.startTime(); p = p.parent; }
            const props = Object.keys(c.vars || {});
            for (const el of c.targets()) { if (!(el instanceof Element)) continue; if (!tw.has(el)) tw.set(el, []); tw.get(el).push({ start, end: start + c.duration(), props }); }
          }
        }
        const els = [...tw.keys()];
        const S = els.map(() => ({ prev: null, series: {}, creep: 0, creepStart: 0, edgeDone: false, abruptAt: -9, arrive: null }));
        const findings = [], flashSeen = new Set();
        const n = Math.floor(dur * fps);
        for (let f = 0; f <= n; f++) {
          const t = f * dt; seek(t);
          const vis = [];
          els.forEach((el, k) => {
            const st = S[k], rc = el.getBoundingClientRect(), op = chain(el), cs = getComputedStyle(el);
            const cur = { x: rc.left, y: rc.top, w: rc.width, h: rc.height, op, clip: cs.clipPath + "|" + cs.webkitMaskImage, dash: parseFloat(cs.strokeDashoffset) || 0, area: rc.width * rc.height / FA };
            const active = tw.get(el).filter(w => t >= w.start - 1e-6 && t <= w.end + 1e-6);
            for (const w of active) { const key = w.start.toFixed(3); (st.series[key] = st.series[key] || { w, rows: [] }).rows.push([t, cur.x, cur.y, cur.w, cur.h, cur.op, cur.dash]); }
            const p = st.prev;
            if (p) {
              const seen = Math.max(p.op, op) >= 0.3 && Math.max(p.area, cur.area) >= T.MIN_AREA;
              if (seen && !nearCut(t) && t - st.abruptAt > 0.5) {
                const dOp = Math.abs(op - p.op);
                if (dOp >= T.ABRUPT_OPACITY && !active.some(w => w.end - w.start >= 2 * dt)) { findings.push({ check: "abrupt", time: t, selector: sel(el), box: [rc.left, rc.top, rc.width, rc.height], detail: `opacity ${p.op.toFixed(2)} → ${op.toFixed(2)} in one frame` }); st.abruptAt = t; }
                else if (cur.clip !== p.clip && op >= 0.3 && !active.some(w => w.end - w.start >= 2 * dt)) { findings.push({ check: "abrupt", time: t, selector: sel(el), box: [rc.left, rc.top, rc.width, rc.height], detail: "clip or mask changed in one frame while visible" }); st.abruptAt = t; }
              }
              const speed = Math.hypot(cur.x - p.x, cur.y - p.y);
              if (op >= 0.3 && speed > 0.02 && speed < T.CREEP_SPEED) { if (!st.creep) st.creepStart = t; st.creep++; }
              else { if (st.creep * dt >= T.CREEP_SECONDS) findings.push({ check: "stepping", time: st.creepStart, selector: sel(el), box: [rc.left, rc.top, rc.width, rc.height], detail: `moves under ${T.CREEP_SPEED}px a frame for ${(st.creep * dt).toFixed(1)}s; it steps instead of gliding` }); st.creep = 0; }
              const turns = tw.get(el).some(w => w.props.some(k => /^rotat(ion|e)[XY]$/.test(k)));
              if (turns && !st.edgeDone && op >= 0.3 && el.offsetWidth > 40 && el.offsetHeight > 40) {
                const rx = rc.width / el.offsetWidth, ry = rc.height / el.offsetHeight;
                if (Math.min(rx, ry) < T.EDGE_RATIO && Math.max(p.w / el.offsetWidth, p.h / el.offsetHeight) > 0.3) { findings.push({ check: "edge-on", time: t, selector: sel(el), box: [rc.left, rc.top, rc.width, rc.height], detail: "turns edge-on to the camera while visible" }); st.edgeDone = true; }
              }
            }
            if (op >= 0.95 && st.arrive === null) st.arrive = t;
            if (op > 0.02 && cur.area >= T.FLASH_AREA) vis.push({ k, rc, op, el });
            st.prev = cur;
          });
          // two large light elements both half-faded over each other
          for (let i = 0; i < vis.length; i++) for (let j = i + 1; j < vis.length; j++) {
            const a = vis[i], b = vis[j];
            if (a.el.contains(b.el) || b.el.contains(a.el)) continue;
            if (!(a.op >= T.FLASH_OPACITY[0] && a.op <= T.FLASH_OPACITY[1] && b.op >= T.FLASH_OPACITY[0] && b.op <= T.FLASH_OPACITY[1])) continue;
            const [la, aa] = lum(getComputedStyle(a.el).backgroundColor), [lb, ab] = lum(getComputedStyle(b.el).backgroundColor);
            if (la < 0.8 || lb < 0.8 || aa < 0.5 || ab < 0.5) continue;
            const ix = Math.max(0, Math.min(a.rc.right, b.rc.right) - Math.max(a.rc.left, b.rc.left)), iy = Math.max(0, Math.min(a.rc.bottom, b.rc.bottom) - Math.max(a.rc.top, b.rc.top));
            if (ix * iy < 0.5 * Math.min(a.rc.width * a.rc.height, b.rc.width * b.rc.height)) continue;
            const key = a.k + ":" + b.k; if (flashSeen.has(key)) continue; flashSeen.add(key);
            findings.push({ check: "flash", time: t, selector: sel(a.el) + " + " + sel(b.el), box: [Math.min(a.rc.left, b.rc.left), Math.min(a.rc.top, b.rc.top), Math.max(a.rc.right, b.rc.right) - Math.min(a.rc.left, b.rc.left), Math.max(a.rc.bottom, b.rc.bottom) - Math.min(a.rc.top, b.rc.top)], detail: `two light elements crossfade over each other (${a.op.toFixed(2)} and ${b.op.toFixed(2)} opacity)` });
          }
        }
        // which measurements each tweened property moves
        const MOVES = [[/^(x|left|right|xPercent|translateX)$/, ["x"]], [/^(y|top|bottom|yPercent|translateY)$/, ["y"]],
          [/^(scale|z|translateZ)$/, ["x", "y", "w", "h"]], [/^(scaleX|width|rotationY|rotateY)$/, ["w"]], [/^(scaleY|height|rotationX|rotateX)$/, ["h"]],
          [/^(opacity|autoAlpha)$/, ["op"]], [/stroke|drawSVG/i, ["dash"]]];
        const moved = props => { const out = new Set(); for (const p of props) for (const [re, m] of MOVES) if (re.test(p)) m.forEach(x => out.add(x)); return out; };
        // pops and stops inside each tween
        els.forEach((el, k) => {
          const sets = tw.get(el).filter(x => x.end - x.start < 2 * dt);
          for (const { w, rows } of Object.values(S[k].series)) {
            if (rows.length < T.POP_MIN_FRAMES) continue;
            const animates = moved(w.props);
            if (sets.some(x => x.start > w.start + dt && x.start < w.end - dt)) continue; // an instant set lands inside this move; judged as "abrupt" instead
            const others = tw.get(el).some(x => x !== w && x.end - x.start >= 2 * dt && x.start < w.end && x.end > w.start);
            const names = ["x", "y", "w", "h", "op", "dash"];
            names.forEach((name, i) => {
              if (!animates.has(name) || others) return;
              const v = rows.map(r => r[i + 1]), d = v.slice(1).map((x, j) => Math.abs(x - v[j]));
              const sum = d.reduce((a, b) => a + b, 0), mx = Math.max(...d);
              if (sum >= T.POP_MIN_CHANGE[name] && mx > T.POP_SHARE * sum) { const at = rows[d.indexOf(mx) + 1][0]; findings.push({ check: "pop", time: at, selector: sel(el), box: null, detail: `${name} jumps ${mx.toFixed(name === "op" ? 2 : 0)} of ${sum.toFixed(name === "op" ? 2 : 0)} in one frame during a ${(w.end - w.start).toFixed(2)}s move` }); }
              if (name === "x" || name === "y") {
                // moving, then stopped for 3+ frames, then moving again within the same tween
                let state = 0, stopped = 0;
                for (const x of d) { if (x > 0.5) { if (state === 2 && stopped >= 3) { findings.push({ check: "stall", time: rows[0][0], selector: sel(el), box: null, detail: `stops and restarts inside a ${(w.end - w.start).toFixed(2)}s move` }); break; } state = 1; stopped = 0; } else if (state >= 1 && x < 0.05) { state = 2; stopped++; } }
              }
            });
            if (w.props.some(p => /stroke/i.test(p))) {
              const v = rows.map(r => r[6]), d = v.slice(1).map((x, j) => Math.abs(x - v[j])), sum = d.reduce((a, b) => a + b, 0);
              if (sum < 1) findings.push({ check: "pop", time: w.start, selector: sel(el), box: null, detail: "a stroke tween runs but the stroke never changes; it will appear all at once" });
            }
          }
        });
        // words of one line arriving with pauses between them
        document.querySelectorAll("[data-text-role]").forEach(line => {
          const arr = els.map((el, k) => [el, S[k].arrive]).filter(([el, a]) => a !== null && line.contains(el) && el !== line).map(([, a]) => a).sort((a, b) => a - b);
          for (let i = 1; i < arr.length; i++) if (arr[i] - arr[i - 1] >= T.WORD_GAP - 1e-6 && arr[i] - arr[i - 1] < 1.5) { findings.push({ check: "stall", time: arr[i - 1], selector: sel(line), box: null, detail: `words arrive ${(arr[i] - arr[i - 1]).toFixed(2)}s apart; review voice/beat alignment and phrase continuity (${arr.length} words over ${(arr[arr.length - 1] - arr[0]).toFixed(2)}s); a steady 0.1–0.3s cadence may be intentional` }); break; }
        });
        const out = document.createElement("script"); out.type = "application/json"; out.id = "vd-motion";
        out.textContent = JSON.stringify({ fps, frames: n + 1, tracked: els.length, findings });
        document.body.appendChild(out);
      }
      function go() { try { run(); } catch (e) { const out = document.createElement("script"); out.type = "application/json"; out.id = "vd-motion"; out.textContent = JSON.stringify({ error: String(e && e.stack || e) }); document.body.appendChild(out); } }
      window.addEventListener("load", () => setTimeout(() => (document.fonts ? document.fonts.ready : Promise.resolve()).then(go), 300));
    })();
    </script>
    """
    
    
    def thresholds() -> dict:
        return {"POP_SHARE": POP_SHARE, "POP_MIN_FRAMES": POP_MIN_FRAMES, "POP_MIN_CHANGE": POP_MIN_CHANGE, "WORD_GAP": WORD_GAP,
                "CREEP_SPEED": CREEP_SPEED, "CREEP_SECONDS": CREEP_SECONDS, "ABRUPT_OPACITY": ABRUPT_OPACITY, "MIN_AREA": MIN_AREA,
                "EDGE_RATIO": EDGE_RATIO, "FLASH_AREA": FLASH_AREA, "FLASH_OPACITY": list(FLASH_OPACITY)}
    
    
    def timeline_motion(index: Path, size: tuple[int, int], budget: int, dump_with_script) -> dict:
        script = MOTION_PROBE % {"thresholds": json.dumps(thresholds())}
        return dump_with_script(index, size, budget, script, "vd-motion", timeout=900)
    
    
    def flicker_scan(video: Path, grid: int = 4) -> list[dict]:
        """Find A-B-A frames: region changes on frame N and changes back on N+1."""
        try:
            import numpy as np
        except ImportError:
            raise CoverageError("flicker measurement unavailable: install numpy (python3 -m pip install numpy) in the chosen interpreter")
        w, h = 160, 96
        probe = subprocess.run(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries", "stream=r_frame_rate", "-of", "csv=p=0", str(video)],
                               capture_output=True, text=True, check=True).stdout.strip()
        num, _, den = probe.partition("/")
        if not num:
            raise CoverageError("ffprobe returned no video frame rate")
        fps = float(num) / float(den or 1)
        if fps <= 0:
            raise CoverageError("ffprobe returned a nonpositive frame rate")
        raw = subprocess.run(["ffmpeg", "-v", "error", "-i", str(video), "-vf", f"scale={w}:{h},format=gray", "-f", "rawvideo", "-"],
                             capture_output=True, check=True).stdout
        if not raw or len(raw) % (h * w):
            raise CoverageError("ffmpeg returned missing/incomplete grayscale frames for flicker measurement")
        frames = np.frombuffer(raw, dtype=np.uint8).reshape(-1, h, w).astype(np.int16)
        if len(frames) < 3:
            raise CoverageError("flicker measurement needs at least three decoded frames")
        ch, cw = h // grid, w // grid
        cells = frames[:, : ch * grid, : cw * grid].reshape(len(frames), grid, ch, grid, cw)
        d1 = np.abs(cells[1:] - cells[:-1]).mean(axis=(2, 4))          # N vs N-1, per cell
        d2 = np.abs(cells[2:] - cells[:-2]).mean(axis=(2, 4))          # N+1 vs N-1
        prev, nxt = d1[:-1], d1[1:]                                     # for N = 1..len-2
        hit = (prev > FLICKER_DIFF) & (nxt > FLICKER_DIFF) & (d2 < FLICKER_RETURN * np.minimum(prev, nxt))
        events: list[dict] = []
        for n in np.argwhere(hit.any(axis=(1, 2))).ravel():
            f = int(n) + 1
            r, c = np.argwhere(hit[n])[0]
            t = f / fps
            if events and t - events[-1]["end"] <= 0.25:
                events[-1]["end"] = t; events[-1]["count"] += 1
            else:
                events.append({"start": t, "end": t, "count": 1, "cell": [int(r), int(c)]})
        out = []
        for e in events:
            r, c = e["cell"]
            out.append({"check": "flicker", "time": round(e["start"], 3), "selector": f"video region row {r + 1}, column {c + 1} of {grid}",
                        "box_frac": [c / grid, r / grid, 1 / grid, 1 / grid],
                        "detail": f"{e['count']} frame(s) change and change back (A-B-A) between {e['start']:.2f}s and {e['end']:.2f}s"})
        return out
    
    
    def crop_strip(video: Path, t: float, box: list[float] | None, size: tuple[int, int], out: Path) -> str | None:
        """Every frame from t-0.15 s to t+0.15 s, cropped around the finding, tiled left to right."""
        if not shutil.which("ffmpeg"):
            raise CoverageError("ffmpeg is required for motion evidence strips")
        vf = []
        if box:
            x, y, w, h = box
            pad = 40
            x0, y0 = max(0, int(x - pad)), max(0, int(y - pad))
            cw, ch = min(size[0] - x0, int(w + 2 * pad)), min(size[1] - y0, int(h + 2 * pad))
            if cw > 16 and ch > 16:
                vf.append(f"crop={cw}:{ch}:{x0}:{y0}")
        vf += ["scale=320:-2", "tile=10x2:padding=3:color=gray"]
        a = max(0.0, t - 0.15)
        subprocess.run(["ffmpeg", "-v", "error", "-y", "-ss", f"{a:.3f}", "-t", "0.3", "-i", str(video), "-vf", ",".join(vf), "-frames:v", "1", str(out)],
                       check=True)
        if not out.exists():
            raise CoverageError(f"ffmpeg wrote no motion evidence strip: {out}")
        return str(out)
    
    
    def pixel_change(video: Path, t: float, box: list[float] | None, size: tuple[int, int], fps: float) -> float | None:
        """Mean grey-level difference inside box between the frame before t and the frame at t, in the render."""
        try:
            import numpy as np
        except ImportError:
            return None
        vf = []
        if box:
            x, y, w, h = box
            x0, y0 = max(0, int(x)), max(0, int(y))
            cw, ch = min(size[0] - x0, int(w)), min(size[1] - y0, int(h))
            if cw < 8 or ch < 8:
                return None
            vf.append(f"crop={cw}:{ch}:{x0}:{y0}")
        vf += ["scale=96:54", "format=gray"]
        a = max(0.0, t - 2.0 / fps)
        raw = subprocess.run(["ffmpeg", "-v", "error", "-ss", f"{a:.4f}", "-i", str(video), "-frames:v", "4", "-vf", ",".join(vf), "-f", "rawvideo", "-"],
                             capture_output=True, check=True).stdout
        frames = np.frombuffer(raw, dtype=np.uint8).reshape(-1, 54, 96).astype(np.int16)
        if len(frames) < 2:
            return None
        return float(max(np.abs(frames[i + 1] - frames[i]).mean() for i in range(len(frames) - 1)))
    
  • skills/video-director/scripts/render_frames.py10 KBa2ec351f811dupstream ↗
    #!/usr/bin/env python3
    """Render storyboard frames from a frames HTML file to PNG with headless Chrome, then check each one.
    
    Each frame is drawn at <frames.html>#<id>&clean (notes removed) unless --with-notes is given.
    Checks per frame:
      FAIL  the frame script threw an error, the frame is missing, or output is missing
      WARN  a line of on-screen text overlaps a visual element or sits outside the title-safe area, or anything
            sits in the bottom band (default bottom 17%, set BRAND.clearBottom)
    WARN layout items are candidates for a person to look at; they are not verdicts.
    Blank-image heuristics require review via --reviews. Exit 0 structural completion; 2 review required; 1 error.
    
    Usage:
      python3 render_frames.py storyboard/frames.html --all --out storyboard/frames-v0.2
      python3 render_frames.py storyboard/frames.html --ids 01a,01b,02a --out storyboard/frames-v0.2
      python3 render_frames.py storyboard/frames.html --ids 01a --variant cool --out storyboard/looks
    """
    from __future__ import annotations
    
    import argparse
    import hashlib
    import json
    import os
    import re
    import shutil
    import subprocess
    import sys
    import tempfile
    from pathlib import Path
    
    CHROME_CANDIDATES = [
        "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
        "/Applications/Chromium.app/Contents/MacOS/Chromium",
        "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
    ]
    
    
    def find_chrome() -> str:
        env = os.environ.get("CHROME")
        if env and Path(env).exists():
            return env
        for c in CHROME_CANDIDATES:
            if Path(c).exists():
                return c
        for name in ("google-chrome", "google-chrome-stable", "chromium", "chromium-browser", "msedge"):
            found = shutil.which(name)
            if found:
                return found
        sys.exit("FAIL: no Chrome or Chromium found. Set CHROME=/path/to/chrome.")
    
    
    def chrome(binary: str, profile: str, size: tuple[int, int], budget: int, *args: str) -> subprocess.CompletedProcess:
        cmd = [binary, "--headless=new", "--hide-scrollbars", "--disable-gpu", "--allow-file-access-from-files",
               f"--user-data-dir={profile}", f"--window-size={size[0]},{size[1]}", f"--virtual-time-budget={budget}", *args]
        try:
            return subprocess.run(cmd, capture_output=True, text=True, timeout=120)
        except subprocess.TimeoutExpired:
            return subprocess.CompletedProcess(cmd, 124, stdout="", stderr="Chrome timed out after 120 s")
    
    
    def frame_info(binary: str, profile: str, url: str) -> tuple[list[str], tuple[int, int]]:
        """Return the frame ids and the frame size the file declares (BRAND.size)."""
        result = chrome(binary, profile, (1920, 1080), 1500, "--dump-dom", f"{url}#__list")
        if result.returncode:
            raise RuntimeError(f"Chrome frame listing failed: {result.stderr[-500:]}")
        out = result.stdout
        m = re.search(r'<pre id="frame-list">(.*?)</pre>', out, re.S)
        z = re.search(r'<pre id="frame-size">(\d+)x(\d+)</pre>', out)
        if not m or not z:
            sys.exit("FAIL: could not list frames. Does the file load frame-kit.js and call KIT.renderFrame()? "
                     "A JavaScript syntax error (often a stray comma between frames) stops the whole file.")
        return [line.strip() for line in m.group(1).splitlines() if line.strip()], (int(z.group(1)), int(z.group(2)))
    
    
    def blank_check(png: Path) -> str | None:
        """Return a reason if the PNG looks blank."""
        try:
            from PIL import Image, ImageStat  # optional
            im = Image.open(png).convert("L").resize((96, 54))
            if max(ImageStat.Stat(im).stddev) < 2.0:
                return "the frame is a single flat color"
            return None
        except ImportError:
            return "file is suspiciously small (likely blank)" if png.stat().st_size < 12_000 else None
    
    
    def main() -> int:
        ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
        ap.add_argument("frames", type=Path)
        ap.add_argument("--out", type=Path, required=True)
        g = ap.add_mutually_exclusive_group(required=True)
        g.add_argument("--all", action="store_true")
        g.add_argument("--ids")
        ap.add_argument("--variant", help="draw each frame with &variant=<name>; files are saved as <id>@<variant>.png")
        ap.add_argument("--with-notes", action="store_true", help="keep the dashed reviewer notes in the PNGs")
        ap.add_argument("--size", help="window size WxH; by default the size the frames file declares in BRAND.size")
        ap.add_argument("--reviews", type=Path, help="JSON list of {id, sha256, reason} dispositions for blank:<frame-id> candidates")
        ap.add_argument("--budget", type=int, default=2500, help="milliseconds of page time before capture")
        args = ap.parse_args()
    
        frames = args.frames.resolve()
        if not frames.exists():
            sys.exit(f"FAIL: {frames} not found")
        binary = find_chrome()
        url = frames.as_uri()
        args.out.mkdir(parents=True, exist_ok=True)
        failures, warnings, pending = 0, 0, 0
        reviews = {}
        if args.reviews:
            raw = json.loads(args.reviews.read_text())
            if not isinstance(raw, list):
                raise ValueError("--reviews must be a list of {id, sha256, reason}")
            for item in raw:
                if not isinstance(item, dict) or not isinstance(item.get("id"), str) or not isinstance(item.get("reason"), str) or not item["reason"].strip():
                    raise ValueError("each review needs string id and nonempty reason")
                if item["id"] in reviews:
                    raise ValueError(f"duplicate review id: {item['id']}")
                if not isinstance(item.get("sha256"), str):
                    raise ValueError("each review requires the current printed sha256")
                reviews[item["id"]] = (item["sha256"], item["reason"].strip())
        with tempfile.TemporaryDirectory() as profile:
            all_ids, declared = frame_info(binary, profile, url)
            w, h = (int(x) for x in args.size.lower().split("x")) if args.size else declared
            ids = all_ids if args.all else [i.strip() for i in args.ids.split(",") if i.strip()]
            if not ids:
                sys.exit("FAIL: no frames found. FRAMES is empty, or the page script stopped before defining it.")
            for fid in ids:
                suffix = "" if args.with_notes else "&clean"
                if args.variant:
                    suffix += f"&variant={args.variant}"
                target = f"{url}#{fid}{suffix}"
                name = f"{fid}@{args.variant}.png" if args.variant else f"{fid}.png"
                png = args.out / name
                # Capture into fresh scratch; a failed Chrome invocation cannot reuse an older PNG.
                with tempfile.TemporaryDirectory() as capture_dir:
                    fresh = Path(capture_dir) / "frame.png"
                    capture = chrome(binary, profile, (w, h), args.budget, f"--screenshot={fresh}", target)
                    if capture.returncode or not fresh.is_file():
                        raise RuntimeError(f"Chrome capture failed for {fid}: {capture.stderr[-500:]}")
                    shutil.copyfile(fresh, png)
                dump = chrome(binary, profile, (w, h), args.budget, "--dump-dom", target)
                if dump.returncode:
                    raise RuntimeError(f"Chrome layout probe failed for {fid}: {dump.stderr[-500:]}")
                dom = dump.stdout
                m = re.search(r'<script type="application/json" id="layout-report">(.*?)</script>', dom, re.S)
                problems, notes = [], []
                if not png.exists():
                    problems.append("no PNG was written")
                elif (reason := blank_check(png)):
                    cid = f"blank:{fid}"
                    digest = hashlib.sha256(png.read_bytes()).hexdigest()
                    if reviews.get(cid, (None,))[0] == digest:
                        notes.append(f"REVIEWED {cid}: {reviews[cid][1]}")
                    else:
                        pending += 1
                        notes.append(f"REVIEW {cid} sha256={digest}: {reason}; inspect actual PNG and intent")
                if not m:
                    problems.append("no layout report (the page script did not run; check for a syntax error)")
                else:
                    rep = json.loads(m.group(1))
                    if rep.get("size") and tuple(rep["size"]) != (w, h):
                        problems.append(f"the frame is {rep['size'][0]}x{rep['size'][1]} but was rendered at {w}x{h}; drop --size or match BRAND.size")
                    if rep.get("error"):
                        problems.append(rep["error"])
                    if rep.get("empty"):
                        problems.append("the frame drew nothing")
                    low = rep.get("lowband", [])
                    if low:
                        notes.append(f"{len(low)} element(s) in the bottom band, e.g. {low[0]['element']} at {low[0]['box']}")
                    for u in rep.get("unsafe", []):
                        notes.append(f'line outside title-safe area: "{u}"')
                    seen = set()
                    for o in rep.get("overlaps", []):
                        key = (o["caption"], o["element"], tuple(o["box"]))
                        if key in seen:
                            continue
                        seen.add(key)
                        notes.append(f'line "{o["caption"][:40]}" touches {o["element"]} at {o["box"]}')
                if problems:
                    failures += 1
                    print(f"FAIL {fid}: " + "; ".join(problems))
                elif notes:
                    warnings += 1
                    print(f"WARN {fid}:")
                    for n in notes[:8]:
                        print(f"     - {n}")
                    if len(notes) > 8:
                        print(f"     - and {len(notes) - 8} more")
                else:
                    print(f"PASS {fid}")
        print(f"\n{len(ids)} frames → {args.out.resolve()}  ({failures} failed, {warnings} with warnings)")
        if warnings:
            print("Open each WARN frame and decide: a real overlap gets fixed; a deliberate one gets a reason in the storyboard.")
        return 1 if failures else 2 if pending else 0
    
    
    if __name__ == "__main__":
        try:
            raise SystemExit(main())
        except (OSError, ValueError, TypeError, KeyError, AttributeError, RuntimeError) as exc:
            print(f"ERROR: invalid or unreadable frame input/output: {exc}", file=sys.stderr)
            raise SystemExit(1)
    
  • skills/video-director/scripts/scan_script.py3.9 KB7bcbe68aed2eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/scripts/sound_balance.py13 KB0cde68aac0b0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/scripts/sound_handoff.py29 KB268d89dbcda9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/scripts/watch_cut.py19 KB83339e873bdeupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/animation-styles.md18 KB48f4dff36b03upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/build-and-qa.md26 KB4d8f76360ef1upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/checkpoints.md5.7 KB2f301f06f955upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/footage-looks.md3.6 KBf6fc3bc7bd09upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/frame-kit.md5.4 KB3a1887b66094upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/generated-clips.md10 KBe525c84e0644upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/media.md14 KB948734a5a180upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/motion-library.md5.9 KBba965893a00cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/motion-spec.md14 KBba61e3088271upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/options-rounds.md4.4 KB92b983aa4cbbupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/polish-rounds.md6.1 KBbc4928af5739upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/pre-show-checklist.md3.0 KB4d7de3161dfbupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/project-layout.md2.3 KB0f11fa7143fbupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/real-sfx-scripts.md12 KBe6ad1c6906b7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/reference-films.md5.8 KB9f3e489e8e56upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/sound-and-voice.md6.8 KB98a1e10cfaf8upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/sound-stage.md29 KBe2d4bff0f66cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/storyboard-format.md6.2 KB1886416692c5upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/text-and-captions.md7.8 KB60d12ab4bae9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/text-treatments.md6.1 KBaa4c617cf222upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/tools.md3.3 KB558ace8b9a8eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/types/brand-film.md8.4 KB8be104cc10d2upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/types/demo-tutorial.md6.0 KBf9f66e89e63eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/types/event-recap-data.md5.5 KB887e484ba871upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/types/explainer.md6.4 KB92cc9fb01d7dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/types/live-action-story.md13 KBe05fae8549c9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/types/product-launch.md8.5 KB20dd181317c7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/types/showcase.md2.2 KB9a19d553e241upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/types/social-short.md5.7 KBdd812518496dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/references/visual-ideas.md12 KB3f4e9114a38eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/codex-image-brief.md1.7 KB8573c5b960c5upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/frame-kit.js18 KBfac65aed2727upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/frames-starter.html4.8 KBa3618721b72dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/music-prompts-example.md3.5 KB10fb96605154upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/options-color-starter.json928 Bd6a45cd4256fupstream ↗
    {
      "kind": "options",
      "title": "Acme launch film",
      "version": "v0.1",
      "date": "2026-10-28",
      "decision": "Color treatment",
      "frames_dir": "options-color-v0.1",
      "summary": "One direction in two color treatments. Switch at the top.",
      "variants": {
        "label": "Color",
        "items": [
          {
            "key": "warm",
            "name": "Warm"
          },
          {
            "key": "cool",
            "name": "Cool"
          }
        ]
      },
      "options": [
        {
          "key": "A",
          "name": "Hero in a color field",
          "from": "Style name; plus the reference technique only if references were studied",
          "summary": "One person, things arriving around them.",
          "frames": [
            {
              "id": "01a",
              "label": "Start of 01"
            },
            {
              "id": "01b",
              "label": "End of 01"
            }
          ],
          "recommended": true
        }
      ],
      "questions": [
        "Which color treatment?"
      ]
    }
  • skills/video-director/assets/options-direction-starter.json1.8 KB2e612fb571f8upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/storyboard-starter.json3.8 KB5e7dac160acfupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/1-bit-dither.webp74 KBc363cfcc47ffupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/abstract-3d.webp6.4 KBc4a016a8b697upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/anime-cel.webp40 KBafd7f480c6ccupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/bento-grid.webp18 KBa9d3e9174b0fupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/BRIEF.md20 KB906c607e9285upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/character-3d.webp14 KB1f1367cbbb53upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/clay-stop-motion.webp26 KB5afc861efad7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/collage.webp76 KB455c3d70cbe7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/comic-book.webp149 KB58ff16c99ea1upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/cut-out-graphic.webp15 KBd76e0b2d8bcdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/cut-paper.webp30 KBbf569b6fb688upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/data-story.webp17 KBe9a5841ab94aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/datamosh.webp35 KB0552a545de5aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/distressed-type.webp63 KB543636f3d022upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/drawing-over-footage.webp18 KBe8d291909cdeupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/duotone.webp10.0 KB7e9ba3431798upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/flat-vector.webp10 KB35d957620b93upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/flow-field.webp78 KB4056b867191bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/frosted-glass.webp17 KB79fb14888821upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/hand-drawn-over-3d.webp18 KB7ea8ddfd1835upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/index.html32 KBe1a9c3821fdaupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/isometric.webp13 KBe0cd2c19cc90upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/kinetic-typography.webp36 KBf88fae5eb778upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/layered-parallax.webp12 KBaea7f0496dceupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/line-icons.webp15 KBa28ddf1a80ecupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/memphis.webp49 KBfec904f83789upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/mid-century-graphic.webp21 KB066cdd0cbf8aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/minimal-mono.webp7.0 KB181b0c9939f5upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/modernist-grid.webp11 KB0626bcca315eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/neon-grid.webp31 KB332a4897cec0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/neumorphism.webp9.3 KB509ad66201d2upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/object-stop-motion.webp30 KBe499ea46727dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/op-art.webp60 KBb9ccdf8e208aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/origami.webp12 KBb02afee38d4cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/painterly-3d.webp23 KBd40f4d0f1818upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/painterly-oil.webp97 KB85a7efcf7f3dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/pencil-sketch.webp41 KB108981c93eebupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/photo-cut-out.webp15 KBa1e51eee8d10upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/pixel-art.webp27 KB58f4bca21f05upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/pixilation.webp19 KBb14e921fdbd5upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/product-interface.webp9.4 KB31a9f8f447c9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/psychedelic.webp51 KBe814a0b158caupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/puppet-stop-motion.webp39 KBe068cbc5f35bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/retro-desktop.webp19 KB84cbbaf7e3baupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/rotoscope.webp22 KB428f5fa85b5aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/sand.webp38 KBd747a143d2fbupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/shape-morphing.webp7.2 KB5a1621c4c912upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/silhouette.webp23 KBf6e4f42e63f4upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/skeuomorphic.webp22 KB092e63f9153cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/soft-3d-icons.webp9.4 KBda711776c2f1upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/soft-gradient.webp12 KBa3ad9d208c25upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/soft-rounded-characters.webp9.9 KBca604d53d637upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/spirograph.webp39 KB7bc0119fb957upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/teletext.webp11 KBc1874a617ab4upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/topographic.webp25 KB124731661a2bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/watercolour.webp36 KB226a1f57d475upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/web-1-0.webp38 KBc8bb05bf90e8upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/whiteboard.webp21 KBaa58202b184eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/assets/style-library/word-art.webp26 KB12bd1f312d05upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/config.example.json196 Baa7d75370461upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/config.json196 Baa7d75370461upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/LICENSE1.1 KB8edf83fa60f3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/references/profiles/clean-sfx-refs.json4.8 KB9d39e700a4e6upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/adjust_test.py25 KBbcf0ba43e2bfupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/beats.py22 KB9f66c6f05128upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/bed.py18 KB78daef4e3d32upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/build_index.py12 KBa032ed03df94upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/common.py54 KB896d5cced048upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/contact_sheet.py6.7 KB18e9eac1c7eaupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/critique.py63 KBde8b70b68734upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/find_moments.py17 KB3e01c8932bfdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/from_cues.py116 KBba8874b24133upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/from_hyperframes.py16 KBbfb99cf79835upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/from_synth.py26 KBbd868b2883ecupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/hear.py23 KB5490df0ebb83upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/learn_style.py18 KB062a586ef6cdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/levels.py7.2 KB1f927ebff07dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/listen.py15 KBd4e341a14e06upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/listen_page.py57 KBd78fbeb2aec3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/look.py18 KB9c11fe328348upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/masking.py14 KB0e510006f13fupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/maskmodel.py16 KBf0e18d14dbecupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/mix.py84 KB1a32f37eba8aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/moment_test.py16 KBe7dd9c302f12upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/picker.py18 KBc19e87787cb0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/refstyle.py17 KBfdfde30e27dcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/review.py5.7 KB19e6f4585425upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/search.py9.5 KBd1b1091da78eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/setup.py7.6 KB748982fccbd4upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/sheet.py25 KBa9942f6b4c31upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/speech_map.py6.1 KBacfa968cabf3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/suggest_cues.py9.1 KB991e214ffe51upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/taste.py2.5 KB667ec9ddf3f8upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/taste_test.py46 KBe62db6585880upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/texture.py15 KB5e4d77dd72e0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/tonal.py7.2 KB68b6184a0a0eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/ui_events.py49 KB208b08a6d05bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/unbake.py29 KB9b8d13c6f229upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/verify.py16 KB224b4ea19330upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/scripts/zoom.py5.0 KB2c4824d64818upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/tests/resound.py37 KB9698df95067eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/tests/selftest.py162 KBc4ea9b8c87f3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • skills/video-director/real-sfx/UPSTREAM.md2.9 KB750832c8574dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • README.mdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

Plain-text copy, no login: /skill-bundles/sallyrs-video-director-skills-video-director.md

// REPO STATS

33 stars
0 open issues
Last commit: 19d ago