mpv icon indicating copy to clipboard operation
mpv copied to clipboard

Mpv does not show all audio tracks on youtube video

Open KingAbyx opened this issue 3 years ago • 3 comments

Important Information

Provide following Information:

  • mpv version - 0.33.0-115-gf1d0365a6f
  • Platform and Version - x86_64 Linux 5.11.12-arch1-1
  • Source of the mpv binary - Built from github

Also tested with

  • mpv version - 0.33.1
  • Platform and Version - x86_64 Linux 5.11.12-arch1-1
  • Source of the mpv binary - AUR

Reproduction steps

Playing a youtube video with multiple audio tracks in mpv through the terminal with no flags or config edits

Expected behavior

Playing the Video by default in English and giving the choice to switch to Spanish

Actual behavior

Playing the Video in Spanish and not showing the English audio track

Log file

MrBeast_MPV_log.txt

Sample files

https://www.youtube.com/watch?v=fMfipiV_17o

Extra information

When downloading the Video with youtube-dl the English audio track is downloaded by default

KingAbyx avatar Apr 11 '21 08:04 KingAbyx

btw for me it uses the spanish audio by default.

i would say it's up to youtube-dl what is selected and they apparently added a filter for the audio language https://github.com/ytdl-org/youtube-dl/commit/9c1e164e0cd77331ea4f0b474b32fd06f84bad71. this needs to be incorporated in the youtube format option.

it also seems that youtube doesn't give us any audio language info for the various audio tracks?

youtube-dl -F https://www.youtube.com/watch?v=fMfipiV_17o
[youtube] fMfipiV_17o: Downloading webpage
[youtube] fMfipiV_17o: Downloading API JSON
[youtube] fMfipiV_17o: Downloading API JSON
[info] Available formats for fMfipiV_17o:
format code  extension  resolution note
249-0        webm       audio only tiny   50k , webm_dash container, opus @ 50k (48000Hz), 5.07MiB
249-1        webm       audio only tiny   52k , webm_dash container, opus @ 52k (48000Hz), 5.36MiB
250-0        webm       audio only tiny   63k , webm_dash container, opus @ 63k (48000Hz), 6.42MiB
250-1        webm       audio only tiny   70k , webm_dash container, opus @ 70k (48000Hz), 7.12MiB
251-0        webm       audio only tiny  121k , webm_dash container, opus @121k (48000Hz), 12.32MiB
140-0        m4a        audio only tiny  129k , m4a_dash container, mp4a.40.2@129k (44100Hz), 13.10MiB
140-1        m4a        audio only tiny  129k , m4a_dash container, mp4a.40.2@129k (44100Hz), 13.10MiB
251-1        webm       audio only tiny  135k , webm_dash container, opus @135k (48000Hz), 13.68MiB
278          webm       256x144    144p   92k , webm_dash container, vp9@  92k, 30fps, video only, 9.32MiB
160          mp4        256x144    144p   92k , mp4_dash container, avc1.4d400c@  92k, 30fps, video only, 9.37MiB
133          mp4        426x240    240p  190k , mp4_dash container, avc1.4d4015@ 190k, 30fps, video only, 19.28MiB
242          webm       426x240    240p  199k , webm_dash container, vp9@ 199k, 30fps, video only, 20.14MiB
243          webm       640x360    360p  359k , webm_dash container, vp9@ 359k, 30fps, video only, 36.36MiB
134          mp4        640x360    360p  377k , mp4_dash container, avc1.4d401e@ 377k, 30fps, video only, 38.20MiB
135          mp4        854x480    480p  579k , mp4_dash container, avc1.4d401f@ 579k, 30fps, video only, 58.60MiB
244          webm       854x480    480p  609k , webm_dash container, vp9@ 609k, 30fps, video only, 61.65MiB
136          mp4        1280x720   720p  905k , mp4_dash container, avc1.4d401f@ 905k, 30fps, video only, 91.57MiB
247          webm       1280x720   720p 1081k , webm_dash container, vp9@1081k, 30fps, video only, 109.44MiB
248          webm       1920x1080  1080p 2334k , webm_dash container, vp9@2334k, 30fps, video only, 236.14MiB
137          mp4        1920x1080  1080p 2971k , mp4_dash container, avc1.640028@2971k, 30fps, video only, 300.60MiB
18           mp4        640x360    360p  681k , avc1.42001E, 30fps, mp4a.40.2 (44100Hz), 68.94MiB
22           mp4        1280x720   720p 2562k , avc1.64001F, 30fps, mp4a.40.2 (44100Hz) (best)

Akemi avatar Apr 11 '21 10:04 Akemi

Yeah, youtube or youtube-dl do not clarify which audio language is being used, so this can't be automatically determined.

On this specific video, 251-0 seems to be english, per manually parsing the URL for the string "lang%3Den", but I'd never seen different languages being available before, nor have any idea if 251-0 is always English.

I'd say you probably should explicitly specify you want the format 251-1 to be used, if available (if it's always Spanish audio), as in --ytdl-format "bestvideo+251-1/bestvideo+bestaudio"

wiiaboo avatar Apr 16 '21 13:04 wiiaboo

To show more than just one audio and video track , you have to use the all_formats option for the ytdl_hook. Unfortunately that option isn't without it's issues (e.g. #10394), but I already have a few PRs open to improve the ytdl_hook and I hope that one day it will be able to completely replace my quality-menu script.

In the meantime I've added the ability to show any fields from yt-dlp/youtube-dl in quality-menu after seeing this. The default configuration now shows the language code of a track when available.

yt-dlp has a --format-sort option that accepts lang to sort by language preference, but I don't know how to set that preference (--format-sort lang:es didn't work).

christoph-heinrich avatar Jul 17 '22 01:07 christoph-heinrich

As previously mentioned, you can list more formats with all_formats, so I think the fundamental thing behind this ticket, "not showing all audio tracks" has a solution (the other noted drawbacks are separate things).

Dudemanguy avatar Jan 09 '23 21:01 Dudemanguy