Communitygithub.com

Video Reference Breakdown

Quantify and dissect reference videos using scripts: edit density, beat sync rate, BPM, dominant colors, frame density, motion feel, per-shot framing, angle, camera movement, lighting, and output timed mosaic sheets, strip frames, and key-shot measurements. Summarize results into style recipe cards or shot reference cards.

What is Video Reference Breakdown?

The Video Reference Breakdown skill is an expert-level tool for developers, AI agent users, and video editors who need to objectively analyze and replicate the style, rhythm, and technical choices of any reference video. It goes beyond subjective impressions by using a suite of Node.js and Python scripts to extract quantifiable metrics such as cut density, BPM, dominant color palettes, frame-change density, and optical flow-based motion characteristics (e.g., action speed, lingering, camera movement). The skill supports platforms like Claude Code, Cursor, and Codex, and integrates seamlessly with the video-style-recipes skill to generate new style or shot reference cards. It produces visual summaries like timed mosaic sheets (sheet1.png, sheet2.png), strip frames for key transitions, and detailed JSON reports, enabling precise comparisons between a generated clip and its reference. Use it when a user asks 'What style is this?', 'How was this shot?', or to self-check your own output for beat sync, rhythm, and motion feel.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/chipfighter/video-skills/tree/HEAD/skills/video-reference-breakdown

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Reference Video Breakdown

I analyze videos by combining "quantification + frame-by-frame inspection": first, I quantify everything possible using scripts, then I inspect frames with those numbers in mind, and finally break down the video across visual effects, typography, composition, transitions, rhythm, and audio. The conclusion always addresses "Can we do this, and what are we missing?" Describing a video purely from memory is often inaccurate—for example, you might think a video has "tight beat sync," but measurement reveals it's simply cutting on lyric sentences.

Preparation

  • Requires ffmpeg, ffprobe, and Node 18+.
  • Copy the reference video to a short path with a short filename (e.g., work/a.mp4). Chinese characters, full-width symbols, and excessively long paths can cause ffmpeg or filter parameter errors. Keep the original filename and source recorded separately for use in the final conclusion.
  • For comparison videos composed of multiple segments (e.g., first half Model A, second half Model B), split them first: ffmpeg -ss 1 -i a.mp4 -t 14.9 -c:v libx264 -crf 16 -c:a aac a_part1.mp4. Analyzing the whole clip at once can mix dominant colors and misestimate BPM (e.g., on 2026-11-23, the whole clip read 71.75 BPM, while the single segment read 129.25 BPM).
  • All scripts are in this skill's scripts/ directory. Invoke them via node <skill directory>/scripts/<script>.mjs. Output files are saved next to the video. Mosaic sheets require a font; the script automatically copies the system's Arial to the working directory.

1. Quantification

node scripts/analyze.mjs work/a.mp4 work/b.mp4

Each video outputs the following metrics (also saved as <name>_analysis.json):

MetricHow to interpret
contentCropAutomatically detected black-bar crop; when black bars are present, cut points and dominant colors are calculated within the content area.
cuts, avgShotSecNumber of hard cuts, average shot duration. Only counts single-frame abrupt changes; fades and mask transitions are excluded.
cutsPer10sCuts per 10-second window—shows where editing is concentrated (concentrated at start = mashup opening; near zero throughout = animation-driven).
movingFracProportion of frames with pixel change; below 0.05 is essentially static.
bpm, beatPhaseSecAutocorrelation-estimated tempo, may be half or double the true value; use music.mjs and kickcheck.mjs for an accurate grid.
cutsOnHalfBeat and cutsOnHalfBeatChanceProportion of cuts landing on a half-beat grid, compared to a random baseline. Only clearly above baseline counts as "beat sync"; lyric-driven cuts on sentence boundaries naturally have low sync rates.
cutsNearOnset and cutsNearOnsetChanceProportion of cuts landing near any onset (drums, words, sound effects), compared to baseline.
paletteTop 10 dominant colors with percentage, average brightness, average saturation—identifies base and accent colors. Accent colors often occupy small areas and may not rank in the top 10; confirm by inspecting frames.
loudnessDbPer2sLoudness every 2 seconds—reveals musical pauses and drops.

Two overview mosaic sheets are also generated: <name>_sheet1.png and <name>_sheet2.png (each covering half the duration, every frame with a timecode). Use --interval 1 to change the sampling interval, or --no-crop to disable black-bar detection.

Frame Density

Cut points and sync rates cannot measure "how full or intense" the image feels. For portfolios, intros, and openings—and for self-checking your own output—measure frame density:

node scripts/density.mjs work/a.mp4 --from 1 --to 16

Output saved as <name>_density.json:

