op7418

video-wrapper

111
9
# Install this skill:
npx skills add op7418/Video-Wrapper-Skills

Or install specific skill: npx add-skill https://github.com/op7418/Video-Wrapper-Skills

# Description

为访谈视频添加综艺特效(花字、卡片、人物条、章节标题等)。支持 4 种视觉主题,先分析字幕内容生成建议供用户审批,再渲染视频。

# SKILL.md


name: video-wrapper
description: 为访谈视频添加综艺特效(花字、卡片、人物条、章节标题等)。支持 4 种视觉主题,先分析字幕内容生成建议供用户审批,再渲染视频。
argument-hint: [config.json] [output.mp4]
user-invocable: true
allowed-tools: Bash, Read, Write
context: fork
agent: general-purpose


访谈视频处理器

基于 Python + Playwright + MoviePy 的视频特效处理工具,使用 HTML/CSS/Anime.js 渲染高质量视觉效果。

工作流程

第一步:分析字幕内容

当用户提供视频和字幕文件时,先分析字幕内容,生成特效建议:

  1. 读取字幕文件 (.srt)
  2. 分析内容,识别:
  3. 嘉宾信息(用于人物条)
  4. 话题切换点(用于章节标题)
  5. 关键词和术语(用于花字)
  6. 专业名词(用于名词卡片)
  7. 精彩观点(用于金句卡片)
  8. 数字数据(用于数据动画)
  9. 核心要点(用于要点列表)
  10. 生成建议列表,展示给用户审核

第二步:用户审核

将建议以 Markdown 格式展示给用户:

## 视觉特效建议

**主题**: notion

### 1. 人物条 (Lower Third)
- **姓名**: Dario Amodei
- **职位**: CEO
- **公司**: Anthropic
- **出现时间**: 1000ms

### 2. 花字高亮 (Fancy Text)
1. **通用人工智能** (emphasis)
   时间: 2630ms - 5500ms
   原因: 核心概念首次提及

...

用户可以:
- 确认全部建议
- 修改部分建议
- 删除不需要的组件
- 添加新的组件

第三步:生成配置并渲染

根据用户审批后的建议生成 config.json,然后渲染视频。

可用组件

组件 用途 配置字段
人物条 (lower_third) 显示嘉宾信息 name, role, company, startMs, durationMs
章节标题 (chapter_title) 话题切换标题 number, title, subtitle, startMs, durationMs
花字 (fancy_text) 概括当前观点 text, style, startMs, endMs, position
名词卡片 (term_card) 解释术语 chinese, english, description, firstAppearanceMs
金句卡片 (quote_callout) 突出精彩观点 text, author, startMs, durationMs, position
数据动画 (animated_stats) 展示数字 prefix, number, unit, label, startMs
要点列表 (bullet_points) 总结核心要点 title, points[], startMs, durationMs
社交媒体条 (social_bar) 关注引导 platform, label, handle, startMs, durationMs

花字使用规范

⚠️ 重要:花字必须遵循以下规范:

  1. 必须是短语:用简短的句子概括说话人当时的观点
  2. ✅ 正确:「AI发展是平滑曲线」「智能增长类似摩尔定律」
  3. ❌ 错误:「人工智能」「摩尔定律」(这些是单词,应该用名词卡片)

  4. 与名词卡片互补

  5. 花字:概括观点(如「智能每年翻倍增长」)
  6. 名词卡片:解释术语(如「摩尔定律:集成电路晶体管数量每18-24个月翻一番」)

  7. 位置在上方:默认显示在屏幕上方区域(字幕上方),避免遮挡人脸

社交媒体条使用规范

  • 默认显示时长:8 秒(比其他组件更长,给用户足够时间记住)
  • 通常在视频结尾出现
  • 支持平台:twitter, weibo, youtube

主题系统

支持 4 种视觉主题:

主题 风格 适用场景
notion 温暖知识风 教育、知识分享
cyberpunk 霓虹未来感 科技、前沿话题
apple 极简优雅 商务、专业访谈
aurora 渐变流光 创意、艺术内容

配置文件格式

