halfsize — скилл для Claude Code: сжатие видео и установка
Скилл halfsize для Claude Code сжимает видео до заданного размера и измеряет качество через VMAF и SSIM. Включается, когда файл нужно уложить в лимит платформы или оценить потери качества.
MIT ★ 116 обновлён 2026-11-15
npx skills add YKLovePython/halfsize --skill halfsize -a claude-codeЧто делает halfsize
halfsize сжимает видео до заданного размера с помощью локальной CLI-команды. Она рассчитывает битрейт, подбирает разрешение, кодирует файл дважды и показывает замеры VMAF и SSIM. Видео остаётся на компьютере и никуда не загружается.
Можно обработать несколько файлов одной командой, сохранить разрешение флагом --no-downscale или убрать звук через --no-audio. Для предварительного просмотра плана есть --dry-run; результат можно получить в JSON. По умолчанию используется H.264, а H.265 снижает совместимость. Для работы нужен FFmpeg; если его бинарник не скачался, команда предлагает исправить установку через npx halfsize@latest --fix. Файлы результата сохраняются рядом с исходниками.
Какие задачи решает
- сжать видео до точного лимита размера
- подготовить файл под ограничение Discord или Gmail
- измерить потери качества после сжатия
- обработать несколько видео одной командой
Примеры запросов агенту
- Сожми
input.mp4до 25 МБ и сообщи оценку качества. - Подготовь
clip.mp4для отправки в Discord. - Сравни качество видео до и после сжатия по VMAF и SSIM.
Как установить halfsize
1Через Skills CLI (Vercel)
npx skills add YKLovePython/halfsize --skill halfsize -a claude-code2Вручную: положить файлы
~/.claude/skills/halfsize/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/halfsize/
1Через Skills CLI (Vercel)
npx skills add YKLovePython/halfsize --skill halfsize -a codex2Вручную: положить файлы
.agents/skills/halfsize/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add YKLovePython/halfsize --skill halfsize -a cursor2Вручную: положить файлы
.cursor/skills/halfsize/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install YKLovePython/halfsize skills/halfsize2Вручную: положить файлы
.github/skills/halfsize/SKILL.md1Через Skills CLI (Vercel)
npx skills add YKLovePython/halfsize --skill halfsize -a gemini-cli2Командой платформы
gemini skills install https://github.com/YKLovePython/halfsize --path skills/halfsizeВручную: положить файлы
.devin/skills/halfsize/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Claude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о halfsize
Как установить halfsize в Claude Code?
Выполни npx skills add YKLovePython/halfsize --skill halfsize -a claude-code. Файл скилла появится по пути ~/.claude/skills/halfsize/SKILL.md.
Что делает halfsize?
Сжимает видео до заданного размера локально через FFmpeg и измеряет качество по VMAF и SSIM. Видео не загружается в интернет.
Что нужно для работы halfsize?
Нужен FFmpeg. Если его бинарник не установился, запусти npx halfsize@latest --fix и повтори команду.
Исходный текст
SKILL.md · MIT
---
name: halfsize
description: Compress a video to an exact target size (20 MB, 16 MB, 700k, ...) on the local machine with FFmpeg, then verify quality with VMAF/SSIM. Use when a user needs a video to fit a platform cap, asks to "make this smaller", or wants to know what a size cut costs in quality.
---
# halfsize
`halfsize` is a local CLI. It does the bitrate math, picks a resolution, encodes twice,
and reports the measured quality. It never uploads the file.
## When to use this
- "Make this fit in 25 MB" / "Discord won't take it" / "WeChat says the file is too big"
- "Compress this but don't ruin it" — run it and report VMAF instead of guessing
- "How small can this go?" — try a target and read the verdict
## Commands
```bash
# exact size
npx halfsize input.mp4 --to 25mb
# let a platform cap pick the size
npx halfsize input.mp4 --for discord
npx halfsize input.mp4 --for gmail # 18 MB, safe under the 25 MB message cap
npx halfsize input.mp4 --for outlook # 15 MB, safe under the 20 MB message cap
# several files, one command
npx halfsize a.mp4 b.mp4 c.mp4 --to 10mb
# smaller, at the cost of compatibility
npx halfsize input.mp4 --to 10mb --codec h265
# keep resolution, accept a worse ratio
npx halfsize input.mp4 --to 25mb --no-downscale
# no soundtrack
npx halfsize input.mp4 --to 10mb --no-audio
# inspect the plan without encoding
npx halfsize input.mp4 --to 25mb --dry-run --json
# machine-readable result (plan, accuracy, VMAF, SSIM)
npx halfsize input.mp4 --to 25mb --json
```
With more than one input, `--json` returns `{ "files": [ ... ] }`.
If `npx halfsize` is unavailable, use `npx github:YKLovePython/halfsize` with the same flags.
If a run fails with "FFmpeg was not found" (npm sometimes skips the binary download
behind a proxy), repair it in place, then retry the same command:
```bash
npx halfsize@latest --fix
```
## How to read the result
- `0.3% under target` — good; it deliberately aims slightly under hard caps
- `VMAF >= 90` — looks the same; `80-90` — slight softening; `< 70` — visible loss
- The JSON result includes `output.file`, `output.bytes`, `quality.vmaf`, `quality.ssim`,
`accuracy`, and `verdict`.
## Rules
- Do not upload the user's video anywhere, and do not suggest an online compressor as a first step.
- Do not promise "no quality loss". Report the measured VMAF/SSIM and the verdict.
- If the source is already smaller than the target, stop and tell the user instead of re-encoding.
- HDR sources (iPhone HLG, HDR10/PQ) are tone-mapped to SDR automatically. Do not warn about washed-out colors unless the user asks to keep HDR.
- If the target is below the minimum the duration can hold, the CLI exits with the smallest achievable size. Report that number and suggest a larger target or trimming, instead of rerunning with `--force`.
- Prefer H.264 unless the user asks for smaller files or accepts H.265 compatibility tradeoffs.
- Write the output next to the input unless the user asks for a specific `--out` path.
© YKLovePython · MIT · YKLovePython/halfsize