How To Use mpv – CLI Media Player

There are no shortage of media players for Linux. The majority of Linux distributions come with at least one player pre-installed and offer a few more in the repositories. One of the most popular open source media players is Mplayer, a command-line application with several graphical front-ends (SMPlayer is one of them). It’s a powerful app that supports many audio and video formats, as well as capturing video and audio output, saving streamed content to a file, decoding subtitles, and transcoding (converting) between formats.

Mplayer was previously forked into mplayer2 which brought upgrades and new features, but it’s no longer actively developed. Luckily, a new fork emerged, and it’s called mpv. This media player is free, open source and cross-platform. It brings many configuration options, optimized and cleaned-up code, and the ability to convert multimedia files directly in the player.

Mpv can be installed on Windows, OS X and Linux. The official website offers packages for download, and if your distribution is not supported, you can obtain the source and compile it.

Mpv is a command-line application. To start using it, simply type the following command in the terminal:


To play a single audio file, just navigate to it (or enter the full path) and type its name after mpv to play it. You can control mpv with keyboard shortcuts; for example, pressing Space pauses a song, arrow keys rewind it backward or forward, and / and * keys control the volume. The full list of mpv keyboard shortcuts can be found in the user manual.

To play all media files in a folder, just write the folder name followed by an * sign:


If you want to randomize the order in which they’re played, just add the --shuffle option:

Mpv also supports different kinds of playlists, and you can load a playlist with the command:

To activate the gapless audio option, add the --gapless-audio flag.

When you want to keep mpv opened even after it’s finished playing, use either --idle or --keep-open.

Adding all these options every time you use mpv might be impractical. The solution is to edit the configuration file to customize mpv according to your needs. The settings for each user are saved in “/home/$USER/.mpv/config”, while those affecting the whole system go into “/etc/mpv”. User-specific settings have priority over the system-wide ones, so you only have to edit the configuration file for your user.


Lines starting with # are commented, which means that these options are disabled. To enable them, simply remove the # symbol and save changes. To add options which are not listed, write them each in a separate line according to the following scheme:

--option becomes just option
-option VALUE becomes option=VALUE; same for --option VALUE (becomes option=VALUE)
-option "name" becomes option="name"

To see all available options and features, use the command:


You can also create separate configuration files for audio and video files. For example, if you have a film (with name “film1.avi”) which you want to play in fullscreen and without sound, you could create a file called “film1.avi.conf” and save it in your “/home/$USER/.mpv” folder with options --no-audio and --fullscreen enabled.

When playing video files, mpv has a small graphical control area called the OSD bar. You can disable it with the --no-osd-bar or --osd-level=0 flag, and customize its font, size, color and position in the mpv configuration file.


It’s possible to make mpv behave like a GUI application by always displaying the video window, even when playing audio-only files. This is done using the --force-window option. To prevent other windows from stealing mpv’s focus, you can use the --ontop option.

Although it looks different from other media players, mpv stacks up to your “regular” player. You can use it to tune into TV and radio channels, stream content directly from the Internet and apply various audio and video filters (for example, remove a TV station logo, rotate or mirror the screen…). The learning curve might be too much for some users, but mpv is worth trying, because it’s quick, lightweight and feature-packed.

What’s your favorite media player? Leave a recommendation in the comments.