{
  "theme": "notion",
  "lowerThirds": [
    {
      "name": "Dario Amodei",
      "role": "CEO",
      "company": "Anthropic",
      "startMs": 1000,
      "durationMs": 5000
    }
  ],
  "chapterTitles": [
    {
      "number": "Part 1",
      "title": "指数增长的本质",
      "subtitle": "The Nature of Exponential Growth",
      "startMs": 0,
      "durationMs": 4000
    }
  ],
  "keyPhrases": [
    {
      "text": "通用人工智能",
      "style": "emphasis",
      "startMs": 2630,
      "endMs": 5500
    }
  ],
  "termDefinitions": [
    {
      "chinese": "摩尔定律",
      "english": "Moore's Law",
      "description": "集成电路晶体管数量每18-24个月翻一番",
      "firstAppearanceMs": 37550,
      "displayDurationSeconds": 6
    }
  ],
  "quotes": [
    {
      "text": "AI 的发展是一个非常平滑的指数曲线",
      "author": "— Dario Amodei",
      "startMs": 30000,
      "durationMs": 5000
    }
  ],
  "stats": [
    {
      "prefix": "增长率 ",
      "number": 240,
      "unit": "%",
      "label": "计算能力年增长",
      "startMs": 45000,
      "durationMs": 4000
    }
  ],
  "bulletPoints": [
    {
      "title": "核心观点",
      "points": [
        "AI 发展是平滑的指数曲线",
        "类似摩尔定律的智能增长",
        "没有突然的奇点时刻"
      ],
      "startMs": 50000,
      "durationMs": 6000
    }
  ]
}

依赖安装

# 进入虚拟环境
cd ~/.claude/skills/video-wrapper
source venv/bin/activate

# 安装依赖
pip install -r requirements.txt

# 安装 Playwright 浏览器
playwright install chromium

命令行使用

# 使用浏览器渲染器(推荐)
python src/video_processor.py video.mp4 subs.srt config.json output.mp4

# 指定渲染器
python src/video_processor.py video.mp4 subs.srt config.json -r browser
python src/video_processor.py video.mp4 subs.srt config.json -r pil

技术实现

  • 视觉渲染: HTML + CSS + Anime.js (通过 Playwright 截图)
  • 视频合成: MoviePy
  • 动画引擎: Anime.js (Spring 物理动画)
  • 备用渲染: Python PIL

文件结构

~/.claude/skills/video-wrapper/
├── src/
│   ├── video_processor.py    # 主处理脚本
│   ├── browser_renderer.py   # Playwright 渲染器
│   ├── content_analyzer.py   # 内容分析器
│   ├── fancy_text.py         # PIL 花字(备用)
│   └── term_card.py          # PIL 卡片(备用)
├── templates/
│   ├── fancy-text.html       # 花字模板
│   ├── term-card.html        # 名词卡片模板
│   ├── lower-third.html      # 人物条模板
│   ├── chapter-title.html    # 章节标题模板
│   ├── quote-callout.html    # 金句卡片模板
│   ├── animated-stats.html   # 数据动画模板
│   └── bullet-points.html    # 要点列表模板
├── static/
│   ├── css/
│   │   ├── effects.css       # 基础效果
│   │   ├── theme-notion.css  # Notion 主题
│   │   ├── theme-cyberpunk.css
│   │   ├── theme-apple.css
│   │   └── theme-aurora.css
│   └── js/
│       └── anime.min.js      # Anime.js
└── requirements.txt

注意事项

  • 视频处理需要较长时间,请耐心等待
  • 确保有足够的磁盘空间存储输出视频
  • Playwright 渲染效果更好,但需要安装 Chromium
  • 如果 Playwright 不可用,会自动回退到 PIL 渲染

# README.md

# 🎬 Video Wrapper **为访谈/播客视频添加综艺风格视觉包装** AI 智能分析字幕内容,自动生成特效建议,一键渲染专业级视觉效果 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/) [![Claude Skills](https://img.shields.io/badge/Claude-Skills-blueviolet.svg)](https://claude.ai) [快速开始](#-快速开始) • [功能特性](#-功能特性) • [效果展示](#-效果展示) • [使用场景](#-使用场景) • [架构文档](./ARCHITECTURE.md)

✨ 功能特性

### 🎨 8 种视觉组件 - **花字高亮** - 短语概括核心观点 - **人物条** - 显示嘉宾姓名职位 - **章节标题** - 话题切换标题卡 - **名词卡片** - 专业术语解释 - **金句卡片** - 精彩言论突出 - **数据动画** - 数字动态展示 - **要点列表** - 核心观点总结 - **社交条** - 关注引导信息 ### 🎭 4 种视觉主题 - **Notion** 🟡 - 温暖知识风格 - **Cyberpunk** 💜 - 霓虹未来感 - **Apple** ⚪ - 极简商务风格 - **Aurora** 🌈 - 渐变流光效果 ### 🤖 智能工作流 1. 📝 AI 分析字幕内容 2. 💡 自动生成特效建议 3. ✅ 用户审批确认 4. 🎬 一键渲染视频

🛠️ 双渲染引擎

