Communitygithub.com

daymade/claude-code-skills

此技能適用於比較兩部影片的壓縮結果或品質差異。可生成互動式 HTML 報告,包含品質指標(PSNR、SSIM)及逐幀視覺比較。當使用者提及「比較影片」、「影片品質」、「壓縮分析」、「壓縮前/後」或要求評估壓縮影片品質時觸發。

claude-code-skills 是什麼?

此技能「Video Comparer」專為開發者與 AI 代理設計,用於比較原始影片與壓縮後影片的品質差異。它會自動提取影片元數據,計算 PSNR(峰值信噪比)與 SSIM(結構相似性指標)兩項標準品質指標,並生成完全自足的互動式 HTML 報告。報告提供三種檢視模式:滑桿拖曳對比、並排顯示及網格模式,並支援縮放控制(50%–200%),無需伺服器即可離線使用。此技能支援 macOS、Ubuntu/Debian 及 Windows 平台,需依賴 FFmpeg/FFprobe 進行影片分析與幀提取,以及 Python 3.8+ 環境。輸入影片格式支援 .mp4、.mov、.avi、.mkv、.webm,單一檔案上限預設為 500MB,處理時間約 1–2 分鐘。腳本內建安全驗證機制,可防止路徑遍歷與命令注入,並提供清晰的錯誤訊息與解決指引。

相容平台✓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-strings、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 報告包含:

  • 滑桿模式: 拖曳顯示原始與壓縮版本對比(預設)
  • 並排模式: 同時顯示,便於直接比較
  • 網格模式: 緊湊的 2 欄佈局
  • 縮放控制: 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.

相關技能