Saturday, 7 January 2017

How to install and use mpv to watch streaming video in Ubuntu 16.04 or Linux Mint 18.x



mpv is an open source cross platform media player for Linux, Mac OS X, Windows, and BSD. It is excellent for watching streaming video when coupled with another piece of software youtube-dl. mpv is a nice alternative to watching videos in the browser, as you don't have to use flash or a buggy ad-ridden website.

This tutorial will show you how to install and use an up to date version of mpv and youtube-dl on Ubuntu 16.04 and Linux Mint 18.x (18, 18.1, and whatever point release comes after that)

Installing mpv

 

mpv is already in the Ubuntu 16.04 repository, but I will show you how to install an updated version.

Please follow my instructions carefully, also, if you have added any other updated media library PPAs, please purge them with ppa-purge before adding these ones. This tutorial is meant for people who have the default media libraries that came with Ubuntu 16.04 or Linux Mint 18.

If you have messed with your system, purge any other media lib PPAs with:

$ sudo ppa-purge -d xenial ppa:some/ppa

The dollar sign is not part of the command, it's only to represent that this is a terminal command. Change some/ppa to the ppa you want to purge.

Ok, now to get on with the tutorial.

Step 1. Type this in the terminal (or copy and paste)

$ sudo add-apt-repository ppa:mc3man/mpv-tests -y && sudo add-apt-repository ppa:mc3man/xerus-media -y && sudo apt update && sudo apt install mpv && sudo apt dist-upgrade

Make sure to look at the programs and libraries that will be updated, and press 'y' once you're confident.

Once you're all updated and mpv is installed, install youtube-dl.

$ sudo apt install python-pip

$ sudo pip install youtube-dl

To upgrade youtube-dl if it ever gets outdated, do this:

$ sudo pip install youtube-dl --upgrade

Now we'll continue to the next part.

Using mpv & youtube-dl

 

To use mpv, simply paste a video URL such as a youtube video, or any other supported site after the 'mpv' command.

So, for example:

$ mpv https://www.youtube.com/watch?v=dQw4w9WgXcQ

That will play a popular YouTube video in an mpv video.

To use  youtube-dl (to download a video)

$ youtube-dl https://www.youtube.com/watch?v=dQw4w9WgXcQ

To find a list of options youtube-dl has, type:

$ youtube-dl --help

mpv supports all the video sites youtube-dl does.

The list of supported sites can be found at: https://rg3.github.io/youtube-dl/supportedsites.html

mpv has a barebones user interface, it has keyboard shortcuts you can use to play and pause the video (spacebar), and to fast forward and rewind you can use the arrow keys. For more shortcuts, look up the documentation on mpv with:

$ man mpv (to view the manual)

To install a fully featured GUI for mpv (like VLC has), type this:

$ sudo apt install baka-mplayer

(assuming you added those two PPAs)

It will show up in the menus as "Baka-MPlayer"

I hope you found this tutorial useful.

No comments:

Post a Comment