[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-84047":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":9,"rankLanguage":9,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":9,"pushedAt":9,"updatedAt":25,"readmeContent":26,"aiSummary":9,"trendingCount":15,"starSnapshotCount":15,"syncStatus":13,"lastSyncTime":27,"discoverSource":28},84047,"xiaohu-video-translate","xiaohuailabs\u002Fxiaohu-video-translate","xiaohuailabs","对 AI 说一句话，把外语视频自动配上中文字幕 —— 下载\u002F转写\u002F翻译\u002F润色\u002F烧录一条龙，全程本地，转写零 API 费",null,"Python",461,71,2,6,0,32,406,470,5.57,"MIT License",false,"main",true,[],"2026-06-12 02:04:37","# xiaohu-video-translate\n\n> 一句话把外语视频变成**带中文字幕的视频 + 中文文稿**。下载、转写、翻译、润色、烧录，一条龙跑完，全程本地，转写不花一分钱 API 费。\n> One sentence turns a foreign-language video into a **Chinese-subtitled video + a clean transcript**. Download → transcribe → translate → polish → burn-in, end to end, all local, zero transcription API cost.\n\n**语言 \u002F Language:** [中文](#中文) ｜ [English](#english)\n\n这是一套 AI 编程命令行工具用的**技能（Skills）**。它本质是「脚本 + 一份说明书」，**不绑死任何一家**：[Claude Code](https:\u002F\u002Fclaude.com\u002Fclaude-code)、OpenClaw（小龙虾）、Gemini CLI、Codex 都能用。装好后你不用记任何命令，直接说一句「把这个链接翻译成中文字幕视频」，剩下的它全自动做完。\n\n---\n\n## 中文\n\n### 一条龙工作流\n\n它把原本要开四五个软件、来回折腾一两个小时的活，串成一条全自动流水线：\n\n```\n视频链接\u002F本地文件\n      │\n      ▼\n  ① 下载  ──►  ② 提取音频 + Whisper 转写  ──►  ③ 翻译  ──►  ④ 润色  ──►  ⑤ 烧录字幕\n      │                  （词级时间戳）          （任意外语→中文）  （断句\u002F去标点\u002F对轴）      │\n      │                                                                                ▼\n      └──────────────────────────────────────────────►  带中文字幕的视频 + Markdown 文稿\n```\n\n你只管说一句话，五步它自己走完。中间任何一步要调整（双语、不要水印、快速模式），对它说就行。\n\n### 支持多语种\n\n不挑语言。**英语、日语、韩语、法语、西班牙语……只要 Whisper 听得懂的，都能转成中文字幕。** Whisper 自动识别原语种，翻译环节把任意外语翻成中文。中文视频则只做转写和文稿，不走翻译。\n\n### 字幕两种选\n\n- **纯中文**：画面干净\n- **中英双语**：中文大、英文小，主次分明（用真正的 ASS 字幕做字号反差，SRT 做不到这个），适合顺便练听力\n\n### 为什么用它\n\n- **本地、免费、能离线**：转写用 [Whisper](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fwhisper)（苹果芯片走 MLX + Metal GPU 加速），在你电脑里完成，不上传、不收费。翻译复用你已经在用的 AI，不用再单独买翻译 API。\n- **时间戳是真的准**：拿词级时间戳按「句子 + 停顿」切分，字幕不会跑在说话人前面，也不会半句甩到下一条。\n- **字幕是给人看的**，不是机翻直出：自动纠正转写听错的专有名词（Claude 常被听成 cloud、MCP 被听成 NCP），按语义断句，术语保留英文。\n- **烧字幕 + 水印一次编码完成**，不掉画质。\n\n### 它其实是三个技能\n\n| 技能 | 职责 |\n|------|------|\n| **xiaohu-video-md** | 总指挥。下载 \u002F 提音频 \u002F Whisper 转写 \u002F 调用润色 \u002F 烧字幕 \u002F 出 Markdown |\n| **xiaohu-subtitle-polish** | 字幕翻译与润色。纠错、翻译、断句、去标点、时间戳对齐、双语 ASS |\n| **xiaohu-video-download** | 纯下载工具。下视频 \u002F 下音频 \u002F 下播放列表 \u002F 给本地视频烧字幕 |\n\n翻译管线由 `xiaohu-video-md` 总调度，翻译那一步它自己会去叫 `xiaohu-subtitle-polish`。三个技能各自独立，也可单独用。\n\n### 演示案例\n\n同一段 a16z 英文访谈，翻成中 \u002F 日 \u002F 韩 \u002F 阿 \u002F 法 5 种语言的双语字幕——各语种译文在上、英文原文在下，从右往左书写的阿拉伯语也排得整整齐齐：\n\n![多语言双语字幕对比](assets\u002Fdemo-multilang.jpg)\n\n烧进画面后的中英双语字幕（中文大、英文小，贴底不挡人）：\n\n![中英双语字幕实拍](assets\u002Fdemo-bilingual.jpg)\n\n### 支持哪些 AI 编程工具\n\n核心是脚本 + 说明书（每个技能的 `SKILL.md`），**任何能读技能\u002F指令文件、又能跑命令的 AI 编程工具都能驱动它**。各家加载方式不同：\n\n- **Claude Code**：原生技能。`install.sh` 直接把三个技能装进 `~\u002F.claude\u002Fskills\u002F`\n- **OpenClaw（小龙虾）**：同样是技能制，按它的 `openclaw skills` 方式装入即可\n- **Gemini CLI**：仓库自带 `gemini-extension.json`，作为 extension 加载\n- **Codex 等其他**：把对应技能的 `SKILL.md` 喂给它当规则，让它照着调用 `scripts\u002F` 里的脚本；或者直接手动跑脚本\n\n下面的安装步骤以 Claude Code 为例，其他工具把\"复制到 `~\u002F.claude\u002Fskills\u002F`\"换成各自的技能目录即可。\n\n### 安装\n\n#### 一、macOS（最顺，尤其是 Apple Silicon）\n\n```bash\n# 1. 基础工具（没装 Homebrew 先去 brew.sh 装）\nbrew install yt-dlp ffmpeg\n\n# 2. 转写引擎（Apple Silicon 选 mlx-whisper，走 GPU 加速最快）\npip3 install --break-system-packages mlx-whisper\n# 非 Apple Silicon 的 Mac 用兜底引擎：\n# pip3 install --break-system-packages faster-whisper\n\n# 3. 装技能\ngit clone https:\u002F\u002Fgithub.com\u002Fxiaohuailabs\u002Fxiaohu-video-translate.git\ncd xiaohu-video-translate\nbash install.sh\n```\n\n然后在 `~\u002F.claude\u002Fskills\u002Fxiaohu-video-md\u002Fconfig.json` 把 `output_dir` 改成你的绝对路径。MLX 模型首次运行会自动从 HuggingFace 下载（约 1.5GB），**不用手动下载**。\n\n> `whisper-cpp` 是个**可选的备份转写引擎**，默认走 mlx-whisper \u002F faster-whisper 就不用装它。只有想用 whisper-cli（纯转文字最快）时才 `brew install whisper-cpp`，并把 ggml 模型下到 `~\u002F.cache\u002Fwhisper-cpp\u002F`（命令见各技能的 `初始化.md`）。\n\n#### 二、Windows\n\n这套工具是按 Mac 调的，Windows 上能跑，但有**三处真实区别**，别照搬 Mac 步骤。\n\n**最省事：用 WSL（Windows 里的 Linux 子系统）。** 装好 WSL2 + Ubuntu 后，基本等同 Linux：\n\n```bash\nsudo apt update && sudo apt install -y ffmpeg\npip3 install yt-dlp faster-whisper        # Windows 没有 Apple GPU，用 faster-whisper\ngit clone https:\u002F\u002Fgithub.com\u002Fxiaohuailabs\u002Fxiaohu-video-translate.git\ncd xiaohu-video-translate && bash install.sh\n```\n\n**原生 Windows（不用 WSL）要注意三点：**\n\n1. **转写引擎用 faster-whisper**，不要装 mlx-whisper（MLX 只支持苹果芯片）。脚本检测到没有 MLX 会自动降级到 faster-whisper：\n   ```powershell\n   pip install yt-dlp faster-whisper\n   winget install Gyan.FFmpeg        # 或用 scoop \u002F choco 装 ffmpeg\n   ```\n2. **`install.sh` 是 bash 脚本**，原生 Windows 用 Git Bash 跑，或者手动把 `skills\u002F` 下三个文件夹复制到你的工具技能目录，再把每个 `config.example.json` 复制成 `config.json`。\n3. **烧字幕的中文字体要换**：脚本里默认用 Mac 的苹方（PingFang SC）。Windows 上没有这个字体，中文会显示成方块。把烧录命令里的 `FontName=PingFang SC` 换成 `FontName=Microsoft YaHei`（微软雅黑，Windows 自带），水印字体路径换成 Windows 字体（如 `C:\u002FWindows\u002FFonts\u002Fmsyh.ttc`）。\n\n> 字体这一条对 Linux 也一样：Linux 没有苹方，需要装并改用 Noto Sans CJK 之类的中文字体。\n\n#### 三、Linux\n\n跟 Windows 的 WSL 步骤一致：`apt install ffmpeg` + `pip install yt-dlp faster-whisper`，烧字幕时把字体换成系统自带的中文字体（如 Noto Sans CJK）。\n\n> 想让烧字幕在 Windows \u002F Linux 上**自动选对字体、开箱即用**？欢迎提 issue，这块正在做跨平台适配。\n\n### 怎么用\n\n装好后**重启你的 AI 编程工具**，然后用大白话说：\n\n| 你说的话 | 它做的事 |\n|---------|---------|\n| `把这个链接翻译成中文字幕视频 https:\u002F\u002Fyoutu.be\u002Fxxxx` | 全流程：下载→转写→翻译→烧字幕→出文稿 |\n| `翻译这个日语视频，要中英双语字幕 https:\u002F\u002F...` | 同上，多语种源，双语字幕 |\n| `把这个视频转成文字 https:\u002F\u002F...` | 只出 Markdown 文稿，不烧字幕 |\n| `给我本地这个视频加中文字幕 ~\u002FMovies\u002Ftalk.mp4` | 本地文件直接处理 |\n| `下载这个视频 https:\u002F\u002F...` | 只下载视频 + 外挂字幕 |\n| `用快速模式转写 https:\u002F\u002F...` | 换更快但略低精度的模型 |\n| `翻译时不要水印` | 关掉水印 |\n\n抖音视频第一次用要先登录一次：运行一次 `python3 ~\u002F.claude\u002Fskills\u002Fxiaohu-video-md\u002Fscripts\u002Fdouyin_login.py`，弹出的浏览器里扫码登录，登录态只存在你本机。\n\n### 常见问题\n\n- **YouTube 下载报 403 \u002F SABR \u002F PO Token？** 脚本会自动从浏览器读 cookies 重试（默认 Chrome）。还不行就挂代理：给脚本加 `--proxy http:\u002F\u002F127.0.0.1:7890`。\n- **烧出来的中文字幕是方块？** 多半是字体问题：macOS 用苹方，Windows 改微软雅黑，Linux 改 Noto Sans CJK（见上方安装说明）。\n- **字幕跑在说话人前面 \u002F 半句挤一起？** 本工具用词级时间戳按句子和停顿切，正常不会；个别片段不对多半是 BGM 太响导致 Whisper 误判，可要求重转。\n- **抖音报未登录？** 重跑一次 `douyin_login.py`。\n\n### License\n\n[MIT](.\u002FLICENSE)。字幕样式、水印默认值随意改。注意：**不要把你自己的 `config.json` 或抖音登录态提交到任何公开仓库**（`.gitignore` 已默认排除）。\n\n---\n\n## English\n\nA set of **Skills** for AI coding CLIs that turn any foreign-language video into a Chinese-subtitled video plus a clean transcript — download, transcribe, translate, polish, and burn-in, end to end. It's just scripts + a skill instruction file, **not locked to any single tool**: [Claude Code](https:\u002F\u002Fclaude.com\u002Fclaude-code), OpenClaw, Gemini CLI, Codex all work.\n\n### End-to-end pipeline\n\n```\nvideo URL \u002F local file\n        │\n        ▼\n  ① download → ② audio + Whisper transcribe → ③ translate → ④ polish → ⑤ burn-in subtitles\n                   (word-level timestamps)    (any language→中文)  (line-break\u002Falign)      │\n        │                                                                                  ▼\n        └────────────────────────────────────────►  Chinese-subtitled video + Markdown transcript\n```\n\n### Multi-language\n\nNot English-only. **English, Japanese, Korean, French, Spanish… anything Whisper can hear gets translated into Chinese.** Whisper auto-detects the source language; the polishing step translates any of them into Chinese.\n\n### Why\n\n- **Local, free, offline-capable.** Transcription runs on [Whisper](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fwhisper) (MLX + Metal GPU on Apple Silicon); translation reuses the AI you already have. No paid transcription\u002Ftranslation API.\n- **Accurate timestamps** — word-level, cut by sentence + pause, so subtitles don't run ahead of the speaker.\n- **Human-grade subtitles** — fixes ASR mishears, breaks lines by meaning, keeps technical terms in English. Bilingual mode uses real ASS for a true size contrast (Chinese large, English small).\n- **Burn-in + watermark in one encode.**\n\n### The three skills\n\n| Skill | Role |\n|-------|------|\n| **xiaohu-video-md** | Orchestrator: download \u002F audio \u002F Whisper \u002F call the polisher \u002F burn-in \u002F Markdown |\n| **xiaohu-subtitle-polish** | Subtitle translation & polishing: fixes, translation, line-breaking, timestamp alignment, bilingual ASS |\n| **xiaohu-video-download** | Pure downloader: video \u002F audio \u002F playlists \u002F burn subs onto a local file |\n\n### Demo\n\nOne a16z English talk, subtitled into 5 languages — Chinese \u002F Japanese \u002F Korean \u002F Arabic \u002F French — each translation on top, the English original below. Even right-to-left Arabic lines up cleanly:\n\n![Multi-language bilingual subtitles](assets\u002Fdemo-multilang.jpg)\n\nBurned into the frame (Chinese large, English small, pinned to the bottom):\n\n![Bilingual subtitles in a real video](assets\u002Fdemo-bilingual.jpg)\n\n### Which AI coding tools\n\nThe core is scripts + a `SKILL.md` per skill — **any agent that can read a skill\u002Finstruction file and run shell commands can drive it.** Loading differs per tool:\n\n- **Claude Code** — native skills; `install.sh` drops them into `~\u002F.claude\u002Fskills\u002F`\n- **OpenClaw** — also skill-based; install via its `openclaw skills`\n- **Gemini CLI** — a `gemini-extension.json` is included\n- **Codex & others** — feed the `SKILL.md` as instructions and let it call the `scripts\u002F`, or run the scripts directly\n\n### Install\n\n**macOS (best, especially Apple Silicon):**\n\n```bash\nbrew install yt-dlp ffmpeg\npip3 install --break-system-packages mlx-whisper   # or faster-whisper on non-Apple-Silicon\ngit clone https:\u002F\u002Fgithub.com\u002Fxiaohuailabs\u002Fxiaohu-video-translate.git\ncd xiaohu-video-translate && bash install.sh\n```\n\n**Windows** — this project is tuned for Mac. Easiest path is **WSL2 + Ubuntu**, then it behaves like Linux. For native Windows, three differences:\n\n1. Use **faster-whisper**, not mlx-whisper (MLX is Apple-Silicon-only; the script auto-falls-back): `pip install yt-dlp faster-whisper` + `winget install Gyan.FFmpeg`\n2. `install.sh` is bash — run it under Git Bash, or manually copy the three `skills\u002F` folders into your tool's skill directory and copy each `config.example.json` to `config.json`\n3. Swap the burn-in font: change `FontName=PingFang SC` to `FontName=Microsoft YaHei`, and the watermark font path to a Windows font (e.g. `C:\u002FWindows\u002FFonts\u002Fmsyh.ttc`)\n\n**Linux** — same as WSL: `apt install ffmpeg` + `pip install yt-dlp faster-whisper`, and use a CJK font (e.g. Noto Sans CJK) for burn-in.\n\nThen set `output_dir` (absolute path) in `~\u002F.claude\u002Fskills\u002Fxiaohu-video-md\u002Fconfig.json`. The MLX model auto-downloads on first run — no manual download needed.\n\n> `whisper-cpp` is an **optional fallback engine**; the default mlx-whisper \u002F faster-whisper path doesn't need it. Only `brew install whisper-cpp` (and download the ggml models to `~\u002F.cache\u002Fwhisper-cpp\u002F`) if you specifically want whisper-cli for fastest text-only transcription.\n\n### Usage\n\nRestart your AI tool, then just say:\n\n- *\"Translate this link into a Chinese-subtitled video: https:\u002F\u002Fyoutu.be\u002Fxxxx\"*\n- *\"Translate this Japanese video with bilingual subtitles: https:\u002F\u002F...\"*\n- *\"Just transcribe this to text: https:\u002F\u002F...\"*\n- *\"Add Chinese subtitles to my local file ~\u002FMovies\u002Ftalk.mp4\"*\n\n### License\n\n[MIT](.\u002FLICENSE). Don't commit your own `config.json` or any Douyin login state to a public repo (already excluded by `.gitignore`).\n","2026-06-11 04:12:10","CREATED_QUERY"]