Communitygithub.com

1596941391qq/ai-openclaw-skeletons

全栈视频后期製作 Skill:Whisper 轉錄 → auto-editor 去靜音 → ffmpeg 精剪(PIP放大鏡/章節標題/加速/字幕燒錄)→ Remotion 動畫片段 → HyperFrames 品牌影片。適用於教學影片後製、口播去死空氣、宣傳片生成、多平台匯出。

ai-openclaw-skeletons 是什麼?

這是一個全方位影片後期處理的 AI 代理技能,整合六大核心能力,從原始錄影到成品發布全程 AI 驅動。它首先使用 Whisper 進行語音轉字幕(支援中文),接著透過 auto-editor 自動去除靜音段落(jump cut),再以 ffmpeg 實現精細剪輯,包括畫中畫放大鏡、章節標題、加速播放和字幕燒錄。同時支援 Remotion 生成片頭片尾動畫及數據可視化,以及 HyperFrames 製作品牌影片(需 HeyGen API Key)。該技能支援 Windows、macOS 和 Linux 平台,依賴 Python、Node.js 18+ 及 ffmpeg 7.0+。工作流程提供模組化指令碼和範本,適合教學影片、口播錄影、宣傳片等多場景後製,並能針對 YouTube、微信影片號、小紅書等平台最佳化輸出。

相容平台✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/1596941391qq/ai-openclaw-skeletons/tree/HEAD/Packs/video-editor-skill-pack

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Video Editor Full — 全端影片後期 Skill

整合 6 大能力的一站式影片後期製作 Skill。從原始錄影到成品發布,全程 AI 驅動。

能力矩陣

模組工具用途依賴
轉錄Whisper (base/small/medium)語音→字幕 SRTPython + openai-whisper
去靜音auto-editor自動 jump cut 死空氣Python + auto-editor
精剪ffmpeg filter_complexPIP放大鏡、章節標題、加速、drawbox 高亮ffmpeg 7.0+
字幕ffmpeg subtitles filter燒錄 SRT(支援中文雅黑)ffmpeg + 字體
動畫Remotion片頭片尾、數據視覺化、動態圖表Node.js 18+ + Remotion
品牌影片HyperFramesHTML/CSS→影片、AI 數位人Node.js + HeyGen API Key

工作流總覽

┌─────────────┐     ┌──────────────┐     ┌─────────────────┐
│  原始影片    │────▶│  分析 & 轉錄  │────▶│  內容規劃        │
└─────────────┘     └──────────────┘     └─────────────────┘
                                                   │
                    ┌──────────────────────────────┼──────────────────┐
                    ▼                              ▼                  ▼
            ┌──────────────┐            ┌─────────────────┐  ┌──────────────┐
            │ auto-editor  │            │ ffmpeg 精剪      │  │ Remotion     │
            │ 去靜音/jump  │            │ PIP+章節+加速    │  │ 片頭片尾     │
            └──────┬───────┘            └────────┬────────┘  └──────┬───────┘
                   │                             │                   │
                   └─────────────────────────────┼───────────────────┘
                                                 ▼
                                        ┌─────────────────┐
                                        │  字幕燒錄        │
                                        │  + 最終匯出      │
                                        └─────────────────┘

前置條件

# 必需
pip install openai-whisper auto-editor
# ffmpeg 必須在 PATH 中(推薦 7.0+)
ffmpeg -version

# 可選:Remotion(片頭片尾動畫)
npx create-video@latest --blank

# 可選:HyperFrames(品牌影片)
# 需要 HeyGen API Key,見 templates/hyperframes-config.example.json

模組詳解


模組 1:分析 & 轉錄

Step 1: 影片元數據

ffprobe -v quiet -print_format json -show_format -show_streams input.mp4

關注:解析度、幀率、時長、編碼器、位元率。

Step 2: 提取關鍵幀(每 5 秒)

mkdir -p frames
ffmpeg -i input.mp4 -vf "fps=1/5" -q:v 2 frames/frame_%03d.jpg

用視覺分析確定重點 UI 區域、章節邊界、放大鏡目標。

Step 3: Whisper 轉錄

import whisper
model = whisper.load_model("base")  # 中文用 base 即可,medium 更準但慢
result = model.transcribe("audio.wav", language="zh")

輸出 SRT 後必須人工校準:

  • 專有名詞(產品名、技術術語)
  • 時間軸對齊(尤其後半段容易飄移)
  • 同音字錯誤

模組 2:auto-editor 去靜音

# 基礎用法:去掉所有靜音段
auto-editor input.mp4 --margin 0.2s --output no_silence.mp4

# 保守模式:只去超過 1 秒的靜音
auto-editor input.mp4 --min-clip-length 1s --margin 0.3s --output no_silence.mp4

# 導出 timeline(不直接渲染,用於後續 ffmpeg 精剪)
auto-editor input.mp4 --export timeline:api

注意:auto-editor 去靜音後時間軸會變,字幕必須在去靜音之後再生成或重新對齊。

推薦順序:原始影片 → auto-editor → 再轉錄/對齊字幕 → ffmpeg 精剪


模組 3:ffmpeg 精剪(核心)

3.1 PIP 放大鏡(畫中畫)

# 關鍵:crop 區域用 force_original_aspect_ratio 避免拉伸
PIP_W, PIP_H = 300, 188  # 目標 PIP 視窗尺寸