MetricHow to interpret
accentMean, accentMaxProportion of the frame occupied by high-saturation colors. Restrained pieces show only a few tenths of a percent; portfolio contrast shots average 18% with peaks at full screen.
coverMedian, coverMeanProportion of pixels significantly different from the base color—i.e., how much of the frame is covered by graphics.
changeMean, framesOver10, framesOver40Proportion of pixels with significant brightness change between adjacent frames. Frames exceeding 40% are typically full-screen impacts or hard cuts.
firstHitSec, firstFloodSecTime (seconds) until 40% of pixels change simultaneously, and until an accent color covers more than half the screen—shows how quickly the first impact is delivered.
perSecPer-second accent area and change proportion—shows energy distribution.

Reference values (measured 2026-11-23, 1920×1080):

ClipAverage accent colorAverage per-frame changeFrames over 40%First full-screen fill
Portfolio contrast shot, Opus segment (video-style-recipes mg-showreel card)18.2%16.9%10.5%2.7 s
Our "Points, Lines, Surfaces, Forms" 15s test (criticized as "less impressive than the contrast shot")0.2%1.3%0none

2. Review Overview, Locate Key Segments

While viewing the mosaic sheets, note: base and accent colors, fonts, layout, and any special techniques at specific timestamps. Then generate strip frames for key segments:

node scripts/strips.mjs work/a.mp4 12.0 14.0 3 a_transition.png
node scripts/strips.mjs work/b.mp4 4.6 6.2 4 b_strip.png --crop 968:1294:56:314 --cols 8

Transitions are typically 4–12 frames; use a step of 2–3 frames. Slow animations use 10–15 frames. End credits often specify the production method (e.g., "code-generated Canvas 2D + WebGL")—worth cropping and enlarging for inspection.

Key Shot Measurement

When implementing a specific transition, dynamic typography, or motion feel from the reference into a project, read Key Shot Measurement. Select segments that best illustrate what to learn, record reference evidence and the project's adopted values. When the user requests a sample, verify the actual render against the same set of motion nodes.

Per-Shot Breakdown (Live Footage, AI Video)

When the reference is filmed or generated footage and the goal is to learn shot design (framing, angle, camera movement, composition, lighting), read Shot Breakdown: node scripts/shots.mjs work/a.mp4 splits the video by shot, takes three frames per shot, measures tonality and warmth, and outputs a shot base table. Then inspect frames and fill in framing, angle, camera movement, and lighting using a fixed vocabulary, separating observed from inferred. Use this table as a starting point for creating shot reference cards and comparing generated segments to the reference.

3. Music and Beat Sync

node scripts/music.mjs song.mp3
node scripts/kickcheck.mjs song_cut.wav 128 --offset 0
  • music.mjs: BPM, beat phase, full-frequency and low-frequency energy per bar, flags bars with low-frequency jumps over 6 dB (drop, chorus candidates). When selecting a clip range, cut from the start of a bar so the grid begins at 0 seconds.
  • kickcheck.mjs: Folds energy by beat, showing where kick (sub, low), clap (mid), and hi-hat (click) fall in the beat phase. If sub or low peaks at +0–40 ms, the kick lands on the grid; if noticeably behind, shift the grid start by that amount. Also use this for self-checking your own output.

4. Locate Shapes in the Frame

Before performing shape-matching cuts (pupil to firework, eye to gear), measure the position and size of shapes in both shots:

node scripts/spot.mjs eye.mp4 --mode dark --thr 28 --region 300,150,1000,600 --every 0.5
node scripts/spot.mjs fire.mp4 --mode bright --thr 90 --from 4 --to 7 --every 0.5

dark finds the center of the darkest area (pupil, black hole); bright finds the centroid of bright areas (fireworks, lights). Outputs pixel coordinates and equivalent radius. To match shapes, translate the center of the second shot by the difference in centers and scale it by the radius ratio before cutting.

5. Selecting Footage (Optional)

node scripts/footage-sheet.mjs sheets/ clip1.mp4 clip2.mp4 clip3.mp4

Uniformly samples 5 frames from each clip, arranges them in rows (8 rows per image), for quickly browsing content and selecting usable segments.

6. Motion Feel (Optical Flow Self-Check)

The previous metrics measure cuts, color, and frame density, but not "how fast, how clean, or whether it's just wobbling in place." scripts/motion-qa/ computes optical flow frame by frame, subtracts camera motion, and categorizes movement into camera, clear action, and static wobble. Use this when the user says the action is "too soft," "too sluggish," "too rushed," or they want to understand why a reference's action feels crisp. Do not run it proactively unless the user mentions motion feel.

It is a ruler, not a judge. Speed is neither right nor wrong—it must be compared to the reference or the user's intended feel. Default usage: measure reference and output once each:

py -3.12 -X utf8 scripts/motion-qa/motion.py work/ref.mp4 --out work/ref_motion
py -3.12 -X utf8 scripts/motion-qa/motion.py work/mine.mp4 --out work/mine_motion

