Repository navigation
fix(captions): prefer metadata language, then English, among multiple -orig tracks - #269
Open
BartimaeusStern wants to merge 1 commit into
Open
BartimaeusStern wants to merge 1 commit into
BartimaeusStern wants to merge 1 commit into
Conversation
… -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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
YouTube videos with dubbed audio expose one
-origauto-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 isen-US.In auto mode,
select_captionswaps inoriginals[0]whenever any-origtrack exists. That is the alphabetically first one, so this English video was transcribed fromar-orig. The report showedcaptions (ar, automatic, unknown)and an Arabic transcript.Fix
In
skills/watch/scripts/download.py:-origtrack: behavior is unchanged. It is still treated as the source language (existing tests cover this).-origtracks: prefer the original matching the metadata language. If none matches, preferen-orig. Otherwise keep the already language-matched key. It is never the alphabetically first original.english_firstnow ranksen-origbefore machine-translateden.Tests
test_many_original_tracks_follow_metadata_then_english. It covers metadataen-USchoosingen-orig, metadatadechoosingde-orig, missing metadata choosingen-orig, and an unmatchedjafalling back toen-orig.tests/test_download.py: 21 passed.🤖 Generated with Claude Code