[Solution] 1080P YouTube in VRChat
available in future release
Haxy
After poking YouTube for a few days I discovered 1080p streams that are compatible with AVPro, featuring unified audio/video formats.
yt-dlp requires extra options to return these formats from the YouTube api.
This has been tested with various content, including 1080p live streams / YouTube music / normal YouTube with 1080p working just fine and lower resolutions being returned otherwise.
Switching the used client to return only merged MP4 streams
- Add the following options to yt-dlp line
--impersonate safari --extractor-args "youtube:player_client=web"
- Impersonation is required which currently effects all extractors
this will be resolved once https://github.com/yt-dlp/yt-dlp/pull/9474 is merged as it can then be specified as a extractor specific argument
Testing in ClientSim
- Tested with ProTV, AVPro 2.8.5 and the required Shim
- Make sure the player resolution is set to 1080 or above.
- Make the following changes to PlayModeUrlResolverShim.cs:
ResolveURLCallback -> ytdlProcess.StartInfo.Arguments
ytdlProcess.StartInfo.Arguments = $"--no-check-certificate --no-cache-dir --rm-cache-dir -f \"mp4[height<=?{resolution}]/best[height<=?{resolution}]\" --impersonate safari --extractor-args \"youtube:player_client=web\" --get-url \"{url}\"";
Log In
This post was marked as
available in future release
_
_tau_
tracked
_
_tau_
Haxy With https://github.com/yt-dlp/yt-dlp/pull/9474 merged, i.e. in the next release version, is there still a change in command line required or will this work automatically?
Haxy
_tau_ from what I can see it doesn't look like its been broken out to a cli argument just yet,
and as such would require a patch similar to this for the YouTube extractor currently
It seems its possible to reproduce this with just the user agent header instead of using full browser impersonation with the following however
--add-header "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15" --extractor-args "youtube:player_client=web"
eg
./yt-dlp.sh https://www.youtube.com/watch?v=i1csLh-0L9E --list-formats --add-header "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15" --extractor-args "youtube:player_client=web"
After checking in the yt-dlp discord, Unfortunately there doesn't seem to be a way to limit this to just effect YouTube in yt-dlp, so some URL inspection might be required in vrc to call it with that specific user agent to prevent any unintentional side effects to other extractors and to only affect YouTube domains.
_
_tau_
Haxy: Could that be added in a cleaner way to upstream yt-dlp still? We _could_ add a header if we detect youtube links, but that feels brittle.
Haxy
_tau_ It seems there's been a long standing issue to add support for that, but it requires significant changes to core code so hasn't been implemented yet https://github.com/yt-dlp/yt-dlp/issues/4680
yt-dlp maintainers said that using the safari user agent globally shouldn't cause any issues in the meantime, and seem open to the idea of adding an additional youtube:player_client specifically for the safari user agent in the meantime
Haxy
Ugh.. cant edit the main post anymore but the header is meant to be "Impersonation of Safari to additionally return merged 1080p streams."
owlboy
Haxy Good guy Safari