Introduction to MPV

As mentioned I wanted to share some mpv hacks.
I think it is the best video player out there and even serves as a great audio player.

Mpv is based on mplayer and the now defunct mplayer2. Back in the time I used to use mplayer and later mplayer2 before I finally settled on mpv. Mplayer is still out there but mpv is more actively developed, has some nice features and some older ones removed. Though both are quite similar and great. Personally I prefer mpv.
But I also just prefer the plain default mpv without any GUI as it has its own in-build OSD compared to mplayer where you could use some ‘horrible’ GUIs.

It is possible to use GUI back ends for mpv. One of the most popular is Gnome MPV, now called Celluloid. For my tutorial I will go with plain mpv without any GUI.

You can install mpv on any Linux distribution, it should be in the repositories regardless of the version.

I use it primarily as a video player and also for streaming content, e.g. Youtube. But one nice feature mpv has that other video players do not, apart from being one of the most lightweight, is gapless playback if you listen to music, by default!

I will only show some features I personally prefer to use. Feel free to add more options, hacks, scripts etc that you like in mpv.

Maybe some options are not 100 percent right because I do not use them anymore or they are deprecated and older ones from mplayer. So feel free to correct it.

Important keyboard shortcuts

Some are obvious as in other players. I will list the ones I use mostly.

  • m - is for mute

  • q - is for quit but Q is for quitting and remembering the position of the audio or video file

  • ‘#’ - (without quotation mark) cycle through the available audio tracks, important for DVDs or movies with different audio languages

  • o - show time and progression time

  • v - enable or disable subtitles, j cycle through subtitles

  • z - adjust subtitle delay

  • s - take screenshots, S take screenshots without subtitle

  • A - cycle through aspect ratios

  • i - show info about the currently playing file like codec, framerate etc

  • < and > - go backward and forward in the playlist

Configuration file

You can set the options directly when starting mpv from the terminal or you can set them in a config file.
I will give some examples that I personally use or used. Because I am mostly satisfied with the defaults.
You should put the user’s config file into ~/.config/mpv/mpv.conf.

vinylninja’s example conf

#use alsa for audio output (instead of pulse)

#use X11 for video output on older systems (by default mpv uses vo=gpu, recommended)

#set max volume, default is 130

#display less terminal output

#load all subtitle files in current directory

#set font

#set subtitle language to be loaded, useful for DVDs and mkv files (languagecode needed, in my case English, Spanish and German)

#set audio language to be loaded, useful for DVDs and mkv files (languagecode needed, I prefer English if available)

#start mpv in fullscreen

Feel free to add more. This is only an overview. Mpv is very powerful.
You can also change the default keybindings if you want. I am fine with the defaults.

One thing I like about mpv is that I can stream content from Youtube or other video sites supported by youtube-dl. Therefor you need to install youtube-dl. You can either play the video directly from the site with mpv or download the file with youtube-dl an even begin to play the video with mpv while it is still downloading.

Go to the site and copy the link, open the terminal and just play the video or audio:

mpv source_to_file

Though it would be important to have the newest version of youtube-dl installed because sometimes the sites break compatibility. There are various methods but I prefer pip on Debian based distributions.
On Debian based distributions youtube-dl is usually a recommended package when you install mpv. I do not want this obviously. So I install mpv this way on Debian:

apt install --no-install-recommends mpv

Now I have mpv without youtube-dl and can go ahead and install pip and the newest version of youtube-dl.

Install pip with Python 3 support:

apt install python3-pip

Then install the most recent version of youtube-dl for your user:

pip3 install --user youtube-dl

To update youtube-dl:

pip3 install --user --upgrade youtube-dl

I still did not explain how to use it specifically with DVD playback. I mostly use mpv with local files on my laptop or stream Youtube videos using hardware acceleration instead of going to the site and using the HTML5 playback.
One thing that is nice is being able to use hardware acceleration with mpv. I think that is the default on Ubuntu. You will probably have vaapi or vdpau support installed.

Mpv has also video and audio filters and it has an encoder integrated.

If you want to see what else you can do with mpv then just open the man page:

man mpv

or go to the homepage of the project.


Mpv’s man page
Mpv’s homepage
Celluloid (formerly Gnome MPV)


All apt commands have to be issued by sudo or as root.

If there is interest I can also do a little tutorial about youtube-dl specifically.