video-comparer — скилл для Claude Code: сравнение двух видео
Скилл сравнивает два видео и собирает HTML-отчёт с метриками PSNR и SSIM, а также покадровым просмотром до и после сжатия.
npx skills add daymade/claude-code-skills --skill video-comparer -a claude-codeЧто делает video-comparer
Скилл запускает scripts/compare.py, который вытаскивает метаданные обоих файлов (кодек, разрешение, битрейт, длительность, размер), считает PSNR и SSIM и строит отчёт comparison.html. Внутри — три режима просмотра: слайдер, бок о бок и сетка, плюс зум от 50% до 200%. Отчёт самодостаточный: кадры вшиты как base64, сервер не нужен, работает офлайн.
Кадры берутся с шагом по умолчанию 5 секунд, приводятся к высоте 800px. Интервал меняется флагом --interval, имя файла — через -o. Есть готовый цикл для пакетной обработки папки.
Для работы нужны FFmpeg и FFprobe, а также Python 3.8+. Скрипт сам проверяет их наличие и падает с понятной ошибкой, если чего-то нет. Лимит — 500MB на видео, при превышении придётся сжимать файл или править MAX_FILE_SIZE_MB в scripts/compare.py. Если видео разной длительности, скрипт обрежет сравнение по меньшему числу кадров и предупредит об этом.
Какие задачи решает
- сравнить оригинал и сжатую версию видео
- посчитать PSNR и SSIM после перекодирования
- оценить, как битрейт влияет на картинку
- собрать HTML-отчёт с покадровым сравнением
- прогнать пакетную проверку папки с видео
Примеры запросов агенту
- Сравни original.mp4 и compressed.mp4 и покажи отчёт
- Посчитай PSNR и SSIM для этих двух видео
- Сделай сравнение с интервалом кадров 10 секунд
Как установить video-comparer
1Через Skills CLI (Vercel)
npx skills add daymade/claude-code-skills --skill video-comparer -a claude-code2Вручную: положить файлы
~/.claude/skills/video-comparer/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/video-comparer/
1Через Skills CLI (Vercel)
npx skills add daymade/claude-code-skills --skill video-comparer -a codex2Вручную: положить файлы
.agents/skills/video-comparer/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add daymade/claude-code-skills --skill video-comparer -a cursor2Вручную: положить файлы
.cursor/skills/video-comparer/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install daymade/claude-code-skills video-comparer2Вручную: положить файлы
.github/skills/video-comparer/SKILL.md1Через Skills CLI (Vercel)
npx skills add daymade/claude-code-skills --skill video-comparer -a gemini-cli2Командой платформы
gemini skills install https://github.com/daymade/claude-code-skills --path video-comparerВручную: положить файлы
.devin/skills/video-comparer/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add daymade/claude-code-skills --skill video-comparer -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о video-comparer
Как установить video-comparer в Claude?
Выполните npx skills add daymade/claude-code-skills --skill video-comparer -a claude-code. Скилл появится в ~/.claude/skills/video-comparer/SKILL.md.
Что делает video-comparer?
Сравнивает два видео, считает PSNR и SSIM, извлекает кадры и собирает интерактивный HTML-отчёт с режимами слайдера, бок о бок и сетки.
Что нужно для работы скилла?
FFmpeg и FFprobe, а также Python 3.8+. Скрипт проверяет их наличие сам и сообщает, чего не хватает.
Исходный текст
SKILL.md · MIT
---
name: video-comparer
description: This skill should be used when comparing two videos to analyze compression results or quality differences. Generates interactive HTML reports with quality metrics (PSNR, SSIM) and frame-by-frame visual comparisons. Triggers when users mention "compare videos", "video quality", "compression analysis", "before/after compression", or request quality assessment of compressed videos.
---
# Video Comparer
## Overview
Compare two videos and generate an interactive HTML report analyzing compression results. The script extracts video metadata, calculates quality metrics (PSNR, SSIM), and creates frame-by-frame visual comparisons with three viewing modes: slider, side-by-side, and grid.
## When to Use This Skill
Use this skill when:
- Comparing original and compressed videos
- Analyzing video compression quality and efficiency
- Evaluating codec performance or bitrate reduction impact
- Users mention "compare videos", "video quality", "compression analysis", or "before/after compression"
## Core Usage
### Basic Command
```bash
python3 scripts/compare.py original.mp4 compressed.mp4
```
Generates `comparison.html` with:
- Video parameters (codec, resolution, bitrate, duration, file size)
- Quality metrics (PSNR, SSIM, size/bitrate reduction percentages)
- Frame-by-frame comparison (default: frames at 5s intervals)
### Command Options
```bash
# Custom output file
python3 scripts/compare.py original.mp4 compressed.mp4 -o report.html
# Custom frame interval (larger = fewer frames, faster processing)
python3 scripts/compare.py original.mp4 compressed.mp4 --interval 10
# Batch comparison
for original in originals/*.mp4; do
compressed="compressed/$(basename "$original")"
output="reports/$(basename "$original" .mp4).html"
python3 scripts/compare.py "$original" "$compressed" -o "$output"
done
```
## Requirements
### System Dependencies
**FFmpeg and FFprobe** (required for video analysis and frame extraction):
```bash
# macOS
brew install ffmpeg
# Ubuntu/Debian
sudo apt update && sudo apt install ffmpeg
# Windows
# Download from https://ffmpeg.org/download.html
# Or use: winget install ffmpeg
```
**Python 3.8+** (uses type hints, f-strings, pathlib)
### Video Specifications
- **Supported formats:** `.mp4` (recommended), `.mov`, `.avi`, `.mkv`, `.webm`
- **File size limit:** 500MB per video (configurable)
- **Processing time:** ~1-2 minutes for typical videos; varies by duration and frame interval
## Script Behavior
### Automatic Validation
The script automatically validates:
- FFmpeg/FFprobe installation and availability
- File existence, extensions, and size limits
- Path security (prevents directory traversal)
Clear error messages with resolution guidance appear when validation fails.
### Quality Metrics
The script calculates two standard quality metrics:
**PSNR (Peak Signal-to-Noise Ratio):** Pixel-level similarity measurement (20-50 dB scale, higher is better)
**SSIM (Structural Similarity Index):** Perceptual similarity measurement (0.0-1.0 scale, higher is better)
For detailed interpretation scales and quality thresholds, consult `references/video_metrics.md`.
### Frame Extraction
The script extracts frames at specified intervals (default: 5 seconds), scales them to consistent height (800px) for comparison, and embeds them as base64 data URLs in self-contained HTML. Temporary files are automatically cleaned after processing.
### Output Report
The generated HTML report includes:
- **Slider Mode**: Drag to reveal original vs compressed (default)
- **Side-by-Side Mode**: Simultaneous display for direct comparison
- **Grid Mode**: Compact 2-column layout
- **Zoom Controls**: 50%-200% magnification
- Self-contained format (no server required, works offline)
## Important Implementation Details
### Security
The script implements:
- Path validation (absolute paths, prevents directory traversal)
- Command injection prevention (no `shell=True`, validated arguments)
- Resource limits (file size, timeouts)
- Custom exceptions: `ValidationError`, `FFmpegError`, `VideoComparisonError`
### Common Error Scenarios
**"FFmpeg not found"**: Install FFmpeg via platform package manager (see Requirements section)
**"File too large"**: Compress videos before comparison, or adjust `MAX_FILE_SIZE_MB` in `scripts/compare.py`
**"Operation timed out"**: Increase `FFMPEG_TIMEOUT` constant or use larger `--interval` value (processes fewer frames)
**"Frame count mismatch"**: Videos have different durations/frame rates; script auto-truncates to minimum frame count and shows warning
## Configuration
The script includes adjustable constants for file size limits, timeouts, frame dimensions, and extraction intervals. To customize behavior, edit the constants at the top of `scripts/compare.py`. For detailed configuration options and their impacts, consult `references/configuration.md`.
## Reference Materials
Consult these files for detailed information:
- **`references/video_metrics.md`**: Quality metrics interpretation (PSNR/SSIM scales, compression targets, bitrate guidelines)
- **`references/ffmpeg_commands.md`**: FFmpeg command reference (metadata extraction, frame extraction, troubleshooting)
- **`references/configuration.md`**: Script configuration options and adjustable constants
- **`assets/template.html`**: HTML report template for customizing viewing modes and styling
© daymade · MIT · daymade/claude-code-skills