Communitygithub.com

ComeOnOliver/skillshub

用于对比两个视频、分析压缩结果或质量差异的技能。生成包含质量指标(PSNR、SSIM)和逐帧视觉对比的交互式HTML报告。当用户提及“比较视频”、“视频质量”、“压缩分析”、“压缩前后对比”或请求压缩视频质量评估时触发。

skillshub 是什么?

该技能旨在帮助开发者和视频工程师快速、直观地分析视频压缩效果。它通过自动提取元数据并计算PSNR和SSIM两大标准质量指标,对原始视频和压缩后的视频进行全面对比。核心优势在于生成一个自包含的交互式HTML报告,提供滑块对比、并排显示和网格三种视图模式,支持缩放控制,无需服务器即可离线使用。该技能兼容macOS、Linux和Windows平台,依赖FFmpeg和Python 3.8+,能处理mp4、mov、avi等多种常见视频格式。脚本内置了文件大小限制、路径安全检查和超时等安全机制,并提供了批量处理能力,非常适合进行编解码器性能评估、比特率优化分析或压缩质量验收等场景。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/daymade/claude-code-skills/video-comparer

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

视频对比器

概述

对比两个视频,生成交互式HTML报告,分析压缩结果。该脚本提取视频元数据,计算质量指标(PSNR、SSIM),并创建逐帧视觉对比,提供三种查看模式:滑块、并排和网格。

何时使用此技能

在以下情况下使用此技能:

  • 对比原始视频和压缩视频
  • 分析视频压缩质量和效率
  • 评估编解码器性能或比特率降低的影响
  • 用户提及“比较视频”、“视频质量”、“压缩分析”或“压缩前后对比”

核心用法

基本命令

python3 scripts/compare.py original.mp4 compressed.mp4

生成 comparison.html,包含:

  • 视频参数(编解码器、分辨率、比特率、时长、文件大小)
  • 质量指标(PSNR、SSIM、大小/比特率降低百分比)
  • 逐帧对比(默认:以5秒间隔提取帧)

命令选项

# 自定义输出文件
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

要求

系统依赖

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
  • 文件大小限制: 每个视频500MB(可配置)
  • 处理时间: 典型视频约1-2分钟;时长和帧间隔不同而变化

脚本行为

自动验证

脚本自动验证:

  • FFmpeg/FFprobe 安装和可用性
  • 文件存在性、扩展名和大小限制
  • 路径安全(防止目录遍历)

验证失败时会显示清晰的错误消息和解决指引。

质量指标

脚本计算两个标准质量指标:

PSNR(峰值信噪比): 像素级相似度测量(20-50 dB范围,越高越好)

SSIM(结构相似性指数): 感知相似度测量(0.0-1.0范围,越高越好)

有关详细的解释尺度与质量阈值,请参考 references/video_metrics.md。

帧提取

脚本按指定间隔(默认:5秒)提取帧,将其缩放为一致的高度(800px)以便对比,并以 base64 数据 URL 的形式嵌入到自包含的 HTML 中。处理完成后自动清理临时文件。

输出报告

生成的 HTML 报告包含:

  • 滑块模式: 拖动以揭示原始视频与压缩视频(默认)
  • 并排模式: 同时显示以便直接对比
  • 网格模式: 紧凑的双列布局
  • 缩放控件: 50%-200% 放大倍率
  • 自包含格式(无需服务器,可离线工作)

重要实现细节

安全性

脚本实现了:

  • 路径验证(绝对路径,防止目录遍历)
  • 命令注入防护(不使用 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 报告模板

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

相关技能