引擎 技术栈 特点
Browser 🌐 Playwright + HTML/CSS/Anime.js 高质量,支持复杂动画(推荐)
PIL 🎨 Python PIL 纯 Python,无需浏览器

🚀 快速开始

安装 Skill

方式一:一键安装(推荐)

npx skills add https://github.com/op7418/Video-Wrapper-Skills

方式二:手动安装

# 克隆到 Claude Skills 目录
cd ~/.claude/skills/
git clone https://github.com/op7418/Video-Wrapper-Skills.git video-wrapper
cd video-wrapper

# 安装依赖
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
playwright install chromium

使用

在 Claude Code 中

/video-wrapper interview.mp4 subtitles.srt

Claude 会:
1. 📊 分析字幕,识别关键信息
2. 💡 生成特效建议(人物条、花字、名词卡片等)
3. 📝 展示 Markdown 格式建议供审批
4. ✅ 确认后自动渲染输出视频

命令行使用

# 有配置文件时直接渲染
python src/video_processor.py video.mp4 subs.srt config.json output.mp4

# 指定渲染器
python src/video_processor.py video.mp4 subs.srt config.json -r browser  # 浏览器渲染
python src/video_processor.py video.mp4 subs.srt config.json -r pil      # PIL 渲染

🎥 效果展示

💡 以下展示不同主题和组件的视觉效果

主题风格对比

Notion 主题
温暖知识风
Cyberpunk 主题
霓虹未来感
Apple 主题
极简优雅
Aurora 主题
渐变流光
🟡 教育/知识分享 💜 科技/前沿话题 ⚪ 商务/专业访谈 🌈 创意/艺术内容

组件效果示例

组件 效果预览 使用场景
🏷️ 花字 [效果图占位] 嘉宾说到"通用人工智能"时,屏幕上方显示"AI发展是平滑曲线"
👤 人物条 [效果图占位] 视频开始时展示"Dario Amodei · CEO · Anthropic"
📖 名词卡片 [效果图占位] 首次提到"摩尔定律"时,自动弹出解释卡片
💬 金句 [效果图占位] 精彩观点"AI的发展是一个非常平滑的指数曲线"突出显示

📋 使用场景

### 🎓 教育内容 - 知识分享视频 - 课程录制 - 在线讲座 - 术语解释需求多 ### 🎙️ 访谈播客 - 人物专访 - 圆桌讨论 - 行业对话 - 需要嘉宾信息展示 ### 📱 社交媒体 - YouTube 长视频 - B站 UP主内容 - 播客节目 - 需要精彩片段突出

🎨 主题系统

根据内容风格选择合适主题:

{
  "theme": "notion"  // 或 "cyberpunk", "apple", "aurora"
}
主题 色系 特点 适用内容
Notion 暖黄 + 蓝色 柔和渐变,知识感 教育、知识分享、课程
Cyberpunk 霓虹紫 + 青色 高对比,科技感 技术、科幻、前沿话题
Apple 黑白灰 极简,专业感 商务、企业、正式访谈
Aurora 渐变彩虹 流光溢彩,艺术感 创意、设计、艺术内容

🧩 组件配置

完整配置示例

展开查看完整 JSON 配置
{
  "theme": "notion",

  "lowerThirds": [
    {
      "name": "张三",
      "role": "首席科学家",
      "company": "AI 研究院",
      "startMs": 1000,
      "durationMs": 5000
    }
  ],

  "chapterTitles": [
    {
      "number": "Part 1",
      "title": "AI 的发展历程",
      "subtitle": "The History of AI Development",
      "startMs": 0,
      "durationMs": 4000
    }
  ],

  "keyPhrases": [
    {
      "text": "AI 发展是平滑曲线",
      "style": "emphasis",
      "startMs": 2630,
      "endMs": 5500
    }
  ],

  "termDefinitions": [
    {
      "chinese": "摩尔定律",
      "english": "Moore's Law",
      "description": "集成电路晶体管数量每18-24个月翻一番",
      "firstAppearanceMs": 37550,
      "displayDurationSeconds": 6
    }
  ],

  "quotes": [
    {
      "text": "AI 的发展是一个非常平滑的指数曲线",
      "author": "— 张三",
      "startMs": 30000,
      "durationMs": 5000
    }
  ],

  "stats": [
    {
      "prefix": "增长率 ",
      "number": 240,
      "unit": "%",
      "label": "计算能力年增长",
      "startMs": 45000,
      "durationMs": 4000
    }
  ],

  "bulletPoints": [
    {
      "title": "核心观点",
      "points": [
        "AI 发展是平滑的指数曲线",
        "类似摩尔定律的智能增长",
        "没有突然的奇点时刻"
      ],
      "startMs": 50000,
      "durationMs": 6000
    }
  ],

  "socialBars": [
    {
      "platform": "twitter",
      "label": "关注我们",
      "handle": "@ai_research",
      "startMs": 52000,
      "durationMs": 8000
    }
  ]
}

组件参数速查

组件 必需参数 可选参数 说明
人物条 name, role, company, startMs durationMs (默认5s) 显示嘉宾信息
章节标题 number, title, startMs subtitle, durationMs 话题分段
花字 text, startMs, endMs style, position text 必须是短语
名词卡片 chinese, english, firstAppearanceMs description, displayDurationSeconds 术语解释
金句 text, author, startMs durationMs, position 精彩观点
数据 number, label, startMs prefix, unit, durationMs 数字展示
要点 title, points, startMs durationMs 列表总结
社交条 platform, handle, startMs label, durationMs 关注引导

⚠️ 花字使用规范:text 必须是短语(如"AI发展是平滑曲线"),不能是单词(如"人工智能")。单词应使用名词卡片。


🗂️ 项目结构

video-wrapper/
├── 📄 SKILL.md                  # Claude Skill 定义
├── 📄 README.md                 # 本文档
├── 📄 ARCHITECTURE.md           # 详细架构说明
├── 📄 requirements.txt          # Python 依赖
├── 📁 src/                      # 源代码
│   ├── video_processor.py       # 主处理流程
│   ├── browser_renderer.py      # Playwright 渲染器
│   ├── content_analyzer.py      # AI 内容分析
│   ├── fancy_text.py            # PIL 花字渲染
│   ├── term_card.py             # PIL 卡片渲染
│   └── animations.py            # 动画函数库
├── 📁 templates/                # HTML 模板
│   ├── fancy-text.html
│   ├── term-card.html
│   ├── lower-third.html
│   ├── chapter-title.html
│   ├── quote-callout.html
│   ├── animated-stats.html
│   ├── bullet-points.html
│   ├── social-bar.html
│   └── video-config.json.template
└── 📁 static/                   # 静态资源
    ├── css/                     # 主题样式
    │   ├── effects.css
    │   ├── theme-notion.css
    │   ├── theme-cyberpunk.css
    │   ├── theme-apple.css
    │   └── theme-aurora.css
    └── js/
        └── anime.min.js         # 动画引擎

❓ 常见问题

Q: Playwright 安装失败?
# 确保 Python 版本 >= 3.8
pip install playwright
playwright install chromium

# macOS 可能需要移除隔离标记
xattr -r -d com.apple.quarantine ~/.cache/ms-playwright

# 验证安装
playwright --version
Q: 处理速度太慢? **优化建议**: 1. 使用 PIL 渲染器:`-r pil`(效果略简单但速度快 2-3 倍) 2. 降低视频分辨率(从 1080p 降至 720p) 3. 分段处理长视频(每次处理 5-10 分钟) 4. 减少组件数量(只保留必要的)
Q: 内存不足? **解决方案**: 1. 关闭其他应用释放内存 2. 分段处理长视频 3. 使用更低的分辨率(720p 或 480p) 4. 减少同时渲染的组件数量 5. 使用 PIL 渲染器(内存占用更小)
Q: 字体显示异常? 确保系统已安装中文字体:
# macOS - 自带 PingFang SC
# 无需额外安装

# Ubuntu/Debian
sudo apt-get install fonts-noto-cjk

# CentOS/RHEL
sudo yum install google-noto-sans-cjk-fonts

# 验证字体
fc-list :lang=zh
Q: 如何自定义主题? 1. 复制现有主题 CSS 文件 2. 修改 CSS 变量 3. 在配置中指定新主题名 详见 [ARCHITECTURE.md](./ARCHITECTURE.md#添加新主题)

🔧 技术栈

层级 技术 说明
视觉渲染 HTML + CSS + Anime.js 通过 Playwright 浏览器截图
视频合成 MoviePy Python 视频编辑库
动画引擎 Anime.js Spring 物理动画
备用渲染 Python PIL 纯 Python 图像处理
内容分析 AI 分析 自动识别关键信息

详细架构说明请查看 ARCHITECTURE.md


📚 相关资源


🤝 贡献

欢迎提交 Issue 和 Pull Request!

在提交 PR 前,请确保:
- ✅ 代码风格符合项目规范
- ✅ 添加了必要的测试
- ✅ 更新了相关文档


📄 许可证

MIT License


**由 [Claude](https://claude.ai) 强力驱动** 如果觉得有用,请给个 ⭐️ Star!

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.