可續跑的影片翻譯/中文配音 CLI 管線。 正式支援:單一 repo +
uv sync --extra all,提供 CLI、本地 ASR、Gemini 翻譯與 VoxCPM 路線。 OmniVoice 已改為 repo 內建程式碼 + 獨立 Python 環境 的可選路線,請用dub bootstrap-omnivoice建立。
uv sync --extra all
uv run dub doctor
uv run dub auto talk.mp4上面三行就是目前的 canonical operator flow:
uv sync --extra all:建立標準執行環境uv run dub doctor:先確認 EN / JA 路線是否就緒uv run dub auto talk.mp4:正式的一鍵入口
- 先做 30 秒音訊探針
- 自動判斷來源語言是 英文 或 日文
- 自動選擇 EN→ZH 或 JA→ZH 路線
- 建立
<video-stem>.dub/專案目錄並執行整條 pipeline
uv run dub auto talk.mp4
uv run dub auto talk.mp4 --source-lang en
uv run dub auto anime.mp4 --source-lang ja
uv run dub resume --project-dir /path/to/project
uv run dub status --project-dir /path/to/project
uv run dub validate --project-dir /path/to/projectdub auto的支援範圍目前是 英文 / 日文 → 中文- 若自動判斷不夠明確,CLI 會要求你改用
--source-lang en|ja --source-lang明確指定時,永遠優先於自動偵測dub en2zh/dub ja2zh是語言專用別名;dub run是進階 escape hatch
更完整的逐步說明請看 QUICKSTART.md。
dub auto 預設執行 30 秒音訊探針,自動判斷來源語言(英文或日文)再選擇對應路線;明確的 --source-lang en|ja 永遠優先,會印出 route_basis=override:explicit-flag 供審計。
dub en2zh / dub ja2zh 是明確的語言專用別名,內部與 dub auto 共用同一套 staged pipeline 合約。
dub run 保留作為需要明確控制的進階 escape hatch。
- CLI 與設定載入
- 專案狀態管理與重跑控制
- 管線腳本(
vendor/pipeline_scripts/) - Gemini 翻譯邏輯
- 內建 ASR(
src/qwenasr_mlx_cli/) - OmniVoice 轉接層與內嵌模型程式碼(
src/omnivoice/) - VoxCPM 轉接層
ffmpeg/ffprobe- Gemini API key
- VoxCPM 路線:先執行
uv run dub bootstrap-voxcpm建立 / 更新專用 interpreter,再用uv run dub doctor確認ja2zhlane readiness - 若
dub doctor顯示voxcpme service缺失,請依docs/operator-runbook.md啟動本機 VoxCPM 服務 - OmniVoice(若要使用;由
dub bootstrap-omnivoice自動建立專用環境)
git clone https://codeberg.org/killkli/video-dub-cli
cd video-dub-cliuv sync --extra all這會建立 .venv/,並安裝 dub CLI、本地 ASR 依賴、Gemini 翻譯依賴與標準 VoxCPM route 依賴。
# macOS
brew install ffmpeg
# Debian / Ubuntu
sudo apt-get install -y ffmpegexport GOOGLE_API_KEY=your_g..._key或:
cp .env.example .env
# 編輯 .env 後載入
set -a; source .env; set +auv run dub --help
uv run dub doctordub doctor 會報告 lane-aware readiness:雙路都可用時顯示 ready for dub auto, dub en2zh, dub ja2zh;若只剩單一路徑可用,會分別列出 ready / blocked lanes 與缺少項目。
uv run dub auto talk.mp4 # 自動偵測英文或日文,30 秒探針後選路
uv run dub auto talk.mp4 --source-lang en # 明確指定英文→中文(override 自動偵測)
uv run dub auto anime.mp4 --source-lang ja # 明確指定日文→中文(override 自動偵測)uv run dub en2zh talk.mp4 # 英文→中文,明確別名
uv run dub ja2zh anime.mp4 # 日文→中文,明確別名uv run dub auto talk.mp4 \
--translate-mode use-existing \
--translated-srt talk.zhtw.srtuv run dub run talk.mp4 --source-lang en --target-lang zh --config ~/.config/dub/config.yamldub run 保留用於需要明確覆寫 pipeline 參數的進階情境,常見 operator 情境應使用 dub auto 或 en2zh/ja2zh 別名。
uv run dub resume --project-dir /path/to/project
uv run dub status --project-dir /path/to/project
uv run dub validate --project-dir /path/to/project
uv run dub clean --project-dir /path/to/project目前檢查:
ffmpeg/ffproberepo_pipeline_scriptsgemini_api_key- Python 依賴:
qwen3_asr_mlx,soundfile,pydub,silero_vad,google_genai,torchcodec tts_backends.omnivoice(wrapper / interpreter / deps / service 各 gate)tts_backends.voxcpme(wrapper / interpreter / deps / service 各 gate)
dub doctor 成功時顯示:
doctor ok: ready for `dub auto`, `dub en2zh`, `dub ja2zh`
next: uv run dub auto <video>
# 若只有單一路徑可用,會改成類似:
doctor lanes: ready=`dub ja2zh` ; blocked=`dub en2zh`
失敗時列出缺少的項目與修復建議。
每次執行將產物存成可續跑的專案結構:
<project>/ # 預設:<video-stem>.dub/ 在輸入影片旁邊
├── 01_raw_video/
├── 02_stems/
├── 03_asr/
├── 04_ref_audio/
├── 05_translated_srt/ # 翻譯 SRT(TTS 與組裝的輸入)
├── 06_tts_wav/
├── 07_final/
│ └── video_dubbed_stem.mp4 # 最終產物
└── .dub/
├── state.json
└── *.log
# Stage 4 "04_translate" 偶爾會寫一份
# 次要的 05_translate/video.zhtw.srt,
# 但 canonical 位置是 05_translated_srt/video.zhtw.srt,
# 由 TTS 與組裝階段直接取用。
完成時會印出最終影片的完整路徑。
以下命令已於 2026-06-04 用真實 backend 驗證通過:
uv run dub doctor --config ~/.config/dub/config.yaml
uv run dub auto tests/fixtures/test_short.mp4 \
--source-lang en \
--project-dir ~/.hermes/dub-cli-test/smoke-20260604-t10-qa \
--config ~/.config/dub/config.yaml \
--yes建議 smoke 完成後立刻驗證:
uv run dub validate --project-dir ~/.hermes/dub-cli-test/smoke-20260604-t10-qa
ffprobe -v error -show_entries format=duration,size -show_streams -of json \
~/.hermes/dub-cli-test/smoke-20260604-t10-qa/07_final/video_dubbed.mp4多數情境不需要手動建立或複製設定檔。
若需自訂:
mkdir -p ~/.config/dub
cp examples/config_en2zh.yaml ~/.config/dub/config.yaml常見自訂需求:
GOOGLE_API_KEY環境變數(必填,已由 doctor 自動復原)- OmniVoice:
dub bootstrap-omnivoice --config ~/.config/dub/config.yaml - 獨立 VoxCPM interpreter:
dub bootstrap-voxcpm
uv run dub bootstrap-omnivoice會自動建立 OmniVoice 專用 venv 並寫入 paths.omnivoice_python。
完成後重新驗證:
uv run dub doctor --config ~/.config/dub/config.yamlQUICKSTART.md:5 分鐘上手docs/operator-runbook.md:故障排除與恢復流程(含voxcpme service啟動步驟)docs/qa-auto-workflow-acceptance-criteria-2026-06-04.md:auto-workflow 驗收標準(T2 QA 定義)docs/auto-workflow-contract-2026-06-04.md:operator 合約(T0 gate)docs/operator-qa-real-backend-en2zh-2026-06-03.md:英文→中文真實驗證docs/operator-qa-real-backend-ja2zh-2026-06-03.md:日文→中文真實驗證
以下為 T9/T10 smoke QA 發現的 runtime 事實,文件必須與之一致:
-
dub doctor與實際 OmniVoice runtime 必須口徑一致。dub doctor只有在paths.omnivoice_python指向的 interpreter 能通過torch、omnivoice、openccimport gate 時,才應顯示omnivoice: READY。 若 OmniVoice 路線異常,重跑dub bootstrap-omnivoice --config ~/.config/dub/config.yaml,讓 bootstrap 重新安裝並驗證 runtime imports。 -
OmniVoice 專用 interpreter 依賴真實 stage-05 deps。 OmniVoice 的 wrapper script(如
tts_omnivoice.sh)需要torch、omnivoice、opencc,這些不由標準 dub venv 提供,而由dub bootstrap-omnivoice所建立的獨立 venv 提供。 -
每個專案目錄是隔離的,產物驗證是 operator 責任。 每次
dub auto/en2zh/ja2zh都應在獨立 project-dir 下執行;--project-dir用於控制位置。 完成後至少驗證:state.json六個 stage 全部done、06_tts_wav/有產物、07_final/video_dubbed.mp4與07_final/video_dubbed_stem.mp4存在,必要時再用ffprobe確認最終 MP4。
uv sync --extra alluv run dub --help/uv run dub auto --helpuv run dub doctor(自動從~/.zshrc復原 Gemini key)uv run dub bootstrap-omnivoice/uv run dub bootstrap-voxcpmuv run dub auto .../uv run dub en2zh .../uv run dub ja2zh ...dub resume / status / validate / clean
- 不是所有 TTS backend 都在同一個 Python 環境內
- OmniVoice 採「標準 dub venv + 專用 OmniVoice venv」雙環境契約
- VoxCPM 依賴本機服務(
127.0.0.1:8808) dub doctor顯示 READY 不等於 OmniVoice 在所有情況下都可用(需確認 interpreter deps)
這是目前已驗證、可維運、可交付的 operator contract。