video-summarizer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Video Summarizer

视频总结工具

Overview

概述

Download videos from any platform and generate a complete resource package including:
  • Original video file (mp4)
  • Audio file (mp3)
  • Subtitle file (with timestamps, vtt/srt format)
  • Summary file (summary.md)
Supports all 1800+ websites supported by yt-dlp.
支持从任意平台下载视频,并生成包含以下内容的完整资源包:
  • 原始视频文件(mp4格式)
  • 音频文件(mp3格式)
  • 字幕文件(带时间戳,vtt/srt格式)
  • 总结文件(summary.md)
支持yt-dlp兼容的所有1800+网站。

Trigger Conditions

触发条件

When the user:
  • Provides a video link and asks for a summary
  • Says "summarize this video", "what's in this video"
  • Asks to "extract video content", "transcribe video"
  • Says "download this video"
  • Provides a link from YouTube/Bilibili/Twitter/Vimeo/TikTok etc.
当用户:
  • 提供视频链接并要求生成总结
  • 说出“总结这个视频”、“这个视频讲了什么”
  • 要求“提取视频内容”、“转录视频”
  • 说出“下载这个视频”
  • 提供来自YouTube/Bilibili/Twitter/Vimeo/TikTok等平台的链接

Supported Platforms

支持的平台

  • YouTube (youtube.com, youtu.be)
  • Bilibili (bilibili.com, b23.tv)
  • Twitter/X (x.com, twitter.com)
  • Vimeo (vimeo.com)
  • TikTok (tiktok.com)
  • Instagram (instagram.com)
  • Twitch (twitch.tv)
  • And 1800+ other platforms (all sites supported by yt-dlp)
  • YouTube (youtube.com, youtu.be)
  • Bilibili (bilibili.com, b23.tv)
  • Twitter/X (x.com, twitter.com)
  • Vimeo (vimeo.com)
  • TikTok (tiktok.com)
  • Instagram (instagram.com)
  • Twitch (twitch.tv)
  • 以及其他1800+平台(所有yt-dlp支持的网站)

Output Structure

输出结构

All files are saved to
downloads/<video-title>/
in the current working directory:
./downloads/
└── <video-title>/
    ├── video.mp4          # Original video
    ├── audio.mp3          # Extracted audio
    ├── subtitle.vtt       # Subtitles with timestamps
    ├── transcript.txt     # Plain text transcript (no timestamps)
    └── summary.md         # Structured summary
所有文件将保存到当前工作目录的
downloads/<video-title>/
路径下:
./downloads/
└── <video-title>/
    ├── video.mp4          # 原始视频
    ├── audio.mp3          # 提取的音频
    ├── subtitle.vtt       # 带时间戳的字幕
    ├── transcript.txt     # 纯文本转录内容(无时间戳)
    └── summary.md         # 结构化总结

Workflow

工作流程

Step 1: Install Dependencies

步骤1:安装依赖

Run the install script to check and install all dependencies:
bash
bash "$SKILL_DIR/scripts/install_deps.sh"
This installs: uv (Python package manager), ffmpeg, yt-dlp, and checks Python version. faster-whisper will be automatically managed by uv.
运行安装脚本检查并安装所有依赖项:
bash
bash "$SKILL_DIR/scripts/install_deps.sh"
该脚本会安装:uv(Python包管理器)、ffmpeg、yt-dlp,并检查Python版本。faster-whisper将由uv自动管理。

Step 2: Get Video Info and Create Output Directory

步骤2:获取视频信息并创建输出目录

bash
undefined
bash
undefined

Get video title (sanitize special characters for folder name)

获取视频标题(清理特殊字符以用作文件夹名称)

TITLE=$(yt-dlp --print "%(title)s" "VIDEO_URL" | sed 's/[/:*?"<>|]/_/g' | cut -c1-80) DURATION=$(yt-dlp --print "%(duration)s" "VIDEO_URL")
TITLE=$(yt-dlp --print "%(title)s" "VIDEO_URL" | sed 's/[/:*?"<>|]/_/g' | cut -c1-80) DURATION=$(yt-dlp --print "%(duration)s" "VIDEO_URL")

Create output directory

创建输出目录

OUTPUT_DIR=./downloads/"$TITLE" mkdir -p "$OUTPUT_DIR"
undefined
OUTPUT_DIR=./downloads/"$TITLE" mkdir -p "$OUTPUT_DIR"
undefined

