Whenever I pause a YouTube video which is playing in VLC for a few minutes and resume it, it simply plays a few seconds (presumably until the end of some cache) and then stops playback. Is there some way to get it to resume the connection to YouTube and continue playing/downloading?
How to resume YouTube videos in VLC
vlc
Related Solutions
You can run mpv
with the --save-position-on-quit
option. e.g.
mpv --save-position-on-quit /path/to/video.mkv
Alternatively, if you want mpv
to do that by default, you can add that option to its config file. For example:
echo "save-position-on-quit" >> ~/.config/mpv/mpv.conf
Or use your favourite text editor to add the same line. The --
option prefix is not needed in the config file.
If you want this option to be the default for all users on the system rather than just your own user, the config file to edit (as root) is /etc/mpv/mpv.conf
if mpv
was installed as a package. And probably /usr/local/etc/mpv/mpv.conf
if installed by compiling the source.
Parsing JSON in the shell is generally not a great idea. You can easily find that, on U&L, almost all the answers to questions along the lines of "how can I parse this JSON in the shell?" end up using specialized tools (e.g. jq
or jshon
).
This is why I suggest to leverage the ability of youtube-dl
to select one video version when more than one is available and to print its URL on standard output instead of downloading it:
--format
or-f
: lets you... specify a format. To have the highest quality, just specifybest
. Actually, in your case this is probably not required, because (see manual pageyoutube-dl(1)
):By default youtube-dl tries to download the best available quality
--get-url
, or-g
, avoids downloading any video and only prints the URL of the selected one to standard output.
Then, leverage the ability of vlc
to play (and seek) a video from URL. You can either pipe the URL to vlc
:
youtube-dl --get-url --format best 'https://www.youtube.com/watch?v=video_id' | vlc -
or use command substitution to invoke vlc
with the URL as argument:
vlc "$(youtube-dl --get-url --format best 'https://www.youtube.com/watch?v=video_id')"
Best Answer
This seems to be fixed in VLC 2.2.3. Changelog states
You can find much more info in https://www.videolan.org/developers/vlc-branch/NEWS or https://www.videolan.org/vlc/releases/2.2.3.html