Skip to content

fix(captions): pick the spoken original on multi-audio videos; drop YouTube rolling-caption repeats - #292

Open
hass-87 wants to merge 1 commit into
bradautomates:mainfrom
hass-87:fix/multi-audio-captions
Open

hass-87 wants to merge 1 commit into
bradautomates:mainfrom
hass-87:fix/multi-audio-captions

Conversation

@hass-87

@hass-87 hass-87 commented Dec 3, 2026

Copy link
Copy Markdown

Problem

On YouTube videos with several audio tracks (auto-dubbed), yt-dlp lists one <lang>-orig caption track per audio track. With the default --sub-lang auto, select_caption replaces the chosen key with originals[0], the alphabetically first one. For an English video with 22 dubs this gave ar-orig, reported as captions (ar, automatic, unknown).

Separately, YouTube auto-captions "roll": each cue repeats the previous cue's last line on top, and a 10 ms cue repeats it alone. _dedupe merges only overlapping cues, and these cues touch but do not overlap. So every line appeared about three times in the transcript.

Fix

  • select_caption: when there are several -orig tracks, use the one that matches info['language']. With no language, use English first (english_first), never alphabetical. Single--orig behaviour is unchanged.
  • parse_vtt: drop only the carried-over line. That is the first line of a cue, when it equals the previous cue's last spoken line and the cue either has more lines or lasts 20 ms or less. Separate cues that repeat speech are kept (test_overlapping_prefix_only_and_mixed_karaoke still holds).

Tests

  • New: test_multi_audio_dub_uses_metadata_original_not_alphabetical, test_youtube_rolling_auto_captions_are_not_repeated.
  • Checked against a real multi-audio video (22 -orig tracks, language: en-US): now en-orig, 574 segments, no adjacent repeats.
  • Existing select_caption and parse_vtt expectations re-checked. I could not run the full pytest suite in my environment, so please let CI confirm.

🤖 Generated with Claude Code

…ouTube rolling-caption repeats

- select_caption: on dubbed videos YouTube lists one -orig track per audio track,
  so originals[0] (alphabetical) picked e.g. ar-orig for an English video.
  Use the -orig matching info.language; with no language, English first.
- parse_vtt: YouTube auto-captions repeat the previous cue's last line (and a
  10 ms cue repeats it alone), so each line appeared about three times. Drop only
  that carried-over line; separate cues that repeat speech are kept.

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