garroshub/MixCut-Skill / skills
youtube-clipper
VerifiedYouTube 视频智能剪辑工具。下载视频和字幕,AI 分析生成精细章节(几分钟级别), 用户选择片段后自动剪辑、翻译字幕为中英双语、烧录字幕到视频,并生成总结文案。 使用场景:当用户需要剪辑 YouTube 视频、生成短视频片段、制作双语字幕版本时。 关键词:视频剪辑、YouTube、字幕翻译、双语字幕、视频下载、clip video
| File | Kind | Size |
|---|---|---|
| .env.example | other | 2.8 KB |
| .github/REPOSITORY_SETTINGS.md | markdown | 1.4 KB |
| .gitignore | other | 372 B |
| FIXES_AND_IMPROVEMENTS.md | markdown | 8.0 KB |
| LICENSE | other | 1.0 KB |
| README.md | markdown | 8.4 KB |
| README.zh-CN.md | markdown | 7.8 KB |
| SKILL.md | skill md | 10.6 KB |
| TECHNICAL_NOTES.md | markdown | 11.3 KB |
| install_as_skill.sh | script | 6.8 KB |
| references/ffmpeg-guide.md | markdown | 3.4 KB |
| references/subtitle-formatting.md | markdown | 7.7 KB |
| references/yt-dlp-guide.md | markdown | 6.3 KB |
| scripts/__init__.py | script | 128 B |
| scripts/analyze_subtitles.py | script | 8.2 KB |
| scripts/burn_subtitles.py | script | 8.5 KB |
| scripts/clip_video.py | script | 7.4 KB |
| scripts/download_video.py | script | 6.6 KB |
| scripts/extract_subtitle_clip.py | script | 3.6 KB |
| scripts/generate_summary.py | script | 6.1 KB |
| scripts/merge_bilingual_subtitles.py | script | 2.2 KB |
| scripts/translate_subtitles.py | script | 6.9 KB |
| scripts/utils.py | script | 8.0 KB |
references/ffmpeg-guide.md
View on GitHub# FFmpeg 使用指南
FFmpeg 是一个强大的多媒体处理工具,本文档介绍在 YouTube Clipper 中使用的核心命令。
## 安装
### macOS
```bash
# 标准版本(不支持字幕烧录)
brew install ffmpeg
# 完整版本(推荐,支持字幕烧录)
brew install ffmpeg-full
```
### Linux (Ubuntu/Debian)
```bash
sudo apt-get update
sudo apt-get install ffmpeg libass-dev
```
### 验证安装
```bash
# 检查版本
ffmpeg -version
# 检查 libass 支持(字幕烧录必需)
ffmpeg -filters 2>&1 | grep subtitles
```
## 常用命令
### 1. 剪辑视频
```bash
# 精确剪辑(从 30 秒开始,持续 60 秒)
ffmpeg -ss 30 -i input.mp4 -t 60 -c copy output.mp4
# 从 01:30:00 到 01:33:15
ffmpeg -ss 01:30:00 -i input.mp4 -to 01:33:15 -c copy output.mp4
```
**参数说明**:
- `-ss`: 起始时间
- `-i`: 输入文件
- `-t`: 持续时间
- `-to`: 结束时间
- `-c copy`: 直接复制流,不重新编码(快速且无损)
### 2. 烧录字幕
```bash
# 烧录 SRT 字幕到视频
ffmpeg -i input.mp4 \
-vf "subtitles=subtitle.srt" \
-c:a copy \
output.mp4
# 自定义字幕样式
ffmpeg -i input.mp4 \
-vf "subtitles=subtitle.srt:force_style='FontSize=24,MarginV=30'" \
-c:a copy \
output.mp4
```
**注意**:
- 需要 libass 支持
- 路径不能包含空格(使用临时目录解决)
- 视频会重新编码(比剪辑慢)
### 3. 视频压缩
```bash
# 使用 H.264 压缩
ffmpeg -i input.mp4 \
-c:v libx264 \
-crf 23 \
-c:a aac \
output.mp4
```
**CRF 值**:
- 18: 高质量,文件较大
- 23: 平衡(推荐)
- 28: 低质量,文件较小
### 4. 提取音频
```bash
# 提取为 MP3
ffmpeg -i input.mp4 -vn -acodec libmp3lame -q:a 2 output.mp3
# 提取为 AAC
ffmpeg -i input.mp4 -vn -c:a copy output.aac
```
### 5. 视频信息
```bash
# 查看视频详细信息
ffmpeg -i input.mp4
# 查看简洁信息
ffprobe -v error -show_format -show_streams input.mp4
```
## 字幕相关
### 烧录双语字幕
```bash
# 双语字幕(每条字幕包含两行)
ffmpeg -i input.mp4 \
-vf "subtitles=bilingual.srt:force_style='FontSize=24,MarginV=30'" \
-c:a copy \
output.mp4
```
### 调整字幕样式
可用样式选项:
- `FontSize`: 字体大小(推荐 20-28)
- `MarginV`: 垂直边距(推荐 20-40)
- `FontName`: 字体名称
- `PrimaryColour`: 主要颜色
- `OutlineColour`: 描边颜色
- `Bold`: 粗体(0 或 1)
示例:
```bash
subtitles=subtitle.srt:force_style='FontSize=28,MarginV=40,Bold=1'
```
## 性能优化
### 硬件加速
```bash
# macOS (VideoToolbox)
ffmpeg -hwaccel videotoolbox -i input.mp4 ...
# NVIDIA GPU
ffmpeg -hwaccel cuda -i input.mp4 ...
```
### 多线程
```bash
# 使用 4 个线程
ffmpeg -threads 4 -i input.mp4 ...
```
## 常见问题
### Q: 字幕烧录失败,提示 "No such filter: 'subtitles'"
A: FFmpeg 没有 libass 支持。macOS 需要安装 `ffmpeg-full`。
### Q: 路径包含空格导致字幕烧录失败
A: 使用临时目录,将文件复制到无空格路径再处理。
### Q: 视频质量下降
A: 使用 `-c copy` 直接复制流,或降低 CRF 值(如 18)。
### Q: 处理速度慢
A:
- 使用硬件加速 (`-hwaccel`)
- 剪辑时使用 `-c copy`
- 增加线程数 (`-threads`)
## 参考链接
- [FFmpeg 官方文档](https://ffmpeg.org/documentation.html)
- [FFmpeg Wiki](https://trac.ffmpeg.org/wiki)
- [Subtitles 滤镜文档](https://ffmpeg.org/ffmpeg-filters.html#subtitles)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |