Skip to content

fix: pick the matching -orig caption track on auto-dubbed videos - #255

Open
gbarcia wants to merge 1 commit into
bradautomates:mainfrom
gbarcia:fix/caption-orig-multi-track
Open

gbarcia wants to merge 1 commit into
bradautomates:mainfrom
gbarcia:fix/caption-orig-multi-track

Conversation

@gbarcia

@gbarcia gbarcia commented Oct 11, 2026

Copy link
Copy Markdown

Problem

Auto-dubbed YouTube videos expose one -orig ASR track per audio language. For example, cWjS56edaUA lists 20+ tracks: ar-orig, bn-orig, en-orig, ko-orig, and so on.

In auto mode, select_caption first narrows the tracks to those matching the target language. It then overrides that match with originals[0], the alphabetically first -orig track. As a result, an English video (yt-dlp language: en-US) returned the ar-orig transcript.

Fix

The override now picks the -orig track that matches the target language. If none matches, it falls back to the existing English-first ordering. Provenance stays unknown when several -orig tracks exist, because metadata alone doesn't prove which one is the source.

Tests

  • New parametrized test test_auto_dubbed_video_picks_original_matching_metadata covering metadata en-US, ko, and none. All three cases fail on main (they return ar-orig) and pass with this change.
  • Full suite: 252 passed.
  • Live check: select_caption on the real cWjS56edaUA info JSON now returns en-orig instead of ar-orig.

🤖 Generated with Claude Code

Auto-dubbed YouTube videos expose one `-orig` ASR track per audio
language. In auto mode, select_caption overrode the target match with
originals[0], so an English video (language en-US) returned the
alphabetically first track, ar-orig. Prefer the -orig track matching the
target language, falling back to English-first ordering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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