From ArchWiki
Jump to: navigation, search

Related articles

mpv is a media player based on MPlayer and MPlayer2. It supports a wide variety of video file formats, audio and video codecs, and subtitle types. A comprehensive (although admittedly incomplete) list of differences between mpv and the aforementioned players can be found here.


Install the mpv package from the official repositories or mpv-gitAUR from the Arch User Repository.

Front ends

mpv provides an elegant User Interface called OSC which appears when moving the mouse. To ease casual users, other graphical interfaces exist:

  • Baka MPlayer — Free and open source, cross-platform, libmpv based multimedia player (Qt 5). || baka-mplayer, baka-mplayer-gitAUR
  • bomi — Powerful and easy to use multimedia player (Qt 5). || bomiAUR, bomi-gitAUR
  • GNOME MPV — A simple frontend for mpv (GTK+ 3). || gnome-mpvAUR, gnome-mpv-gitAUR || mpc-qt-gitAUR
  • SMPlayer — Qt multimedia player with extra features (CSS themes, YouTube integration, etc.) (Qt 5). || smplayer
  • xt7-player-mpv — Qt/Gambas GUI to mpv with a rich set of configurable options including filters and drivers, ladspa plugins support as well as library/playlist managment, YouTube, online radios, podcasts, DVB-T and more. || xt7-player-mpv-gitAUR
Note: CMPlayer/bomi packages provide mpv internally.


mpv's configuration is read from the files mpv.conf (settings), input.conf (key bindings), and lua-settings/osc.conf (on screen display). For a full list of options, see the mpv(1) or the GitHub docs.

If the environment variable XDG_CONFIG_HOME is not set, user configuration files will be read from the ~/.config/mpv directory. System-wide configuration files are read from the /etc/mpv directory.

An example input.conf file

Copying the following into ~/.config/mpv/input.conf will add a number of useful keybindings to mpv such as rotating video 90 degrees, zooming and panning.

Alt+RIGHT add video-rotate 90
Alt+LEFT add video-rotate -90
Alt+- add video-zoom -0.25
Alt+= add video-zoom 0.25
Alt+j add video-pan-x -0.05
Alt+l add video-pan-x 0.05
Alt+i add video-pan-y 0.05
Alt+k add video-pan-y -0.05

mpv and PulseAudio/ALSA mixer controls since 0.18.1

This entry only applies if you are using pulseaudio for mpv (-ao=pulse or ao=pulse in mpv.conf), or if you want to control your ALSA mixer volume with mpv.

Add the following to your ~/.config/mpv/input.conf to make volume changes work again from PulseAudio/ALSA to mpv and vice versa:

/ add ao-volume -2
SHIFT+* add ao-volume 2

Change the above to whatever volume keys you use.

Tips and Tricks

Hardware Decoding

See Hardware video acceleration.

Unlike mplayer and mplayer2, mpv has both VA-API and VDPAU support built-in. To enable it, run mpv with the --hwdec='method' option. You can find list of all available methods looking for --hwdec=<api> in man page mpv(1). To make this persistent, add the line hwdec=method to your configuration file.

When hardware decoding is used, the video output should generally be set to opengl or opengl-hq (or possibly vdpau if using hwdec=vdpau). In particular, hwdec=vaapi should be used with profile=opengl [1] if possible (opengl-hq has sometimes huge CPU spikes when a video is read using this mode).

If hardware decoding cannot be used, mpv will automatically fall back to software decoding.

By default, hardware decoding is enabled for codecs h264, vc1, wmv3, hevc, mpeg2video and vp9. It is however possible to specify codecs (e.g. --hwdec-codecs=h264,mpeg2video) or allow all codecs (hwdec-codecs=all) to use hardware decoding.

High quality video output

The opengl-hq profile is a high quality preset which use the OpenGL video driver and enables various options selected by the mpv developers. To make use of it, specify it in your configuration file.


This comes with a GLSL debanding filter by default, which may lead to bad performance for some users, and can reduce the visual quality of grainy content. You can disable it easily though.


Automatically resuming from where you left off

The default key to quit mpv, saving the video's current position and state, is Shift+q. This key can be changed by adding the quit_watch_later string in the key bindings configuration file.

To always automatically save the current playback position on quit, start mpv with a flag --save-position-on-quit. To make option permanent, add line save-position-on-quit to configuration file.

Volume is too low

Set volume-max=value in your configuration file to a reasonable amount, such as volume-max=600. Additionally (or alternatively), you can utilize dynamic range compression with af=drc.

Quickly cycle between multiple aspect ratio

You can cycle between aspect ratios using Shift+a from version 0.8.0 onwards.

Ignoring aspect ratio

You can ignore aspect ratio using --keepaspect=no. To make option permanent, add line keepaspect=no to configuration file.

Drawing to a root window

Run mpv with --wid=0. This tells mpv to draw onto a window with a window ID of 0.

Always show GUI

It may be useful to always show the GUI window, even for audio files, especially when mpv is not started from terminal. This can be done by using --force-window option.

Hide GUI for video files

It may be useful to hide the GUI window for video files. This can be done by using --no-video option.

Restoring old OSC

Since version 0.21.0, mpv has replaced the on-screen controls by a bottombar. In case you want on-screen controls back, you can edit the mpv configuration as described here.

Use as a browser plugin

With the help of mozpluggerAUR, mpv can be used in a supported browser to play video. See Browser plugins#MozPlugger for configuration details. This coupled with a user script such as ViewTube, allows you to use mpv in place of a site's integrated video player.

It may be needed to specify a valid user agent for HTTP streaming, e.g. user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0".

Browser plugins#Video players workarounds page shows other easy ways to watch videos.

Improving mpv as a music player with Lua scripts

The development of mpv's Lua scripts are documented in DOCS/man/lua.rst and examples are shown in TOOLS/lua of the mpv repository. This blog post introduces the music.lua script, which shows how Lua scripts can be used to improve mpv as a music player. streaming over mpv

If youtube-dl is installed, mpv can directly open a Twitch livestream.

Alternatively, livestreamer[broken link: archived in aur-mirror] can be used to stream Twitch. See Livestreamer#Twitch.

Another alternative based on Livestreamer is this Lua script:

youtube-dl and choosing formats

The default --ytdl-format is bestvideo+bestaudio/best. For youtube videos that have 4K resolutions available, this may mean that your device will struggle to decode 4K VP9 encoded video in software even if the attached monitor is much lower resolution.

Setting the right youtube-dl format selectors can fix this easily though. In the following configuration example, only videos with a vertical resolution of 1080 pixels or less will be considered.


If you wish to avoid a certain codec altogether because you cannot hardware-decode it, you can add this to the format selector. For example, we can additionally choose to ignore VP9 as follows:


youtube-dl audio with search

To find and play audio straight from your terminal with mm "search terms" put the following function in your .bashrc:

function mm() {
    mpv --no-video --ytdl-format=bestaudio ytdl://ytsearch10:"$@"

Use mpv with a compositor

If you're using a compositor (e.g. in KDE Plasma 5) and find that composition is disabled (e.g. in Plasma this would make you unable to present windows or see window thumbnails in the default app switcher) when mpv is playing a video, try x11-bypass-compositor=no

Creating a single screenshot

An example of creating a single screenshot, by using a start time (HH:MM:SS):

$ mpv --no-audio --profile=image --start=00:01:30 --frames=1 /path/to/video/file

Screenshots will be saved as 00000001.jpg in the current directory.


Vapoursynth is an alternative to AviSynth that can be used on Linux and allows for Video manipulation via python scripts. Vapoursynths python scripts can be used as video filters for mpv.

To use vapoursynth filters you have to install the vapoursynth package and compile mpv with the --enable-vapoursynth build flag.

Debanding (flash3kyuu)

Note: Mpv already include a debanding shader which is enabled by default with the opengl-hq profile. Refer to the manual for more information on how to tune it.

To use the f3k_db debanding filter install vapoursynth-plugin-f3kdb and write a python script that uses the vapoursynth extension.

The following sample script can be used to enable debanding in mpv.

import vapoursynth as vs
core = vs.get_core()

clip = video_in
clip = core.std.Trim(clip, first=0, length=500000)
clip = core.f3kdb.Deband(clip, grainy=0, grainc=0, output_depth=16)

Finally specify the python script in the config file or use a command line argument when executing mpv.

$ mpv <video_file>


Fix jerky playback and tearing

mpv defaults to using the OpenGL video output device setting on hardware that supports it. In cases such as trying to play video back on a 4K display using a Intel HD4XXX series card or similar, you will find video playback unreliable, jerky to the point of stopping entirely at times and with major tearing when using any opengl output setting. If you experience any of these issues, using the XV (XVideo) video output device may help:


This VO is deprecated and will cause issues in recent versions of mpv, most noticeably is the osd looking very blurry.

It is possible to increase playback performance even more (especially on lower hardware), but this decreases the video quality dramatically in most cases.

The following options may be considered to increase the video playback performance: