Watching online videos can be annoying most of the time. Ads, annotations, not to mention cookies and history that you leave behind.
So here’s a quick and easy way to improve not only your visual experience, but also improve your privacy and ( if you’re using a laptop ) some battery life: mpv player + youtube-dl.
Don’t be fooled by the “youtube” in “youtube-dl”. This nifty little program, or plugin or add-on however you want to call it, supports a shitload of websites.
So let’s get started with this short and sweet tutorial….
Installing MPV player
MPV is free, open source and cross platform. It will work on Linux, macOS, Windows and Android. I’m going to show you how to install it on macOS but if you want to install it on another platform check out the official webpage for instructions.
The easiest way to install MPV on macOS is via Homebrew
1. ( With homebrew installed on your system ) open up the terminal and type: brew install mpv
NOTE: mpv is already installed on my system, hence the “warning”
2. That’s it.
youtube-dl is a command-line program to download videos from YouTube.com and a few more sites. A LOT more site. Check a full list here.
youtube-dl works on any UNIX system and Windows. I’m going to show you how to install it on macOS. For Linux etc or Windows check out this page.
Just like mpv, the easiest way to install youtube-dl on macOS is via homebrew…
1. ( With homebrew installed on your system ) open up the terminal and type: brew install youtube-dl
2. That’s it.
Watching YouTube ( or any video from the supported youtube-dl sites ) using mpv
1. Let’s say you want to watch a YouTube video. Right click on that video’s thumbnail and copy the video link.
2. (with mpv running ) go to File > Open URL… ( or hit cmd+shift+o ) and paste the link ( also works with playlists but make sure you remove the video ID from the URL and only leave the “list” attribute )
Just drag and drop that video thumbnail from the webpage to mpv.
Let’s say you have a youtube video page saved as a .webloc file on your desktop. Right click on it and choose to open it with mpv.
One more thing…
youtube-dl is so much more powerful than just allowing you to watch all those online videos through mpv. You can download videos, playlists, download just the audio, bypass georestrictions etc etc etc.
For a complete list of what youtube-dl can do for you see the official github page…
Here’s an example. Download just the audio from a YouTube video…
1. In the terminal i’m going to type youtube-dl –extract-audio –audio-format mp3 –audio-quality 0 <video_url>.
NOTE: I’m telling youtube-dl that I only want the audio source, file format to be mp3 and specify the audio quality ( you can find all these arguments in the github page linked above )