mpv - ArchWiki

# mpv

Related articles

- MPlayer

mpv is a movie 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.

## Installation

Install the mpv package from the official repositories or mpv-git 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).

  https://github.com/u8sand/Baka-MPlayer/ || baka-mplayer-git, baka-mplayer

- bomi — Powerful and easy to use multimedia player (Qt 5).

  https://bomi-player.github.io/ || bomi (previously cmplayer), bomi-git

- GNOME MPV — A simple frontend for mpv (GTK+ 3).

  https://github.com/gnome-mpv/gnome-mpv/ || gnome-mpv-git

Note: CMPlayer/bomi packages provide mpv internally.

## Configuration

mpv's configuration is read from the files `mpv.conf` (settings) and `input.conf` (key bindings). 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.

## Tips and Tricks

### Hardware Decoding

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 be set to `opengl`, `opengl-hq` or `vdpau` (if using `hwdec=vdpau`). Using `vo=vaapi` is not recommended for use anymore [1]. If hardware decoding cannot be used, mpv will automatically fall back to software decoding. See options.rst and vo.rst for more information.

### 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.

### Volume is too low

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

### Quickly cycle between multiple aspect ratio

Append this line to your `input.conf`:

    F2 cycle_values video-aspect "16:9" "16:10" "4:3" "2.35:1" "-1"

You should now be able to cycle between the provided aspect ratios by pressing the `F2` key.

### Drawing to a root window

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

### Use as a browser plugin

With the help of mozplugger, 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.

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.

### Twitch.tv streaming over mpv

See Livestreamer#Twitch.

Another alternative based on Livestreamer is this Lua script: https://gist.github.com/ChrisK2/8701184fe3ea7701c9cc

## Vapoursynth

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)

To use the f3k_db debanding filter install vapoursynth-plugin-flash3kyuu_deband-git 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)
    clip.set_output()

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

    mpv --vf=vapoursynth=f3k_db.py <video_file>

Category:

- Player