subtitle-converterlisted
Install: claude install-skill Matthewyin/CustomSkills
# 字幕格式转换
支持 VTT、SRT、ASS、LRC 四种字幕格式的相互转换,以及时间轴偏移和双语字幕合并功能。
## 支持格式
| 格式 | 用途 | 特点 |
|------|------|------|
| **VTT** | 网络视频(YouTube等) | 支持样式、定位 |
| **SRT** | 通用格式(剪映支持) | 简单、兼容性好 |
| **ASS** | 高级字幕(动画、卡拉OK) | 完整样式控制 |
| **LRC** | 歌词同步 | 行级时间戳 |
## 工作流
### 格式转换
1. 确定源文件格式和目标格式
2. 运行转换脚本:
```bash
python scripts/convert.py <输入文件> --format <目标格式>
```
3. 输出文件默认在同目录,使用 `.srt`/`.vtt` 等扩展名
### 批量转换
1. 确定目标目录和格式
2. 运行批量转换:
```bash
python scripts/convert.py <目录> --batch --format <目标格式>
```
### 时间轴偏移
1. 确定偏移秒数(正数延后,负数提前)
2. 运行偏移命令:
```bash
python scripts/convert.py <文件> --shift <秒数>
```
### 双语字幕合并
1. 准备两个字幕文件(不同语言)
2. 运行合并命令:
```bash
python scripts/convert.py <文件1> <文件2> --merge
```
## 命令参考
```bash
# 格式转换
python scripts/convert.py input.vtt --format srt
python scripts/convert.py input.vtt --output output.srt
# 批量转换
python scripts/convert.py ./subs --batch --format srt
python scripts/convert.py ./subs --batch --format srt --output ./output
# 时间轴偏移
python scripts/convert.py input.srt --shift 2.5 # 延后2.5秒
python scripts/convert.py input.srt --shift -1.0 # 提前1秒
# 双语字幕合并
python scripts/convert.py zh.srt en.srt --merge
python scripts/convert.py zh.srt en.srt --merge --output bilingual.srt
```
## 常见场景
### YouTube VTT 转 剪映 SRT
YouTube 自动生成的 VTT 字幕包含滚动显示和逐词时间戳,转换时会自动清理:
```bash
python scripts/convert.py video.zh-Hans.vtt --format srt
```
### 批量转换目录下的 VTT 文件
```bash
python scripts/convert.py /path/to/subs --batch --format srt
```
###