amv

Community@kingdomrushdev/amv
Community skill — not reviewed. It was shared by 火木由子 and has not been checked by Neta. Read SKILL.md below before letting an agent use it.
Installation
npx -y @neta-art/neta-search-cli@latest skills add @kingdomrushdev/amv
Use in Neta Studio Open it in Neta Studio and see what people made with it.
Summary

Turn a song into a hand-drawn anime music video with a planned storyboard and lyrics that pop up word by word.

  • Makes a finished 1080p anime music video from your song, with the original audio, a poster frame and an MP3 of the song.
  • Flat, hand-inked 2D anime look. The song plays off-screen and characters don't lip-sync unless you ask for a performance shot.
  • Each sung word appears as a sticker-style graphic on its own beat. A visual theme such as ink brush, pixel arcade or neon night is picked to suit the song.
  • Cuts land on the beat, and each shot follows a storyboard with a clear story thread from opening to ending.
  • Works best with a real song plus lyrics, a short test clip first, and a spending limit you set. Holiday and seasonal songs are supported.
SKILL.md
# AMV: the music drives the story and the cut, not the character's mouth

## Defaults

- Flat, hand-inked 2D anime: clean line art and flat colour blocks. **The song is always off-screen.** Sung lyrics do not mean a character is singing. Only when the user explicitly asks for a performance and `allow_performance` is set in the brief do we plan a performance shot. This skill never lip-syncs automatically.
- Build one line from character action, reaction, eye-line / what is seen, props, empty shots, and recurring motifs. Not every beat needs a new picture, and not every shot needs an accent. A drawing is a pose change or a local event. Do not fill time with a still image pushed and panned, full-body breathing, or hair particles drifting.
- Pictures and compositions may change abruptly, but cause and eye-line must stay readable. Prefer hard cuts, cuts hidden by an occluder, shape-matched cuts, and explicit graphic state changes. Do not default to white flashes, dissolves, motion trails, or full-frame effects. Graphic title cards and lyrics are a separate post layer, never text generated by the video model.
- Study reference: [frame-by-frame study of five official reference films](references/mv-frame-study.md). Use the method only. Do not reuse reference footage or old test material as new footage.
- Reply to the user in the user's language. Keep the instructions in this file in English.

## Song, per-line lyric art, and no stutter: the release gates

- **Lock the real song before any picture is generated; no placeholder music.** The default is `song.mode: vocal`: the sung voice and the off-screen lyrics must be real and audible. Chapter titles or wordless humming do not count. Set `instrumental_requested: true` only if the user explicitly asks for an instrumental. Review what you actually hear (melody, chorus, theme) in `music-review.json`. A seasonal song needs a recognizable holiday melody, holiday imagery in the lyrics, layered arrangement, and a real ending. Sleigh bells alone do not qualify. `song_lock.py` checks the current master hash, the sign-off, and lyric coverage. Without listening evidence, report the result as unverified.
- **Lyrics are MV typography, not subtitles, and they must be in sync.** One sticker-like object per sung word, placed in the free space of each shot, appearing on **its own sung frame**, re-laid out when the picture cuts, leaving with its phrase. Word times come from `align_lyrics.py` (forced alignment of the known lyrics on the demucs vocal stem), not from Whisper word stamps or a beat grid. The look comes from a **theme**. Leave `"theme": "auto"` (the default) and `choose_theme.py` picks it: it scores every theme against the lyrics and brief (keywords), the music (tempo, energy) and the clean picture (brightness, saturation, warmth, night, pixel grid), then renders the finalists on the film and keeps the one whose words are actually readable there (`qa/theme-choice.json` + `qa/theme-choice.jpg`). A user's or director's named theme always wins; on a close call, show the runner-up. Themes: `sticker-pop`, `ink-brush`, `pixel-arcade`, `mincho-noir`, `neon-night`, `storybook`, or your own with a `fit` block; recolour with `palette`. In auto mode you write one `avoid` list per shot (faces and the action) and `lyric_motion.py` lays out, sizes and animates everything. Accept only when both the renderer QA (`qa/lyric-motion.json`) and the independent measurement on the encoded film (`lyric_sync_check.py` → `qa/lyric-sync.json`) pass. Do not use small text on a translucent bar, a whole sentence at once, or one theme for every song. Details: [lyric-typography.md](references/lyric-typography.md). The older ASS path (`lyric_art.py`) is a fallback only.
- **Cuts land on the music.** Cut frames come from `fit_cuts.py` (beats, or half-beats when the takes require it, preferring sung-line starts) and are verified by `av_sync_check.py` against the beat grid. A cut that matches its planned frame is still out of sync if the plan was off the beat; never copy cut frames from another song's plan.
- **24 fps does not mean "no stutter".** The default is `exposure: native`. Only mark specific shots `limited2` or `limited3`. Do not decimate the whole film, do not repeat the last frame, and do not use optical flow to smear motion. Run `cadence_check.py` on both the clean picture and the final lettered video to compare the PTS and per-shot near-still candidates. Every intentional hold must be recorded with frame numbers, a reason, and a visual check. Measure visual rhythm and playback performance separately.
- **Background reading:** [song, lyrics and exposure lessons](references/lyric-music-cadence.md). Templates: `templates/music-review.template.json`, `templates/lyric-motion.template.json`, `templates/lyric-direction.template.json`.

## The director's storyboard is a required input

1. Analyze the master: section boundaries, strong beats, syncopation, breaths. Model-detected beats are candidates only. Pick one visual thread that carries the film from the intro to the ending (narrative action, an object motif, or a graphic state). Decide what the audience sees at the end first, then decide how the opening plants it.
2. Write `storyboard` using `templates/brief.template.json`. Each shot needs `role`, `subject`, `purpose`, `cut_reason`, `state_in` / `state_out`, framing and subject position, and a clear A/B pose. `cast: []` allows object-only or environment shots. For ordinary cuts, the visible state must connect across the cut. A deliberately abrupt cut needs a stated motive (shape, contrast, direction, or lyric). Do not loop motion automatically.
3. `at` sets the entry trigger. Use `beat` or `downbeat` (counted from 0), or `seconds` / `frame` for off-grid moments. `accent` may be omitted. A shot without an accent is only checked for readable change and does not count toward accent-hit rate. If you use automatic accents, set `event: onset` and `audio_cue` explicitly. Contact frames and reaction peaks must be confirmed by hand in Shotcut against the real picture and the matching sound. Do not present frame-difference peaks as semantic events. `--draft-grid` is only for estimating edit density and must never be submitted for generation.
4. Validate a short sample first. It must include at least two shot functions and one justified cut. Before the full batch, check the current `cohub models show moss_image` and `cohub models show minimax-h3` for actual parameters, prices, and remaining quota. Build the vertical sample from new, original material only. Do not run the full film until the sample proves the story, character design, and audio-picture fit.

## Requirements and optional inputs

