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.
Summary
This PR adds support for playing high-res video (with audio) via the
vlc
andmpv
players.Details
YT started splitting high-res video and audio into separate streams some time ago. The only stream that typically combines the two is the low-res 360p phone-compatible stream.
This PR addresses issue #942, by leveraging the ability for
mpv
andvlc
to accept separate audio and video streams as CLI parameters. (See separate note below formplayer
.)This PR is a more general solution than thatonearchguy's #1284 PR, leveraging the current URL handling architecture.
Compatibility Note
While
mplayer
does provide support for loading and playing a separate audio file,mplayer
will only load local files and does not support streaming from remote URLs. Due to this limitation, this PR leaves the default functionality untouched formplayer
(meaning it will only play the 360p streams).Code Formatting Note
I followed the PEP-8 standards for most of the code except where that would conflict with the existing code formatting (long lines). I'm more than happy to adjust that (or anything else) based on feedback!
Testing
Testing was manual. I've been running these changes for the past few months on Linux.
These changes have also been tested on Windows and work for
vlc
andmpv
.I also verified that the download feature continues to work, although it is unlikely this change would have affected it as it uses the built-in
yt-dlp
download functionality viapafy
.Known Issues
Having run this for a couple months, I've noticed two occasions where
mpv
would play the video, but not the audio stream. This seems to have been due to a network failure whenmpv
attempted to retrieve the audio stream. Stopping the stream and restarting it fixed the problem in both cases.