短影音產出管線
YouTube 影片 → 病毒式短影音(TikTok、Reels、Shorts)。
前置需求
pip install -r "D:/AI Store/digital-marketing-repos/ai-marketing-skills/requirements.txt"
# 需要 yt-dlp + ffmpeg
使用方式
完整管線(基於 Claude 的分段)
python "D:/AI Store/digital-marketing-repos/ai-marketing-skills/short-form-pipeline/scripts/shortform_pipeline.py" \
--url "https://www.youtube.com/watch?v=VIDEO_ID" \
--max-clips 3 \
--output-dir ./output
獨立剪輯器(無需 Claude,使用啟發式評分)
python "D:/AI Store/digital-marketing-repos/ai-marketing-skills/short-form-pipeline/scripts/video_clipper.py" \
--url "https://www.youtube.com/watch?v=VIDEO_ID"
管線步驟
- 下載 — yt-dlp 取得影片 + VTT 字幕
- 轉錄 — Whisper 逐字時間戳
- 分段 — Claude 挑選 2-5 個最佳 30-60 秒片段(鉤子評分 ≥ 7/10)
- 剪輯 — FFmpeg 提取片段
- 直立裁切 — 佈局感知的 16:9 → 9:16(使用 MediaPipe 進行人臉偵測)
- 字幕嵌入 — TikTok 風格逐字高亮字幕
佈局類型(自動偵測)
| 佈局 | 策略 |
|---|---|
| talking_head | 以人臉為中心的裁切 |
| screen_share_overlay | 螢幕在上,網路攝影機在下 |
| side_by_side | 螢幕疊在上方,人臉在下方 |
| gallery_view | 活躍說話者四分格 |
輸出
- 1080×1920(9:16 直立)
- H.264 + AAC
- 逐字高亮字幕
- 可直接用於 TikTok/Reels/Shorts
小提醒
- FFmpeg 錯誤:不要在使用
-filter_complex時加上-c:v copy - 字幕同步:請對剪輯後的影片執行 Whisper,而非原始來源
- 超長片段:超過 90 秒會自動修剪至 75 秒
- 需要設定
ANTHROPIC_API_KEY環境變數才能使用 AI 分段功能