Skip to content

fix(captions): prefer metadata language, then English, among multiple -orig tracks - #269

Open
BartimaeusStern wants to merge 1 commit into
bradautomates:mainfrom
BartimaeusStern:fix/english-caption-default
Open

BartimaeusStern wants to merge 1 commit into
bradautomates:mainfrom
BartimaeusStern:fix/english-caption-default

Conversation

@BartimaeusStern

Copy link
Copy Markdown

Problem

YouTube videos with dubbed audio expose one -orig auto-caption track per audio language. On https://www.youtube.com/watch?v=CvT_EPyWcdo there are 21 of them (ar-orig, bn-orig, ..., en-orig, ...), and the video's metadata language is en-US.

In auto mode, select_caption swaps in originals[0] whenever any -orig track exists. That is the alphabetically first one, so this English video was transcribed from ar-orig. The report showed captions (ar, automatic, unknown) and an Arabic transcript.

Fix

In skills/watch/scripts/download.py:

  • One -orig track: behavior is unchanged. It is still treated as the source language (existing tests cover this).
  • Several -orig tracks: prefer the original matching the metadata language. If none matches, prefer en-orig. Otherwise keep the already language-matched key. It is never the alphabetically first original.
  • Unknown-language fallback: english_first now ranks en-orig before machine-translated en.

Tests

  • New test: test_many_original_tracks_follow_metadata_then_english. It covers metadata en-US choosing en-orig, metadata de choosing de-orig, missing metadata choosing en-orig, and an unmatched ja falling back to en-orig.
  • tests/test_download.py: 21 passed.
  • Full suite: 250 passed locally.

🤖 Generated with Claude Code

… -orig tracks

YouTube videos with dubbed audio expose one -orig auto-caption track per audio
language (21 on CvT_EPyWcdo). In auto mode select_caption swapped in the
alphabetically first original, so English videos were transcribed from the
Arabic track (ar-orig).

Now: a single -orig track is still treated as the source language; with several,
auto mode prefers the original matching the video's metadata language, then
English, and keeps the language-matched track otherwise. The unknown-language
fallback prefers en-orig over machine-translated en. Adds a regression test.

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