subtitle-tools v1.0.0 — 字幕处理（格式互转 / 时间轴 / 双语 / 清洗）
================================================================

纯本地运行：**不联网、不需要 API Key、不用装任何第三方库**。
有 Python 3 就能跑，只用标准库 —— srt / vtt / ass 都是纯文本格式。

目录结构
--------
  SKILL.md            给 AI 看的使用说明（装到 WorkBuddy / CodeBuddy 的 skills 目录即可）
  scripts/sub.py      主脚本
  README.txt          本文件

最快上手
--------
  # 1) 先体检（只读，不改文件）
  python scripts/sub.py info 字幕.srt

  # 2) 预览会怎么改
  python scripts/sub.py shift 字幕.srt --by +2.5 --out 新.srt

  # 3) 真的写盘
  python scripts/sub.py shift 字幕.srt --by +2.5 --out 新.srt --apply

常用命令
--------
  # ass 转 srt
  python scripts/sub.py convert 字幕.ass --to srt --out 字幕.srt --apply

  # 整体延后 2.5 秒 / 提前 1.2 秒 / 精确毫秒
  python scripts/sub.py shift 字幕.srt --by +2.5 --out 新.srt --apply
  python scripts/sub.py shift 字幕.srt --by -1.2s --out 新.srt --apply
  python scripts/sub.py shift 字幕.srt --by 1500ms --out 新.srt --apply

  # 23.976fps 的字幕配 25fps 视频（会算倍率）
  python scripts/sub.py scale 字幕.srt --fps-from 23.976 --fps-to 25 --out 新.srt --apply

  # 双语合并（中文在上、英文在下）
  python scripts/sub.py merge 中文.srt 英文.srt --out 双语.srt --apply

  # 删广告语 / 去样式标签 / 补最短时长
  python scripts/sub.py clean 字幕.srt --remove "字幕组" --min-duration 0.7 \
    --out 干净.srt --apply

  # 切一段并把时间轴归零
  python scripts/sub.py slice 字幕.srt --start 00:01:30 --end 00:05:00 \
    --rewind --out 片段.srt --apply

  # 提取纯文本（送去翻译）
  python scripts/sub.py convert 字幕.srt --to txt --out 台词.txt --apply

编码
----
  * 输入编码自动兜底：utf-8-sig → utf-8 → gb18030 → big5 依次试，老字幕不用管
  * 输出默认 utf-8；要给老设备可加 --out-encoding gb18030，或加 --bom

安全
----
  * 不加 --apply 就只是预览，一个文件都不写
  * 结果一律写到 --out，**不会覆盖输入字幕**

已知边界
--------
  * 只处理文本和时间轴：ASS 的样式 / 字体 / 颜色 / 位置 / 特效会被剥掉
  * 不支持图形字幕（.sup / .idx / 蓝光 PGS）—— 那是图片，要 OCR
  * 不翻译、不做语音识别，只搬移和调整已有字幕
  * 双语合并按时间重叠配对，两份时间轴差太多会配对错，先各自 shift 对齐

全部参数见 SKILL.md，或运行：
  python scripts/sub.py info --help
  python scripts/sub.py clean --help

有问题 / 要定制 / 想找人做
--------------------------
  加微信：zip678972
  墨屿 MOYU · https://888888888888.top