# filter_complex 片段:
# crop → scale(保持比例)→ pad(補黑邊)→ drawbox(黃色邊框)
f"[pip{i}]crop={cw}:{ch}:{cx}:{cy},"
f"scale={PIP_W}:{PIP_H}:force_original_aspect_ratio=decrease,"
f"pad={PIP_W}:{PIP_H}:(ow-iw)/2:(oh-ih)/2:color=0x1a1a2e,"
f"drawbox=x=0:y=0:w={PIP_W}:h={PIP_H}:color=yellow:t=2"
f"[pip{i}s]"

3.2 章節標題(drawtext fade)

# 在章節切換點顯示標題,淡入淡出
f"drawtext=text='{title}':"
f"fontfile='C\\:/Windows/Fonts/msyh.ttc':"
f"fontsize=28:fontcolor=white:borderw=3:[email protected]:"
f"x=(w-text_w)/2:y=30:"
f"alpha='if(lt(t,{start}),0,if(lt(t,{start}+0.4),(t-{start})/0.4,"
f"if(lt(t,{end}-0.4),1,if(lt(t,{end}),({end}-t)/0.4,0))))':"
f"enable='between(t,{fade_in},{fade_out})'"

3.3 加速

# 影片加速
f"[vout]setpts=PTS/{SPEED}[vfinal]"
# 音訊加速(atempo 範圍 0.5-2.0,超過需要鏈式)
f"[0:a]atempo={SPEED}[afinal]"

3.4 字幕時間軸同步

加速後字幕時間碼必須同步調整:

new_start = original_start / SPEED
new_end = original_end / SPEED

3.5 完整構建模板

見 scripts/build_template.py


模組 4:Remotion 動畫片段

適用於生成片頭、片尾、過渡動畫、數據視覺化。

# 初始化 Remotion 專案
npx create-video@latest my-intro --blank

# 在 src/Composition.tsx 中編寫動畫
# 渲染為 MP4
npx remotion render src/index.ts MyComp out/intro.mp4

生成的片段透過 ffmpeg concat 拼接到主影片:

# concat list
echo "file 'intro.mp4'" > list.txt
echo "file 'main.mp4'" >> list.txt
echo "file 'outro.mp4'" >> list.txt
ffmpeg -f concat -safe 0 -i list.txt -c copy final.mp4

Remotion Agent Skill 安裝:

# 官方 skill(推薦)
git clone https://github.com/remotion-dev/skills.git ~/.claude/skills/remotion

模組 5:HyperFrames 品牌影片

將 HTML/CSS/JS 渲染為影片幀,適合品牌宣傳、網站轉影片。

# 安裝
npm install @anthropic-ai/hyperframes

# 基本用法:HTML → MP4
npx hyperframes render --input composition.html --output brand.mp4

需要 HeyGen API Key 才能使用 Avatar 數位人功能。 配置模板見 templates/hyperframes-config.example.json。


模組 6:最終匯出

字幕燒錄(最後一步)

ffmpeg -y -i video_no_sub.mp4 \
  -vf "subtitles='srt_path':force_style='FontSize=13,FontName=Microsoft YaHei,PrimaryColour=&H00FFFFFF,OutlineColour=&H00000000,Outline=2,Shadow=1,MarginV=22,Bold=1'" \
  -c:v libx264 -preset slow -crf 17 \
  -c:a copy -pix_fmt yuv420p -movflags +faststart \
  output.mp4

多平台匯出

平台解析度比例時長限制
YouTube1920x108016:9無
微信影片號1080x19209:1660s(推薦)
小紅書1080x13504:55min
Twitter/X1280x72016:92:20
LinkedIn1920x108016:910min
# 直式裁剪範例(16:9 → 9:16)
ffmpeg -i input.mp4 -vf "crop=ih*9/16:ih,scale=1080:1920" -crf 18 vertical.mp4

品質準則

  1. CRF 17 + slow preset — 教學影片標準品質
  2. yuv420p — 相容所有播放器
  3. faststart — 網路播放秒開
  4. lanczos — 縮放演算法首選
  5. 不超過 2 次編碼 — 避免代際損失
  6. 字幕最後燒 — 確保時間軸對齊

常見坑

  • Windows 路徑在 ffmpeg subtitles filter 中需要 / 且 : 要轉義為 \:
  • Whisper 在 Windows 上必須用 Windows 路徑(不能用 /tmp/)
  • atempo 範圍 0.5-2.0,超過需要鏈式:atempo=2.0,atempo=1.5 = 3x
  • PIP crop 區域和目標視窗比例不一致會拉伸,必須用 force_original_aspect_ratio
  • auto-editor 改變時間軸後,之前的字幕全部失效
  • filter_complex 太長不能命令列傳,用 -filter_complex_script 寫檔案

檔案結構

video-editor-skill-pack/
├── SKILL.md                          # 本檔案
├── scripts/
│   ├── build_template.py             # ffmpeg 精剪構建模板
│   ├── transcribe.py                 # Whisper 轉錄腳本
│   ├── adjust_srt_speed.py           # SRT 時間軸加速調整
│   └── analyze_frames.py             # 關鍵幀提取 + 分析
├── templates/
│   ├── hyperframes-config.example.json
│   └── remotion-intro/               # Remotion 片頭模板(待填充)
└── examples/
    └── tutorial-video-workflow.md     # 教學影片完整工作流範例

相關技能