Compare the summary fields in both motion.json files: 动作用时_中位秒 (action duration median seconds), 动作最快速度_中位px每秒 (fastest action speed median px/s), 动作速度_快的那10% (fastest 10% speed), 没有明显动作_占比% (no significant action %), 最长没动作秒 (longest idle seconds), 快起慢停_占比% (fast start slow stop %), 慢起慢停_占比% (slow start slow stop %), 原地晃动_面积% (wobble area %), 镜头在动_占比% (camera moving %), 画面重播_占比% (frame repeat %). Tell the user which items differ and by how much, then ask if they want to adjust toward the reference.

If there is no reference and the user only wants it "fast" or "stable," pick a preset and run the full check:

py -3.12 -X utf8 scripts/motion-qa/qa.py work/a.mp4 --out work/a_qa --style promo
  • --style: calm (narrative exposition), promo (fast cuts), mv (music video/fight). See video-style-recipes for "action speed and pause" values. For mixed rhythms, use segments: --sections "0-12:promo,12-:mv". These three presets reflect the original author's preferences; warnings only indicate deviation from that preset, not that the clip is flawed.
  • Output: pass/warning per item, 联系表.jpg (contact sheet), 手机尺寸.jpg (phone-size), a strip frame at the start and the busiest 2.4 seconds (each at 0.2s intervals), plus motion.json and qa_report.json.
  • Requires Python 3 and numpy. The specific Python path on this machine is in video-style-recipes' references/local-env.md; currently py -3.12. Do not omit -X utf8, or Chinese output will be garbled.
  • Performance: a 34-second, 60 fps clip takes ~2 min 20 sec; a 4.5-second segment takes ~10s. To skip motion analysis and only check specifications, composition, and loudness, add --skip-motion.
  • Scripts originate from chuspeeism/code-video-director (MIT, fetched 2026-11-24, unmodified); license in the same directory.
ItemWhat it measures
How fast is the action / are fast actions sufficientMedian fastest speed of clear actions, and the value for the fastest 10% (normalized to 1920 width, pixels per second). If the latter is high, it usually means auxiliary layers are jittering.
Fast-start-slow-stop, slow-start-slow-stop, acceleration at startHow each action starts and stops. Too much slow-start-slow-stop feels soft; hitting full speed in one frame feels rigid.
Action duration, varied durationsMedian action duration and its variation; uniform duration across the whole clip feels robotic.
Wobble (local jitter)Area of small movements (30–150 px per second)
Camera movementProportion of time spent on pans, zooms, tilts
Frame repeatAfter subtracting camera motion, whether the frame returns to a previous state at regular intervals—usually due to frame % period-based looping
Idle gapsProportion of time with no significant action, compared to the rhythm preset's pause range

Common false positives: Dynamic typography on a solid-color background may trigger "frame empty"—add --allow-solid-bg. Recordings of fixed UI or instruction manuals may trigger composition changes—add --fixed-layout. Intentional black openings or end freezes trigger black-frame/freeze-frame warnings; check the timestamp to judge.

Our own sample (measured 2026-11-24, 34s, 60 fps, user-approved fast digital kinetic typography): fastest action 1209 px/s, fastest 10% 937 px/s, median action duration 0.18 s, idle 24%, camera motion 64%, wobble 2.9%, frame repeat 0%. Running promo preset flagged 5 warnings: black frames, freeze frames, and frame emptiness were intentional; the other two were the fastest 10% being faster than the preset, and a 56% sync rate (random baseline ~37%). When the user says "make it as fast as ten," use these numbers as targets.

7. Write Conclusion

Answer the user in this order:

  1. One-sentence style description, e.g., "Dark background with single orange accent, voiceover kinetic typography packaging."
  2. Breakdown by dimension: Visual effects, typography design, composition, transitions, editing rhythm, audio. Each point supported by timestamps or measured values.
  3. Why it looks good / is easy to understand: How content and visuals correspond, how the design system stays consistent. Every well-crafted piece we've analyzed boils down to "one sentence = one visual metaphor."
  4. Can we do it?: Split into "we can already," "what tools we need to add," "what assets are required." Be upfront about what we cannot do.
  5. Learn the technique only: Do not copy others' specific creative concepts, dialogue, branding, or copyrighted assets.

When it's time to formalize a recipe, write a recipe card following video-style-recipes' references/recipes/_template.md and add it to that skill's recipe index.

Known Limitations

  • Cut detection catches only hard cuts; mask, fade, and grow transitions require strip frames for inspection.
  • BPM may be off by a factor of two. Lyric-based and shape-matching cuts are not necessarily aligned to drum hits; a low sync rate does not imply poor editing.
  • Vertical videos often have black bars. analyze.mjs automatically crops them before measurement; strips.mjs requires manual --crop (values from analyze's contentCrop).
  • Optical flow measures pixel movement, not "should this action be fast." motion-qa warnings are hints to inspect strip frames, not verdicts.
  • I cannot hear audio: Music, speech, and sound effect judgments rely on waveform and spectral data. Always confirm the final feel with the user.

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

Related Skills