Skip to content

fix: dub with a real translation, any TTS provider, and lines placed on time - #359

Merged
kiyeonjeon21 merged 1 commit into
mainfrom
fix/dub-translation-and-timing
Oct 5, 2026
Merged

kiyeonjeon21 merged 1 commit into
mainfrom
fix/dub-translation-and-timing

Conversation

@kiyeonjeon21

Copy link
Copy Markdown
Contributor

Bug

vibe audio dub had three problems:

  • No real translation: it called Claude's storyboard analysis (analyzeContent) and read each returned scene description as a translated line. The output was either unrelated text or, through a silent fallback, the untranslated source.
  • Timing ignored: it concatenated the spoken lines one after another, ignoring when each was originally said.
  • Too many keys: it required both ElevenLabs and Anthropic keys.

Fix

  • translateTexts, extracted from translate-srt, translates in batches with Claude, or OpenAI when there's no Anthropic key. Replies are matched by their [N] index, so a skipped, reordered, or chatty reply cannot shift later lines; missing lines keep the source text. translate-srt uses it too, so both share one implementation over providerRequest.
  • Any TTS provider: each line is spoken through tts-resolve (new --tts auto|elevenlabs|openai|kokoro, also on the audio_dub tool).
  • Lines placed on time: each line is placed at its segment's start time with ffmpeg (adelay + amix), and sped up (at most 1.5x) when it would overrun its slot.
  • Fewer keys: only OPENAI_API_KEY (Whisper) is required. Temp files go in a temp dir that is always removed.

Verification

  • Tests: new translateTexts tests cover index matching with out-of-order, missing, and preamble lines, the OpenAI fallback, batching, and a missing key as auth.
  • Checks: pnpm build, lint, typecheck, tests (CLI 1347 including integration), pre-push gate.
  • Live: vibe audio dub long.mp3 -l ko --tts openai --json on a 7.5 s English clip with two lines:
    • Both lines translated correctly ("해 질 녘 종이배 한 척이 연못을 가로질러 떠간다").
    • Output 7.34 s.
    • Silence detection shows the second line starting right after a gap ending at 3.83 s, matching its source start of 3.76 s.
    • Transcribing the dub back gives the Korean text.

https://claude.ai/code/session_011S1BLTaFctZNQzGERpkCuA

…on time

`vibe audio dub` "translated" by calling Claude's storyboard analysis and
reading each scene description as a translated line, so output was garbage
or silently the source text. It then concatenated the spoken lines,
ignoring when each was said, and required ElevenLabs and Anthropic keys.

- `translateTexts` (extracted from translate-srt) translates in batches with
  Claude, or OpenAI without an Anthropic key, matching replies by their [N]
  index so a skipped or reordered line cannot shift later ones.
  translate-srt uses it too.
- Each line is spoken through `tts-resolve` (new `--tts auto|elevenlabs|
  openai|kokoro`), placed at its segment's start time with ffmpeg, and sped
  up (up to 1.5x) when it would overrun its slot.
- Only OPENAI_API_KEY is required (Whisper); temp files live in a temp dir
  that is always removed.

Claude-Session: https://claude.ai/code/session_011S1BLTaFctZNQzGERpkCuA
@vercel

vercel Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
vibeframe Ready Ready Preview Oct 5, 2026 8:14am UTC

Request Review

@kiyeonjeon21
kiyeonjeon21 merged commit dc6dc19 into main Oct 5, 2026
6 checks passed
@kiyeonjeon21
kiyeonjeon21 deleted the fix/dub-translation-and-timing branch October 5, 2026 08:18

This branch was successfully deployed

1 active deployment
Preview — 8b4195df Deployed Oct 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant