Communitygithub.com

视频比较器

用于比较两个视频,分析压缩结果或质量差异。生成包含质量指标(PSNR、SSIM)和逐帧视觉对比的交互式HTML报告。

视频比较器 是什么?

该技能专为需要比较原始视频与压缩视频的开发者和AI代理用户设计。它通过自动提取视频元数据(编码器、分辨率、比特率、时长和文件大小),计算PSNR(峰值信噪比)和SSIM(结构相似性指数)两种标准质量指标,并提供三种帧比较模式(滑块、并排、网格),生成一个完全离线可用的自包含HTML报告。该报告默认在5秒间隔截取帧,并支持50%-200%缩放控制。该技能支持FFmpeg和FFprobe作为系统依赖,兼容.mp4、.mov、.avi、.mkv、.webm格式,并内置了路径验证、命令注入防护等安全机制。用户可通过命令行选项(如--interval)自定义帧间隔,或批量处理多个视频文件。对于常见错误,如FFmpeg未安装、文件过大或处理超时,技能会提供清晰的错误消息和解决指导。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Biznomad/agent-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-字符串、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报告包括:

  • 滑块模式: 拖动以显示原始 vs 压缩(默认)
  • 并排模式: 同时显示以进行直接比较
  • 网格模式: 紧凑的2列布局
  • 缩放控制: 50%-200% 放大倍率
  • 自包含格式(无需服务器,离线可用)

重要实现细节

安全性

脚本实现了:

  • 路径验证(绝对路径,防止目录遍历)
  • 命令注入防护(不使用shell=True,验证参数)
  • 资源限制(文件大小、超时)
  • 自定义异常:ValidationError、FFmpegError、VideoComparisonError

常见错误场景

"FFmpeg not found":通过平台包管理器安装 FFmpeg(参见要求部分)

"File too large":在比较前压缩视频,或调整 scripts/compare.py 中的 MAX_FILE_SIZE_MB

"Operation timed out":增加 FFMPEG_TIMEOUT 常量,或使用更大的 --interval 值(处理更少的帧)

"Frame count mismatch":视频时长/帧率不同;脚本自动截断至最小帧数并显示警告

配置

脚本包含可调整的常量,用于文件大小限制、超时、帧尺寸和提取间隔。要自定义行为,请编辑 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.

Biznomad/agent-skills

Landing page quality assessment for paid advertising campaigns. Evaluates message match, page speed, mobile experience, trust signals, form optimization, and conversion rate potential. Use when user says "landing page", "post-click experience", "landing page audit", "conversion rate", or "landing page optimization".

Biznomad/agent-skills

TikTok Ads deep analysis covering creative quality, tracking, bidding, campaign structure, and TikTok Shop. Evaluates 25 checks with emphasis on creative-first strategy, safe zone compliance, and Smart+ campaigns. Use when user says "TikTok Ads", "TikTok marketing", "TikTok Shop", "Spark Ads", "Smart+", or "TikTok campaign".

Biznomad/agent-skills

YouTube Ads specific analysis covering campaign types, creative quality, audience targeting, and measurement. Evaluates video ad performance across skippable, non-skippable, bumper, Shorts, and Demand Gen formats. Use when user says "YouTube Ads", "video ads", "pre-roll", "bumper ads", "YouTube campaign", or "Shorts ads".

Biznomad/agent-skills

Help users get promoted at work. Use when someone is preparing for a promotion conversation, building their case for advancement, trying to understand what's blocking their promotion, or figuring out how to get to the next level in their career.

Biznomad/agent-skills

CSS animation adapter patterns for HyperFrames. Use when authoring CSS keyframes, animation-delay based timing, animation-fill-mode, animation-play-state, or CSS-only motion that HyperFrames must seek deterministically during preview and rendering.

Biznomad/agent-skills

Video and audio processing with FFmpeg. Use for format conversion, resizing, compression, audio extraction, and preparing assets for Remotion. Triggers include converting GIF to MP4, resizing video, extracting audio, compressing files, or any media transformation task.

Biznomad/agent-skills

Read-only queue dashboard for workspace-aware ship. Shows which VERSION slots are currently claimed by open PRs, which sibling Conductor workspaces have WIP work likely to ship soon, and what slot /ship would pick next. No mutations — just a snapshot. Use when asked to "landing report", "what's in the queue", "show me open PRs", or "which version do I claim next". (gstack)