- **Required:** the Cohub CLI (`cohub`) in a Cohub space, with `moss_image` and `minimax-h3` available. Python 3 with `numpy` and `Pillow`; `ffmpeg` and `ffprobe`.
- **Rendering:** run `bash "$S/ensure_tools.sh"` once. It installs Shotcut's portable `melt` renderer, the runtime libraries, the OFL fonts and fontTools into `~/.cache/mv-tools` (or `$MV_TOOLS`). Every download is checked against a SHA-256 value. Set `MV_FONTS` and `MV_TOOLS` to point at the results.
- **Vocal separation and lyric alignment (required for sung lyrics):** `bash "$S/ensure_align.sh"` creates a separate CPU environment with demucs and torchaudio and downloads the MMS_FA alignment model (~1.2 GB; Meta's weights are CC-BY-NC 4.0, so check the licence before commercial use). `eval "$(bash "$S/ensure_align.sh" --env)"` exports `AMV_PY`. Without it, word timing falls back to `vocal_onsets.py`, which is measurably less accurate; say so to the user. Sandboxes may reset their home directory: re-run both ensure scripts at the start of a session.
- **Optional validators:** `make_keys.py --moss-skill PATH` (or `MOSS_REGION_PROMPT`) checks key prompts with a `moss-region-prompt` validator. `lyrics_timing.py --abc-lint PATH` (or `AMV_ABC_LINT`) reads ABC scores with the `abc` skill's linter. Without them, the features still run, and the output marks the check as unchecked.

## Inputs, and when to ask the user

| Input | Required | Counts as given when |
|---|---|---|
| Song master (audio) or a request to create the song | yes | The user supplies a master, or asks for a new song with a theme. A new song is generated only after the request and the lyric theme are confirmed |
| Lyrics and their language | yes for sung AMVs | The user supplies the words, or asks you to write them. Instrumental work needs `instrumental_requested: true` |
| Duration and aspect ratio | yes | Stated, or implied by the request (for example "a 20-second MV" or "16:9") |
| Character and style | no | If absent, design an original character and a flat hand-drawn style, then state the choice in the brief |
| Budget cap | yes before any paid call | The user gives a USD limit. Without one, run only the free stages and ask before paying |

If a required input is missing, ask once before building. If all required inputs are given, build to delivery without asking again. Paid retakes need an explicit budget. Never use a placeholder song.

## Deliver

The deliverable is a finished, watchable film, not a plan or a set of drafts:

- the final MP4 (1920×1080, 24 fps, CFR) with the master audio, plus a poster frame and the song as MP3;
- the QA reports for the final film: `qa/sync-final.json`, `qa/cadence-final.json`, `qa/lyric-motion.json`, `qa/lyric-sync.json` with `qa/lyric-timing.png`, and the music lock;
- the cost breakdown from the provider receipts (`keys/keys.json` and `takes/takes.json` `_history`, plus the song and ASR receipts), with the real total;
- a link, when the user wants one. Publish with `cohub apps publish` (`--visibility space` unless the user asks otherwise), then open the public URL and check that the published files match the local files byte for byte.

Report the result in the user's language: the link first, then the cost and what was not verified (for example, a song that was checked by ASR but not listened to).

## Out of scope

- Do not change world settings, Space membership, visibility policies or secrets. Do not change the user's other apps or Spaces.
- Do not delete existing files, previous takes, or approved shots. Write each run to its own folder.
- Do not build anything beyond the film and its reports: no extra apps, dashboards, or public file uploads unless the user asks.
- Do not upload private source images. Do not generate paid content without a budget.

## Local and generation pipeline

`$S` below means this skill's `scripts/` directory. Run the stages from the project root. Fix any failure in the stage that produced it. Scripts never trigger paid retakes by default.

| Stage | Scripts and responsibilities |
|---|---|
| Audio and plan | `audio_analyze.py` writes the beat markers. `plan_amv.py analysis.json brief.json --budget …` checks the storyboard, quantizes to frames, and estimates the first-pass cost. |
| Key art | `make_keys.py` builds one key sheet per shot. An optional validator from `moss-region-prompt` can be passed with `--moss-skill <path>`; without it the prompts are reported as unchecked. MOSS draws camera-locked A/B: the difference between A and B is a state change of the **specified** subject. Review the contact sheet for identity, text, cropping, and framing. `gen_keys.py` detects and crops the frames at the real sheet size. |
| Animation | `animate.py`: one H3 request per shot. First/last-frame mode, no audio reference. Keep the character design, scene, and flat style. Animate one observable action only. Non-performance shots state explicitly that there is no singing and no lip-sync. Do not set A and B to different camera angles. The model's audio track is not used. |
| Exposure and cut lock | `timing.py --shots shots.json` keeps the original drawing exposure by default and applies two- or three-frame exposure only to the shots you name. `fit_cuts.py` then chooses beat-aligned cut frames that every take can fill and writes them back into the brief (re-run `plan_amv.py`). `cut_shots.py` checks that the action is complete and that holds are not too long. It measures accent error only where an accent anchor is given. If an action is too short, change the start/end poses, choose another take, or re-storyboard. Do not pad with a long freeze. |
| Independent review | `review.py` reads the director's notes and each shot's actual character cards, and attaches keyframe strips for each shot. Also watch the first and last frame of each clip and the cut boundaries in real playback. A single still frame cannot reveal sliding hands, picture drift, unintended mouth movement, or wrong spatial continuity. Unverified means not passed. |
| Edit and typography | `edit_amv.py` writes the Shotcut/MLT project, hard cuts, and the master as a separate audio track. The lyric chain is `lyrics_timing.py` → demucs → `align_lyrics.py` → `lyric_motion.py` (theme + auto layout, composited onto the clean picture, audio copied) → `lyric_sync_check.py`. Use `--grid` to read avoid boxes; the theme is chosen automatically (`choose_theme.py`) unless one is named, and `--preview … --theme …` compares themes by eye. Fallbacks: `vocal_onsets.py` for timing, `lyric_art.py` plus `burn_subs.py` (ASS) for rendering. Do not render text with the video model. Omit lyric typography only for an explicit instrumental. |
| Evidence | `amv_check.py` checks picture frames, dead holds, and declared accent hits. `av_sync_check.py` measures audio offset and every cut against the beat grid. `lyric_sync_check.py` measures when each word actually appears on the encoded film and tests the word timing against the vocal stem. `preflight.py` decides READY (it requires a passing `qa/lyric-sync.json` for the current final film). Numbers are diagnostics. They do not replace watching the film. |

Prop continuity: read [method.md section 5](references/method.md) first. Handoffs are where props disappear most often. Write them as put-down/pick-up actions where possible. If two retakes still lose the prop, change the shot's meaning and update `brief` to match.

You can chain the stages with `bash "$S/run_amv.sh" PROJECT SONG --budget LIMIT`. Use verified `lyrics_timed.json`, or import with `--notes`, `--lrc`, etc., then check manually. Only project-generated, non-private key art may go to H3 through a temporary unlisted URL. Set `media.generated_keys_may_use_unlisted_urls: true` only after you have confirmed this. Never upload a user's private source images. Do not re-submit silently when the inline mode is incompatible. The `--budget` cap covers the first pass. Before any retake, check the remaining budget separately so you never resubmit a paid job by accident. On a quota error, an unknown receipt, or a timeout, check the task status first. Do not treat a failed wait as a cancellation. Do not run parallel paid resubmissions by default. Do not overwrite approved shots or mix artifacts from a previous project.

## Splitting reference footage into frames

`python3 "$S/ref_frames.py" INPUT.mp4 NEW_DIR` writes every decoded presentation frame and `frames.csv` (original PTS, fps unchanged). Use `--width 0` to keep the original size. First look at a contact sheet of the whole film to find motifs and sections. Then check frames before, during, and after each action, and the frames on both sides of each cut. Record the source version, frame numbers, PTS, what initiated the change, and the editing function. Report the cadence of the upstream container. Do not count duplicate frames as new drawings.

When you package this skill, include only documents, scripts, and templates. Do not include downloaded MVs, extracted frames, old test runs, or caches.