video-comparer by daymade/claude-code-skills
npx skills add https://github.com/daymade/claude-code-skills --skill video-comparer比较两个视频并生成交互式 HTML 报告,分析压缩结果。该脚本提取视频元数据,计算质量指标(PSNR、SSIM),并创建三种查看模式的逐帧视觉比较:滑块模式、并排模式和网格模式。
在以下情况下使用此技能:
python3 scripts/compare.py original.mp4 compressed.mp4
生成包含以下内容的 comparison.html:
# 自定义输出文件
python3 scripts/compare.py original.mp4 compressed.mp4 -o report.html
# 自定义帧间隔(数值越大,帧数越少,处理越快)
python3 scripts/compare.py original.mp4 compressed.mp4 --interval 10
# 批量比较
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
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
FFmpeg 和 FFprobe(视频分析和帧提取所需):
# macOS
brew install ffmpeg
# Ubuntu/Debian
sudo apt update && sudo apt install ffmpeg
# Windows
# 从 https://ffmpeg.org/download.html 下载
# 或使用:winget install ffmpeg
Python 3.8+(使用类型提示、f-字符串、pathlib)
.mp4(推荐)、.mov、.avi、.mkv、.webm脚本自动验证:
验证失败时,会显示带有解决指导的清晰错误信息。
脚本计算两个标准质量指标:
PSNR(峰值信噪比): 像素级相似度测量(20-50 dB 范围,越高越好)
SSIM(结构相似性指数): 感知相似度测量(0.0-1.0 范围,越高越好)
有关详细的解释范围和质量阈值,请查阅 references/video_metrics.md。
脚本在指定间隔(默认:5 秒)提取帧,将它们缩放到一致的高度(800px)以便比较,并将其作为 base64 数据 URL 嵌入到自包含的 HTML 中。临时文件在处理后会自动清理。
生成的 HTML 报告包括:
脚本实现了:
shell=True,验证参数)ValidationError、FFmpegError、VideoComparisonError"未找到 FFmpeg":通过平台包管理器安装 FFmpeg(参见要求部分)
"文件过大":在比较前压缩视频,或调整 scripts/compare.py 中的 MAX_FILE_SIZE_MB
"操作超时":增加 FFMPEG_TIMEOUT 常量或使用更大的 --interval 值(处理更少的帧)
"帧数不匹配":视频具有不同的时长/帧率;脚本会自动截断到最小帧数并显示警告
脚本包含可调整的常量,用于文件大小限制、超时、帧尺寸和提取间隔。要自定义行为,请编辑 scripts/compare.py 顶部的常量。有关详细的配置选项及其影响,请查阅 references/configuration.md。
查阅以下文件以获取详细信息:
references/video_metrics.md:质量指标解释(PSNR/SSIM 范围、压缩目标、码率指南)references/ffmpeg_commands.md:FFmpeg 命令参考(元数据提取、帧提取、故障排除)references/configuration.md:脚本配置选项和可调整常量assets/template.html:用于自定义查看模式和样式的 HTML 报告模板每周安装数
123
代码仓库
GitHub 星标数
708
首次出现
Jan 21, 2026
安全审计
安装于
claude-code108
opencode100
gemini-cli95
codex95
cursor89
github-copilot87
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.
Use this skill when:
python3 scripts/compare.py original.mp4 compressed.mp4
Generates comparison.html with:
# 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
FFmpeg and FFprobe (required for video analysis and frame extraction):
# 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)
.mp4 (recommended), .mov, .avi, .mkv, .webmThe script automatically validates:
Clear error messages with resolution guidance appear when validation fails.
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.
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.
The generated HTML report includes:
The script implements:
shell=True, validated arguments)ValidationError, FFmpegError, VideoComparisonError"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
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.
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 constantsassets/template.html : HTML report template for customizing viewing modes and stylingWeekly Installs
123
Repository
GitHub Stars
708
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
claude-code108
opencode100
gemini-cli95
codex95
cursor89
github-copilot87
Python PDF处理教程:合并拆分、提取文本表格、创建PDF文件
62,800 周安装