Biznomad/agent-skills

HyperFrames CLI dev loop — `npx hyperframes` for scaffolding (init), validation (lint, inspect), preview, render, and environment troubleshooting (doctor, browser, info, upgrade). Use when running any of these commands or troubleshooting the HyperFrames build/render environment. For asset preprocessing commands (`tts`, `transcribe`, `remove-background`), invoke the `hyperframes-media` skill instead.

Biznomad/agent-skills

Asset preprocessing for HyperFrames compositions — text-to-speech narration (Kokoro), audio/video transcription (Whisper), and background removal for transparent overlays (u2net). Use when generating voiceover from text, transcribing speech for captions, removing the background from a video or image to use as a transparent overlay, choosing a TTS voice or whisper model, or chaining these (TTS → transcribe → captions). Each command downloads its own model on first run.

Biznomad/agent-skills

Install and wire registry blocks and components into HyperFrames compositions. Use when running hyperframes add, installing a block or component, wiring an installed item into index.html, or working with hyperframes.json. Covers the add command, install locations, block sub-composition wiring, component snippet merging, and registry discovery.

Biznomad/agent-skills

Create video compositions, animations, title cards, overlays, captions, voiceovers, audio-reactive visuals, and scene transitions in HyperFrames HTML. Use when asked to build any HTML-based video content, add captions or subtitles synced to audio, generate text-to-speech narration, create audio-reactive animation (beat sync, glow, pulse driven by music), add animated text highlighting (marker sweeps, hand-drawn circles, burst lines, scribble, sketchout), or add transitions between scenes (crossfades, wipes, reveals, shader transitions). Covers composition authoring, timing, media, and the full video production workflow. For dev-loop CLI commands (init, lint, inspect, preview, render) see the hyperframes-cli skill; for asset preprocessing commands (tts, transcribe, remove-background) see the hyperframes-media skill.

Biznomad/agent-skills

Still-to-video conversion guide: model selection, motion prompting, and camera movement. Covers Wan 2.5 i2v, Seedance, Fabric, Grok Video with when to use each. Use for: animating images, creating video from stills, adding motion, product animations. Triggers: image to video, i2v, animate image, still to video, add motion to image, image animation, photo to video, animate still, wan i2v, image2video, bring image to life, animate photo, motion from image

Biznomad/agent-skills

>- The Landing Page Audit skill performs comprehensive evaluations of post-click experiences, combining technical performance analysis with conversion rate optimization (CRO) assessment.

Biznomad/agent-skills

Write high-converting landing page copy using proven frameworks like PAS (Problem-Agitate-Solution), AIDA, and StoryBrand. Creates headlines, value propositions, CTAs, and full page sections optimized for conversion. Use when users need landing page copy, sales page content, or marketing website text.

Biznomad/agent-skills

Optimize landing pages for higher conversion rates using proven frameworks and design patterns. Use when designing, reviewing, or improving landing pages, hero sections, pricing pages, CTAs, or when the user asks about conversion optimization.

Biznomad/agent-skills

Read-only queue dashboard for workspace-aware ship. (gstack)

Biznomad/agent-skills

Building promotion cases, brag documents, tracking wins, and self-advocacy for career advancement. Use when preparing for promotions, documenting accomplishments, or building your case for advancement.

Biznomad/agent-skills

Best practices for Remotion - Video creation in React

Biznomad/agent-skills

Translate an existing Remotion (React-based) video composition into a HyperFrames HTML composition. Use ONLY when the user explicitly asks to port, convert, migrate, translate, or rewrite a Remotion composition as HyperFrames (e.g. "port my Remotion project to HyperFrames"). Do NOT use when (a) authoring a NEW HyperFrames composition (even if A/B-testing a Remotion video); (b) Remotion is mentioned in passing; (c) Remotion code is shared as reference, not for translation; (d) the user wants "the same video as my Remotion one" without explicitly asking to migrate the source — treat as a fresh HyperFrames build. When in doubt, default to the `hyperframes` skill. Detects unsupported patterns (useState, useEffect side effects, async calculateMetadata, third-party React component libraries, `@remotion/lambda`) and recommends the runtime interop escape hatch instead of a lossy translation.

Biznomad/agent-skills

Produce programmable videos with Remotion using scene planning, asset orchestration, and validation gates for automated, brand-consistent video content.

相关技能