Skip to content

Auto-dubbed videos play the English dub instead of the original audio track #247

Description

@albertgmz

Basic Troubleshooting

  • I have checked for similar issues (open AND closed), and my issue is not a duplicate. (MANDATORY)
  • I have checked for pull requests that may already address my issue. (MANDATORY)
  • I am using (and my issue is reproducible on) the latest version of youtube-source.
  • My issue is reproducible with IPv6 rotation.
  • I DO NOT confirm that this has been filled out truthfully.

Version of youtube-source

f45bbb7 (same code path on main, 2be8e54)

The search query/queries, URL(s), playlist ID(s)/URL(s) or video ID(s)/URL(s) that triggered the issue

https://www.youtube.com/shorts/etEhNKZQbhg

Code Example

N/A, happens with a plain Lavalink setup. Just play the video above.

Exception and Stacktrace

N/A, nothing is thrown. The track plays fine, it's just the wrong audio track.

What is your client configuration?

MUSIC, IOS, WEB, WEBEMBEDDED, ANDROID_VR


Hey! Videos that have YouTube's auto-dubbed audio tracks play the English dub instead of the original audio. It mostly shows up on spoken stuff like podcasts, vlogs and Shorts. The one above is a Spanish Short, and Lavalink plays it in English.

From what I can tell, when a video has several audio tracks YouTube marks the one matching the requester's language as audioIsDefault. We don't send hl, so YouTube assumes English and the English dub comes back as the default. TrackFormats.getBestFormat() skips every format that isn't the default track, so the dub is what ends up playing.

Here's what the IOS client returns for etEhNKZQbhg (itag 140):

audioTrack.id displayName audioIsDefault
en-US.10 English (US) true
es-US.4 Spanish (US) original false

Sending hl doesn't really fix it, it just moves the problem around: with hl=es, an English video like v9QtM6qnG50 gets its Spanish dub as the default instead. yt-dlp handles this by preferring the track whose name says "original" (and skipping audio-description tracks), then falling back to the default.

This was originally reported on my bot's tracker, albertgmz/BeatDock#160, which has the full write-up and the patch. I tried that approach locally. StreamFormat gets an isOriginalAudioTrack flag, both format extractors (common and v2) set it from audioTrack.displayName, and getBestFormat() prefers original tracks, falling back to the current behaviour when none is marked. Single-track videos and English originals come out the same as before, and the Spanish Short plays in Spanish. It applies cleanly to main and comes with two unit tests. Happy to open a PR if you're fine with that direction.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions