Communitygithub.com

daymade/claude-code-skills

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

claude-code-skills 是什么?

此技能旨在高效对比两个视频文件(如原始视频与压缩版本),并生成一份独立的交互式 HTML 报告。它自动提取视频元数据,计算 PSNR(峰值信噪比)和 SSIM(结构相似性)等关键质量指标,并以三种模式(滑块、并排、网格)提供逐帧视觉比较。用户无需运行服务器即可离线查看报告。该脚本支持多种视频格式(.mp4、.mov 等),自动验证 FFmpeg 环境,并提供丰富的错误处理机制,是评估编码器性能、压缩效率或比特率优化效果的理想工具。同时,脚本包含路径安全、命令注入防护等安全措施。

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

在你喜欢的 AI 中提问

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

文档

Video Comparer

概述

比较两个视频,生成交互式 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-string、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 9 individual skills — each has its own dedicated page.

daymade/claude-code-skills

>- Generates Chinese/Japanese speech with StepFun's Contextual TTS — default stepaudio-2.5-tts, stepaudio-3-tts for whisper/inline-() prosody. Replaces step-tts-2's voice_label with natural-language instruction. Use for emotional/prosody-controlled synthesis, batch voice lines, migrating from step-tts-2, or cloned voices (2.5/step-tts-2, not v3). Triggers on 阶跃 TTS, 语音合成, 配音. Not for transcription (use stepfun-asr).

daymade/claude-code-skills

Download YouTube videos and HLS streams (m3u8) from platforms like Mux, Vimeo, etc. using yt-dlp and ffmpeg. Use this skill when users request downloading videos, extracting audio, handling protected streams with authentication headers, or troubleshooting download issues like nsig extraction failures, 403 errors, or cookie extraction problems.

daymade/local-conversation-history

Entry point for local AI conversation history across providers. Routes a request to the one skill that owns it, by platform (Claude Code, OpenAI Codex, Kimi CLI) and action (read evidence vs continue interrupted work), and owns the one job none of them own alone: a single inventory spanning all three providers. Use when the provider is unknown or plural ("our history", "what have I been working on", "which chats did I have"), when the user wants Kimi CLI history at all, when it is unclear whether they need evidence or resumption, or when they ask for this skill by name. Vague recall that names no platform ("we discussed this once, when was it?") belongs here rather than to a single-provider reader, because a Claude-only answer to an unscoped question cannot support an absence claim. When the platform and the action are both already clear, load that executor skill directly instead — except Kimi CLI, which has no reader or continuation skill of its own and always routes through here.

daymade/ppt-creator

Create professional slide decks from topics or documents. Generates structured content with data-driven charts, speaker notes, and complete PPTX files. Applies persuasive storytelling principles (Pyramid Principle, assertion-evidence). Supports multiple formats (Marp, PowerPoint). Use for presentations, pitches, slide decks, or keynotes.

daymade/prompt-optimizer

Transform vague prompts into precise, well-structured specifications using EARS (Easy Approach to Requirements Syntax) methodology. This skill should be used when users provide loose requirements, ambiguous feature descriptions, or need to enhance prompts for AI-generated code, products, or documents. Triggers include requests to "optimize my prompt", "improve this requirement", "make this more specific", or when raw requirements lack detail and structure.

daymade/qa-expert

This skill should be used when establishing comprehensive QA testing processes for any software project. Use when creating test strategies, writing test cases following Google Testing Standards, executing test plans, tracking bugs with P0-P4 classification, calculating quality metrics, or generating progress reports. Includes autonomous execution capability via master prompts and complete documentation templates for third-party QA team handoffs. Implements OWASP security testing and achieves 90% coverage targets.

daymade/read-claude-code-history

Reads, searches, and exports local Claude Code history without resuming work. Covers recent session inventory, exact session timelines, verbatim human input including queued mid-turn prompts, full-event keyword search, hybrid recall when wording changed, end-state triage, and deleted-file recovery across active Claude homes plus registered archives. Use whenever the user asks what they or Claude said, wants a Claude Code session ID or original context, remembers prior work vaguely, needs an old file from a transcript, or must prove what a Claude session contained before continuing it. Also owns the only Kimi CLI surface, via its Kimi inventory and search flags. For Codex history use read-codex-history; when the request names no platform at all or spans providers, start at local-conversation-history.

daymade/read-codex-history

Reads, searches, and exports local OpenAI Codex history without continuing the old task. Lists recent Codex sessions, extracts exact prompt-ledger inputs by Session, locates a rollout by verified session_meta identity, reconstructs one chronological user/assistant timeline with fork and compaction lineage, and performs bounded keyword search across live and archived rollouts. Use whenever the user asks what they told Codex, wants recent original inputs, a Codex Session ID, full prior context, fork ancestry, or evidence of what a Codex run did. For Claude Code history use read-claude-code-history.

daymade/twitter-reader

Fetch Twitter/X post content including long-form Articles with full images and metadata. Use when Claude needs to retrieve tweet/article content, author info, engagement metrics, and embedded media. Supports individual posts and X Articles (long-form content). Automatically downloads all images to local attachments folder and generates complete Markdown with proper image references. Preferred over Jina for X Articles with images.

相关技能