Step 3: Download Video and Audio

步骤3:下载视频和音频

bash
undefined
bash
undefined

Download video (mp4 format, best quality up to 1080p)

下载视频(mp4格式,最高1080p最佳画质)

yt-dlp -f "bestvideo[height<=1080][ext=mp4]+bestaudio[ext=m4a]/best[height<=1080][ext=mp4]/best"
--merge-output-format mp4
-o "$OUTPUT_DIR/video.%(ext)s" "VIDEO_URL"
yt-dlp -f "bestvideo[height<=1080][ext=mp4]+bestaudio[ext=m4a]/best[height<=1080][ext=mp4]/best"
--merge-output-format mp4
-o "$OUTPUT_DIR/video.%(ext)s" "VIDEO_URL"

Extract audio (mp3 format)

提取音频(mp3格式)

yt-dlp -x --audio-format mp3 -o "$OUTPUT_DIR/audio.%(ext)s" "VIDEO_URL"
undefined
yt-dlp -x --audio-format mp3 -o "$OUTPUT_DIR/audio.%(ext)s" "VIDEO_URL"
undefined

Step 4: Get Subtitles

步骤4:获取字幕

Priority order:
  1. Try downloading manual subtitles (best quality)
bash
yt-dlp --write-subs --sub-lang zh,en,zh-Hans,zh-Hant --skip-download \
  -o "$OUTPUT_DIR/subtitle" "VIDEO_URL"
  1. Try downloading auto-generated subtitles
bash
yt-dlp --write-auto-subs --sub-lang zh,en --skip-download \
  -o "$OUTPUT_DIR/subtitle" "VIDEO_URL"
  1. Use faster-whisper transcription when no subtitles available
bash
uv run "$SKILL_DIR/scripts/parallel_transcribe.py" \
  --input "$OUTPUT_DIR/audio.mp3" \
  --output-dir "$OUTPUT_DIR" \
  --model small \
  --language auto
The script automatically:
  • Splits long audio files at silence points
  • Uses multiple CPU cores for parallel transcription
  • Outputs both
    subtitle.vtt
    and
    transcript.txt
Transcription Options:
OptionDefaultDescription
--model
smalltiny/base/small/medium/large-v3
--language
autoLanguage code or 'auto'
--workers
CPU/2Number of parallel workers
--min-segment
60Min duration (sec) to enable splitting
优先级顺序:
  1. 尝试下载手动添加的字幕(画质最佳)
bash
yt-dlp --write-subs --sub-lang zh,en,zh-Hans,zh-Hant --skip-download \
  -o "$OUTPUT_DIR/subtitle" "VIDEO_URL"
  1. 尝试下载自动生成的字幕
bash
yt-dlp --write-auto-subs --sub-lang zh,en --skip-download \
  -o "$OUTPUT_DIR/subtitle" "VIDEO_URL"
  1. 当无可用字幕时使用faster-whisper进行转录
bash
uv run "$SKILL_DIR/scripts/parallel_transcribe.py" \
  --input "$OUTPUT_DIR/audio.mp3" \
  --output-dir "$OUTPUT_DIR" \
  --model small \
  --language auto
该脚本会自动:
  • 在静音点分割长音频文件
  • 使用多个CPU核心进行并行转录
  • 同时输出
    subtitle.vtt
    transcript.txt
转录选项:
选项默认值描述
--model
smalltiny/base/small/medium/large-v3
--language
auto语言代码或'auto'
--workers
CPU/2并行工作线程数
--min-segment
60启用分割的最小音频时长(秒)

Step 5: Generate Plain Text Transcript

步骤5:生成纯文本转录内容

