bertbertov/claude-stack/autocrop-vertical
Claude Code and agent skill by bertbertov/claude-stack
- community
Checking that the SKILL.md file is still in the repository.
Subject-aware reframing of horizontal video to vertical (9:16 / 4:5 / 1:1) using YOLOv8 person detection. Per-scene decision between TRACK (crop tightly on subject) and LETTERBOX (scale + black bars) so people stay centered through cuts and motion. Trigger when user says "reframe to vertical", "16:9 to 9:16", "convert landscape to portrait", "shorts crop", "smart crop for TikTok", "vertical YouTube short from horizontal", "auto-crop interview clip", "reframe podcast video", "make this video vertical", or any equivalent intent. Use as a STAGE inside viral-clipper / book-video / channel-breakdown pipelines whenever the source has more than one person on screen or the subject moves around the frame.
Install
npx vskill@latest install bertbertov/claude-stack/autocrop-verticalSKILL.md
The same SKILL.md was published earlier as bertbertov/claude-stack/autocrop-vertical.
AutoCrop-Vertical — Subject-Aware 16:9 -> 9:16 Reframer
YOLOv8 detects people in each scene's middle frame, then per-scene picks one of two strategies:
- TRACK — crop a vertical window centered on the subject(s).
- LETTERBOX — scale the full frame down and pad with black bars (used when subjects are too spread out to crop without losing one).
Frame-accurate (no scene-boundary drift), VFR-aware, audio-sync compensated.
When to use
- Multi-person interview / podcast / two-camera setup → tracking beats center-crop.
- Action scenes, walking-and-talking, B-roll where the subject moves across the frame.
- Cooking / sports / panel discussions where center-crop would chop people in half.
- Inside the viral-clipper pipeline: insert this STAGE between clip-cutting and final render. Replace the simple ffmpeg
crop=ih*9/16:ihstep with a call to this script for any clip that has >1 face detected, or whenever the source isn't a static talking head. - Inside book-video / channel-breakdown: same — use whenever you cut a horizontal source into vertical Shorts.
When NOT to use
- Single static talking head dead-center → plain ffmpeg center-crop is faster and identical-looking.
- Already-vertical source → no-op.
- Animation / screen-recording with no people → YOLO has nothing to lock onto; falls back to letterbox anyway, plain center-crop is simpler.
- Sub-3-second clips → scene detection overhead (~50% of runtime) isn't worth it for tiny clips.
Install location
- Repo:
C:\Users\A\Desktop\Autocrop-vertical\ - Venv Python:
C:\Users\A\Desktop\Autocrop-vertical\.venv\Scripts\python.exe(Python 3.12, CPU torch — torch 2.x has no Python 3.14 wheels yet) - Entry script:
C:\Users\A\Desktop\Autocrop-vertical\main.py - Model:
yolov8n.pt(~6 MB, auto-downloads on first run to repo root) - Requires:
ffmpegandffprobeon PATH (already installed via Gyan.FFmpeg winget package).
Canonical CLI invocation
Output: 9:16 mp4 with subject tracked through scenes. Output height = source height (no upscaling).
Common variants
Quality presets (libx264)
--quality | CRF | x264 preset | Use for | |
|---|---|---|---|---|
fast | 28 | veryfast | Drafts, previews | |
balanced | 23 | fast | Default — good for Shorts uploads | |
high | 18 | slow | Master copies, archival |
Pipeline integration — viral-clipper
In viral-clipper, after clip extraction and before the final ffmpeg render, branch:
- Run
ffprobeon the cut clip to get resolution. - If clip is already vertical (h > w) → skip, just normalize.
- Else run a quick YOLO face-count: if
face_count <= 1AND faces stay near horizontal-center (±15% of width) for >80% of the clip → use simple ffmpeg center-crop (faster). - Otherwise → call AutoCrop-Vertical with
--quality balanced --encoder hw.
Result: Shorts where two-person interviews keep both heads in frame instead of chopping one off.
Performance expectations (CPU torch, no NVIDIA acceleration)
YOLOv8n on CPU runs scene-middle inference in ~150-300 ms per scene. The dominant cost is PySceneDetect (~50% of total runtime) + libx264 encoding. Rough ranges on a typical laptop:
| Source | Approx runtime | |
|---|---|---|
| 720p, 60s | ~30-60 s | |
| 1080p, 60s | ~60-120 s | |
| 1080p, 12 min | 5-12 min |
If batch-processing many clips, --encoder hw (NVENC on the RTX 5080 laptop) can roughly halve total time at the encode stage.
Verification (run once after install change)
Should print the usage block. If torch / ultralytics import fails, reinstall via:
Notes / gotchas
- First run downloads `yolov8n.pt` (~6 MB) into the repo root. Don't
git pull --rebaseand panic if you see this file uncommitted. - CPU torch 2.11.0 is intentional — Python 3.14 has no torch wheels yet (as of 2026-05). The repo's
.venvis locked to Python 3.12 viapy -3.12 -m venv. Don't recreate it with the system Python. - Audio sync: repo handles non-zero stream start_time and VFR sources automatically. Do not pre-process the input with ffmpeg "to be safe" — it can hurt sync.
- Output extension: if you omit
.mp4from-o, it auto-appends. - Repo URL: https://github.com/kamilstanuch/Autocrop-vertical
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/autocrop-vertical/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/bertbertov/claude-stack/autocrop-vertical)