agentleFS
puntorigenpuntorigen/avatar-skills/avatar-frames/SKILL.md

avatar-frames

Skill3 starsChanged 4 months agoMITView on GitHub

Extract ready avatar reference frames from talking-head videos — single face, face-region sharpness, no burned-in subtitles. Optionally saves inpaint candidates (1 face, sharp, with subtitles) in with_subtitles/ when requested or when no ready frames exist. Uses MediaPipe and EasyOCR. Use when the user asks to extract avatar frames, clean frames from video, reference images for virtual avatar, or talking-head frame extraction.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When clean frames exist and --with-subtitles is not set, inpaint candidates are counted in manifest.json but not written to disk.

    line 48
  2. Very specific:

    When a video has burned-in captions, the extractor profiles their style from the subtitled frames and writes both a subtitle_style block in …

    line 111
  3. Very specific:

    Only merge ready frame_*.png files unless the user asks for inpaint candidates.

    line 162
  4. Very specific:

    Inpaint: run on with_subtitles/ after auto-fallback or --with-subtitles

    line 166
  5. Very specific:

    Asset generation: use root frame_*.png as --ref in asset-generator or gpt-image-2

    line 167

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Avatar Frames Extractor

Extract production-ready avatar frames from video reels, interviews, or talking-head clips.

Setup

bash ~/.cursor/skills/avatar-frames/scripts/setup.sh

Quick Reference

Default — ready frames only

python3 ~/.cursor/skills/avatar-frames/scripts/extract_clean_frames.py video.mp4 -o frames/

Output: frame_0001.png, frame_0002.png, … (1 face, sharp, no subtitles)

Explicitly include inpaint candidates

python3 ~/.cursor/skills/avatar-frames/scripts/extract_clean_frames.py video.mp4 \
  -o frames/ --with-subtitles

Debug rejections

python3 ~/.cursor/skills/avatar-frames/scripts/extract_clean_frames.py video.mp4 \
  -o frames/ --save-rejected

Output Rules

OutputCriteriaWhen saved
Root (frame_*.png)1 face, sharp face, no subtitlesAlways
with_subtitles/1 face, sharp face, has subtitlesOnly with --with-subtitles or when zero ready frames found (auto-fallback)
rejected/blur, no_face, multi_faceOnly with --save-rejected

When clean frames exist and --with-subtitles is not set, inpaint candidates are counted in manifest.json but not written to disk.

Options

OptionDefaultDescription
--output, -oframesOutput directory
--with-subtitlesoffAlso save inpaint candidates in with_subtitles/
--interval2.0Seconds per selection window
--face-sharpness-percentile10Adaptive face blur threshold
--face-min-confidence0.7MediaPipe face detection confidence
--face-min-area-ratio0.05Min face bbox area vs frame
--ocr-min-conf0.35EasyOCR subtitle confidence
--save-rejectedoffSave rejected frames for tuning
--no-subtitle-styleonSkip profiling the burned-in caption style
--subtitle-style-sample24Max subtitled frames to profile for caption style

Output Structure

Typical (ready frames found):

frames/
├── frame_0001.png
├── frame_0002.png
└── manifest.json

No ready frames (auto-fallback) or --with-subtitles:

frames/
├── frame_0001.png              # may be empty
├── with_subtitles/
│   ├── subtitle_0001.png
│   └── subtitle_0002.png
└── manifest.json

Pipeline

Per interval window (best frame every 2s):

  1. Single face — short + full-range BlazeFace; reject 0 or 2+ faces
  2. Face sharpness — Laplacian on face bbox (not full frame)
  3. Subtitle check — EasyOCR on top (40%), overlay (30–85%), bottom (60–100%) zones
  4. Route — ready → root; subtitled → inpaint pool; else → rejected
  5. Dedup — perceptual hash per output group
  6. Write — root always; with_subtitles/ only per output rules above

Manifest

manifest.json keys:

  • frames — saved ready frames
  • with_subtitles — saved inpaint frames (empty if skipped)
  • inpaint_saved, inpaint_reason (user_requested | no_clean_frames | null)
  • frames_with_subtitles_skipped — candidates found but not saved
  • rejected — metadata only (images only with --save-rejected)
  • subtitle_style — burned-in caption style profiled from subtitled frames (null if none)

Subtitle style profile

When a video has burned-in captions, the extractor profiles their style from the subtitled frames and writes both a subtitle_style block in manifest.json and a standalone subtitle_style.json:

{ "y_frac": 0.62, "text_height_frac": 0.059, "fontsize_frac": 0.082,
  "lines": 2, "words_per_caption": 3, "casing": "lower",
  "color_rgb": [240,228,224], "color_hex": "#f0e4e0",
  "progression": "replace", "mean_word_overlap": 0.10,
  "emphasis": { "auto_detected": false, "convention": "…" },
  "samples": 21, "note": "…" }
  • Measured reliably: vertical position (y_frac), text size (text_height_frac / suggested fontsize_frac), lines, words_per_caption, text color.
  • Progression (approximate): progression is replace vs accumulate, derived from the word overlap between consecutive caption samples (mean_word_overlap). It tells downstream tools whether captions swap out per phrase (replace) or build up within a phrase (accumulate). Sparse sampling makes it a hint, not a measurement.
  • Emphasis (convention, not detected): OCR can't read weight/italic, so emphasis.convention documents what the originals highlight and why — on these reels the breath-ending payoff words are set in bold-italic of the same serif. Downstream reproduces this by emphasizing each breath group's completion.
  • Low confidence: casing — EasyOCR lowercases its output, so only upper (all-caps) is trustworthy; treat a reported lower as natural.
  • Not detected: font family (serif vs sans), weight, italic emphasis.

Downstream (e.g. avatar-reel-composer/finish_reel.py --style-from) consumes this to place/size new captions and to mirror the originals' replace-per-phrase progression + payoff emphasis. Disable with --no-subtitle-style.

Tuning

SymptomFix
Too many blur rejectionsLower --face-sharpness-percentile (try 5)
Subtitles missed on ready framesLower --ocr-min-conf 0.4
No ready frames, need inpaintAuto-fallback creates with_subtitles/; or use --with-subtitles
Reels with captions everywhereExpect few ready frames; rely on inpaint fallback

Batch

for f in videos/*.mp4; do
  name=$(basename "$f" .mp4)
  python3 ~/.cursor/skills/avatar-frames/scripts/extract_clean_frames.py "$f" -o "frames/$name"
done

Only merge ready frame_*.png files unless the user asks for inpaint candidates.

Integration

  • Inpaint: run on with_subtitles/ after auto-fallback or --with-subtitles
  • Asset generation: use root frame_*.png as --ref in asset-generator or gpt-image-2

Notes

  • Face sharpness uses the face bbox, not the full frame.
  • Social-media captions sit in the center overlay zone (35–85% height).
  • EasyOCR is the bottleneck (~1–2s per candidate frame).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.