If subtitles were downloaded (not transcribed), convert to plain text:
bash
if [[ ! -f "$OUTPUT_DIR/transcript.txt" ]]; then
  SUBTITLE_FILE=$(ls "$OUTPUT_DIR"/*.vtt "$OUTPUT_DIR"/*.srt 2>/dev/null | head -1)
  if [[ "$SUBTITLE_FILE" == *.vtt ]]; then
    sed '/^[0-9]/d; /^$/d; /-->/d; /^WEBVTT/d; /^Kind:/d; /^Language:/d; /^NOTE/d' \
      "$SUBTITLE_FILE" > "$OUTPUT_DIR/transcript.txt"
  elif [[ "$SUBTITLE_FILE" == *.srt ]]; then
    sed '/^[0-9]/d; /^$/d; /-->/d' "$SUBTITLE_FILE" > "$OUTPUT_DIR/transcript.txt"
  fi
fi
如果是下载的字幕(而非转录生成),将其转换为纯文本:
bash
if [[ ! -f "$OUTPUT_DIR/transcript.txt" ]]; then
  SUBTITLE_FILE=$(ls "$OUTPUT_DIR"/*.vtt "$OUTPUT_DIR"/*.srt 2>/dev/null | head -1)
  if [[ "$SUBTITLE_FILE" == *.vtt ]]; then
    sed '/^[0-9]/d; /^$/d; /-->/d; /^WEBVTT/d; /^Kind:/d; /^Language:/d; /^NOTE/d' \
      "$SUBTITLE_FILE" > "$OUTPUT_DIR/transcript.txt"
  elif [[ "$SUBTITLE_FILE" == *.srt ]]; then
    sed '/^[0-9]/d; /^$/d; /-->/d' "$SUBTITLE_FILE" > "$OUTPUT_DIR/transcript.txt"
  fi
fi

Step 6: Generate Summary File

步骤6:生成总结文件

  1. Read prompt template from
    $SKILL_DIR/reference/summary-prompt.md
  2. Replace placeholders:
    {{TITLE}}
    ,
    {{PLATFORM}}
    ,
    {{URL}}
    ,
    {{DURATION}}
    ,
    {{LANGUAGE}}
    ,
    {{DOWNLOAD_TIME}}
    ,
    {{TRANSCRIPT}}
  3. Generate summary and save to
    $OUTPUT_DIR/summary.md
  1. $SKILL_DIR/reference/summary-prompt.md
    读取提示模板
  2. 替换占位符:
    {{TITLE}}
    {{PLATFORM}}
    {{URL}}
    {{DURATION}}
    {{LANGUAGE}}
    {{DOWNLOAD_TIME}}
    {{TRANSCRIPT}}
  3. 生成总结并保存到
    $OUTPUT_DIR/summary.md

Platform-Specific Handling

平台专属处理

Bilibili

Bilibili

bash
undefined
bash
undefined

Prioritize Chinese subtitles

优先选择中文字幕

yt-dlp --sub-lang zh-Hans,zh-Hant,zh ...
yt-dlp --sub-lang zh-Hans,zh-Hant,zh ...

If login required

如果需要登录

yt-dlp --cookies-from-browser chrome "VIDEO_URL"
undefined
yt-dlp --cookies-from-browser chrome "VIDEO_URL"
undefined

Platforms Requiring Login

需要登录的平台

bash
yt-dlp --cookies-from-browser chrome "VIDEO_URL"
bash
yt-dlp --cookies-from-browser chrome "VIDEO_URL"

or firefox

或使用firefox

yt-dlp --cookies-from-browser firefox "VIDEO_URL"
undefined
yt-dlp --cookies-from-browser firefox "VIDEO_URL"
undefined

Error Handling

错误处理

Cannot Get Subtitles

无法获取字幕

Use the parallel transcription script (Step 4, option 3).
使用并行转录脚本(步骤4,选项3)。

Video Too Long (>1 hour)

视频过长(超过1小时)

  1. Ask user if they only need partial content
  2. The parallel script handles long files automatically
  1. 询问用户是否只需要部分内容
  2. 并行脚本会自动处理长文件

Unsupported Platform

不支持的平台

bash
yt-dlp --list-extractors | grep -i "platform-name"
bash
yt-dlp --list-extractors | grep -i "platform-name"

Notes

注意事项

  1. Storage: Files saved to
    ./downloads/
    in current working directory
  2. Copyright: For personal learning use only
  3. Network: Some platforms may require proxy
  4. First Run: Whisper model download required (~244MB for small)
  5. Parallel Processing: Long audio (>60s) auto-splits at silence points
  1. 存储:文件保存到当前工作目录的
    ./downloads/
    路径下
  2. 版权:仅用于个人学习使用
  3. 网络:部分平台可能需要使用代理
  4. 首次运行:需要下载Whisper模型(small版本约244MB)
  5. 并行处理:长音频(超过60秒)会自动在静音点分割