media-dub
Use when producing a local DUB of a video - re-voicing speech into another language (or restyling it same-language) while KEEPING the original speaker's voice, fully offline. Safe-ship engine is Chatterbox-Multilingual (Resemble AI, MIT, 23-lang zero-shot clone); rides media_studio (ASR, CTC word-alignment, ffmpeg atempo duration-fit, ducking, mux). NOT for pure TTS (use speech).
- License 许可
- MIT
- 最近更新
- 2026-11-02
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- media-dub
- description
- Use when producing a local DUB of a video - re-voicing speech into another language (or restyling it same-language) while KEEPING the original speaker's voice, fully offline. Safe-ship engine is Chatterbox-Multilingual (Resemble AI, MIT, 23-lang zero-shot clone); rides media_studio (ASR, CTC word-alignment, ffmpeg atempo duration-fit, ducking, mux). NOT for pure TTS (use speech).
03 SKILL.md 正文
media-dub — local voice-clone dubbing (Chatterbox safe ship)
Distilled from the REAL implementation. Cite these when in doubt:
media_studio/features/dub.py— the whole feature: thedub.startRPC, theDubLicenseGate(SHADOW),build_dub_plan, theatempofit, the VO-timeline and duck/mux argv builders, andrun_dub_pipeline(the end-to-end orchestrator).- Substrate it RIDES (do not reinvent) — from the media_studio package
(
sidecar/media_studio/features/in the Reframe checkout):transcribe.py/parakeet_asr.py— ASR to the §3Transcriptschema.ctc_align.py— karaoke-grade word-timing refinement (optional 2nd pass).audiomix.py— thesidechaincompress->amix->loudnormduck/mux graph (build_mix_filter); the dub mux uses the identical convention + labels.
Evidence: gem-hunt MASTER E.3 — "Local dubbing stack — biggest missing flagship feature: Chatterbox-Multilingual (MIT, 23-lang clone) + IndexTTS2 duration-control
- optional LatentSync lip-sync; the whole substrate (Parakeet+CTC+ducking+mux) exists. [verify IndexTTS2 weights license before commercial embed; Chatterbox alone is the safe ship.]" · COUNCIL C5 (risk-tiered SHADOW ladder — a heuristic/nagging/blocking gate ships observe-and-log FIRST).
Wire surface (NET-NEW)
dub.start({videoId|path, targetLang, sourceLang?, engine?, durationFit?,
lipsync?, posture?, allowGated?, bgPath?})
-> {jobId} -> {path, engine, durationFit, lipsync, targetLang,
sourceLang, segments, license, notices}
A long job: returns {jobId} immediately, streams job.progress, and the final
job.done.result carries the output path + the license receipt.
targetLang(required) — ISO-639-1 (e.g.es,de,ja).engine—chatterbox(default, safe) |indextts2(gated).lipsync—latentsync(gated) | omit.posture—personal(default; local/non-commercial) |commercial.allowGated— owner opt-in to keep a gated engine under a commercial posture.bgPath— an optional music/ambient bed ducked UNDER the new VO.
Pipeline (ride the bus)
- ASR —
transcribe_fn(in_path, settings)-> §3Transcript({language, durationSec, segments:[{start,end,text,words?,speaker?}]}). - align (optional) —
align_fn(transcript)refines word timings viactc_align; a miss degrades to segment timings (never raises). - translate (optional) —
translate_fn(text, targetLang, sourceLang)per segment; ABSENT ->target_text = source_text(same-language voice re-read). - synthesize —
synth_fn(text, lang, speaker, target_sec, engine, out_path)->(wav_path, synth_sec). Chatterbox clones the source speaker and speaks the target text.target_secis a duration HINT the native engine (IndexTTS2) honors; the timestretch path fits afterward. - duration-fit — land each clip in its source slot:
timestretch(Chatterbox-only, SAFE):atempo_factor(synth_sec, slot_sec)=synth_sec / slot_sec, clamped to[0.5, 2.0];build_atempo_chaindecomposes a factor outside[0.5, 2.0]into in-range stages (a singleatempois linear only in that range). A factor within±0.02of 1.0 is left untouched (no needless re-encode).native(IndexTTS2, GATED): trust the synth duration (the engine already hit the target) — better quality, no time-stretch artifacts.
- assemble —
build_vo_timeline_argvplaces every fitted clip at its source start on ONE full-length VO track: a silentanullsrcbase ofdurationSec, each clipadelay-ed to its start (ms, stereo), all summed withamix=...:normalize=0(nothing auto-attenuated). - duck + mux —
build_dub_mux_argvstream-copies the source VIDEO (-map 0:v -c:v copy) and rebuilds the audio: the VO isloudnorm-ed to the target LUFS; with abgPaththe bed is ducked under the VO viasidechaincompresskeyed off the VO (the exactaudiomixconvention). - lip-sync (optional, GATED) — LatentSync re-renders the mouth to match the
dub. Commercial embed gated on
dub-license.
License gate — SHADOW mode (the crux)
Chatterbox-Multilingual is MIT -> commercial-safe, the DEFAULT, always admitted.
IndexTTS2 and LatentSync weights are not confirmed commercial-safe -> a
commercial embed routes to the dub-license needsDecision.
DubLicenseGate.evaluate(requested, posture) is advisory (SHADOW):
- it is PURE and NEVER raises, blocks, or nags;
- it returns a
LicenseVerdict(admitted/gated/needsDecision/decisionId="dub-license") and LOGS it to a bounded, injectedshadow_logsink (production points this at a separate auto-rotating sink — never the main event ledger, per C5(iii)); personalposture admits every engine (local/non-commercial use of the gated weights is unrestricted);commercialposture flags the gated engines.
build_dub_plan uses the verdict only to pick a DEFAULT: under commercial
WITHOUT allowGated a gated engine is downgraded to Chatterbox + timestretch and
a notice is recorded — the gate never forces this, the plan just defaults safe.
With allowGated the owner's choice is honored and the needsDecision is STILL
recorded for them. This is "observe + log, never block."
Chatterbox's 23 languages
ar da de el en es fi fr he hi it ja ko ms nl no pl pt ru sv sw tr zh
(verify against the Resemble AI model card at wire time). A target outside this
set emits a LOUD notice (never a silent wrong-language dub). Romanian (ro) is
NOT in the set — Parakeet can ASR it, but Chatterbox cannot yet synthesize it.
Assets to install (follow-on, out of the single-file build)
chatterbox-multilingual(MIT) — the safe-ship TTS weights + thedub_backend.RealChatterboxSynthloader (the heavysynth_fnseam).indextts2/latentsync— install ONLY after thedub-licensedecision resolves them for a commercial embed.
Pitfalls that actually bite
- argv-list only, never
shell=True— the filter graph + paths are single argv elements (CONTRACTS discipline). atempolinear range — oneatempoonly works in[0.5, 2.0]; always go throughbuild_atempo_chainfor larger stretches or you get an ffmpeg error.- Don't strip the original background — the safe ship REPLACES the speech with the dub VO and optionally ducks a provided bed under it; separating the original speaker's voice from music (source separation) is a heavier, separate step — do not claim it's done here.
- Slot overflow — if a translation is much longer than its slot the clamp to 2.0x leaves the clip slightly overrunning the next; the fit notice surfaces it. Prefer IndexTTS2 native fit (once licensed) for tight lip timing.
- Shadow sink must never break the dub —
_observeswallows a sink failure; a logging outage can't fail a render.
When NOT to use
- Pure narration with no source voice to clone ->
speech. - Muxing an already-finished dub/VO track ->
audio-extract-mix. - Transcription / subtitles only ->
transcribe/caption-burn. - Trimming dead air / silence ->
silence-trim.
04 同仓库更多 Skills
clarify-requirements
Resolve genuine pre-execution ambiguity by scanning repo context, generating 1-6 grounded options, and asking 1-3 focused questions via AskUserQuestion. NOT for mid-task use (injection risk); NOT when the goal is already unambiguous; use to disambiguate vague prompts before any file edits.
openmm-md
Run FREE, open-source, Windows-native GPU molecular dynamics via the openmm-md MCP (OpenMM + CUDA on the local NVIDIA GPU). Use for protein / protein-ligand MD when you want a free stack or are on Windows without a Schrodinger license. Covers the full workflow (prepare, solvate, minimize, equilibrate, production, analyze, mmgbsa) AND an honest decision guide vs Schrodinger Desmond, including how to run Desmond legitimately on Linux or a cloud GPU with a real license. This is a deliberately LESSER free alternative and does NOT replace the schrodinger MCP tools. Do NOT use it to pick a free tool when a validated FEP+, WaterMap, IFD-MD, or Prime MM-GBSA result is actually required.
visual-review
Take screenshots of web pages and UI using Playwright for visual review and iteration
status
Diagnostic status report — shows metaswarm installation state, project setup, and potential issues
start
Use when starting work on any task, when the user mentions metaswarm, or when the user wants to begin tracked development work
setup
Interactive project setup — detects your project, configures metaswarm, writes project-local files