К основному содержанию
скилл CX Codex

halfsize — скилл для Claude Code: сжатие видео и установка

Скилл halfsize для Claude Code сжимает видео до заданного размера и измеряет качество через VMAF и SSIM. Включается, когда файл нужно уложить в лимит платформы или оценить потери качества.

MIT ★ 116 обновлён 2026-11-15

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add YKLovePython/halfsize --skill halfsize -a claude-code
Открыть на GitHub

Что делает 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-code

2Вручную: положить файлы

~/.claude/skills/halfsize/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/halfsize/

По шагам, с командами для каждой платформы: Как установить скилл в 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

Похожие скиллы

Все скиллы по теме «Заметки, задачи и проекты» →
video-comparer daymade Скилл video-comparer сравнивает два видео и собирает HTML-отчёт с метриками PSNR и SSIM, а также покадровым просмотром до и после сжатия. CX Codex +1 1 000установок compress-video Samarth Gupta Скилл compress-video пережимает видео через ffmpeg: по качеству или под заданный размер файла, с проверкой исходника и отчётом о степени сжатия. CX Codex +1 ★ 276звёзд репо video-editing affaan-m Скилл video-editing выстраивает пайплайн монтажа реального видео через ИИ. Помогает нарезать сырые записи через FFmpeg, собрать титры в Remotion и добавить озвучку в ElevenLabs. CX Codex +1 10 900установок raw-video-processing zc277584121 Скилл raw-video-processing обрабатывает сырые скринкасты: вырезает паузы с шумом клавиатуры и ускоряет видеоряд. Пригодится перед публикацией обучающих роликов и демо. CX Codex +1 3 900установок automate-this официальный github Скилл automate-this для GitHub Copilot разбирает видео с записью ручного процесса и готовит скрипты для его автоматизации. CX Codex +1 2 300установок video-edit calesthio Скилл video-edit для Claude Code обрабатывает локальные видеофайлы через ffmpeg: нарезает ролики, меняет пропорции под соцсети и сжимает дорожки. CX Codex +1 1 600установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой