Communitygithub.com

AragornZJF/video-clip-assistant

基於 FFmpeg 的自動影片剪輯助手,可提取精彩片段、生成字幕、裁剪時長並製作短影片,支援多平台匯出。

video-clip-assistant 是什麼?

Video Clip Assistant 是一款專為開發者與內容創作者設計的 AI 技能,基於 FFmpeg 提供全方位的自動化影片剪輯功能。它能夠根據時間戳精確剪切片段、基於語音辨識(ASR)字幕定位關鍵詞片段、將 SRT 字幕燒錄到影片中,並將影片裁剪為 9:16、1:1、16:9 等多種比例以適應抖音、Instagram、YouTube 等不同平台。此外,它還支援從長影片自動提取高光時刻,並可整合 Whisper 或 FunClip 等 ASR 服務來生成字幕。該技能以 Python 腳本形式運作,適合在命令列環境中使用,特別適合需要批次處理影片、快速產生社群媒體短內容的場景。

相容平台~Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/AragornZJF/skill-tools/tree/HEAD/skills/video-processing/video-clip-assistant

在你喜歡的 AI 中提問

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

說明文件

Video Clip Assistant

影片自動剪輯助手。基於 FFmpeg,提供影片剪切、字幕生成、短影片匯出等功能。

核心能力

  1. 時間軸剪切 — 按時間戳提取片段
  2. 關鍵詞切片 — 基於 ASR 字幕找到關鍵詞對應片段
  3. 字幕燒錄 — SRT 字幕壓制到影片
  4. 短影片匯出 — 裁切為 9:16/1:1/16:9 多比例
  5. 精華提取 — 自動從長影片提取高光片段

快速開始

按時間剪切

python3 scripts/cut_video.py --input video.mp4 --start 10 --duration 30 --output clip.mp4

提取多段

python3 scripts/cut_video.py --input video.mp4 --segments "0-30,60-90,120-150" --output ./clips/

燒錄字幕

python3 scripts/burn_subtitles.py --input video.mp4 --srt subs.srt --output subtitled.mp4

匯出短影片

python3 scripts/export_social.py --input video.mp4 --format vertical --duration 60 --output shorts/

腳本說明

scripts/cut_video.py

按時間軸剪切影片。

python3 scripts/cut_video.py \
  --input <影片檔案> \
  --start <秒> \
  --duration <秒> \
  [--segments "0-30,60-90"] \
  --output <輸出>

scripts/burn_subtitles.py

將 SRT 字幕燒錄到影片。

python3 scripts/burn_subtitles.py \
  --input <影片> \
  --srt <字幕檔案> \
  --output <輸出>

支援字幕位置、字型大小、顏色自訂。

scripts/export_social.py

匯出為多平台適配格式。

python3 scripts/export_social.py \
  --input <影片> \
  --format <vertical|square|horizontal> \
  --duration <秒> \
  --output <輸出目錄>
格式比例用途
vertical9:16抖音/快手/小紅書
square1:1Instagram
horizontal16:9YouTube/B站

scripts/extract_highlights.py

從長影片自動提取精華片段。

python3 scripts/extract_highlights.py \
  --input <影片> \
  --num-clips <片段數> \
  --min-duration <最小秒數> \
  --output <輸出目錄>

使用場景檢測演算法定位精彩切換點。

scripts/generate_subtitles.py

產生 SRT 字幕檔案(需要 ASR 服務)。

python3 scripts/generate_subtitles.py \
  --input <影片> \
  --provider <whisper|funclip> \
  --output <字幕.srt>

典型工作流

工作流1:從會議錄影提取3個精華片段

# 1. 剪切3個片段
python3 scripts/cut_video.py \
  --input meeting.mp4 \
  --segments "300-360,720-780,1200-1260" \
  --output ./clips/

# 2. 分別匯出為抖音格式
for f in ./clips/*.mp4; do
  python3 scripts/export_social.py \
    --input "$f" \
    --format vertical \
    --output ./shorts/
done

工作流2:給影片加上字幕

# 1. 產生字幕
python3 scripts/generate_subtitles.py \
  --input video.mp4 \
  --provider whisper \
  --output video.srt

# 2. 燒錄字幕
python3 scripts/burn_subtitles.py \
  --input video.mp4 \
  --srt video.srt \
  --output subtitled.mp4

工作流3:一鍵產生多個短影片

python3 scripts/export_social.py \
  --input long_video.mp4 \
  --format vertical \
  --duration 60 \
  --output ./shorts/

環境需求

  • 必須:FFmpeg(ffmpeg / ffprobe)
  • 可選:FunClip(阿里開源 ASR 影片剪輯)
  • 可選:Whisper(本地或 API 模式)

安裝參考

# 安裝 FunClip(推薦)
pip install funclip

# 安裝 Whisper
pip install openai-whisper

# FFmpeg(已有)
which ffmpeg  # 應回傳路徑

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

相關技能