How to Install mpv Media Player on Ubuntu Linux

The mpv media player provides lightweight, high-quality video and audio playback for Ubuntu users who want more control than traditional players offer. Whether you need to play local video files, stream content from URLs, automate media processing with scripts, or use keyboard-driven controls without a cluttered interface, mpv handles these tasks efficiently. By the end of this guide, you will have mpv installed and verified on your Ubuntu system, ready for playback and customization through its powerful configuration options.

Choose Your mpv Installation Method

Ubuntu offers two main installation paths for mpv, each with different trade-offs between version freshness and system integration.

MethodChannelVersionUpdatesBest For
APT Package ManagerUbuntu ReposDistribution defaultAutomatic via apt upgradeMost users who prefer distro-tested packages
FlatpakFlathubLatest stableAutomatic via flatpak updateUsers who want newer releases with sandboxing

For most users, the APT method is recommended because it integrates seamlessly with Ubuntu’s package management and receives security updates automatically. Choose Flatpak if you specifically need the latest mpv features or prefer application sandboxing.

This guide supports Ubuntu 22.04 LTS and 24.04 LTS installations. Both installation methods work identically on all supported LTS releases, while Flatpak remains compatible across all Ubuntu versions.

Method 1: Install MPV Media Player via APT

Update Ubuntu System Packages Before MPV Installation

Before installing MPV, ensuring your system packages are up-to-date is prudent. Keeping the system updated minimizes the chances of encountering compatibility issues or conflicts with existing libraries.

Run the following command in the terminal to update the package lists and upgrade the system:

sudo apt update && sudo apt upgrade

Install MPV via APT Command

Now, with the system updated, execute the command below in your terminal to install MPV:

sudo apt install mpv

Once the installation completes, verify that mpv is accessible by checking its version:

mpv --version
mpv 0.37.0 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on UNKNOWN

If you prefer to use the latest version of mpv with newer features, consider the Flatpak installation method covered in Method 2 below.

Method 2: Install MPV via Flatpak and Flathub

Flatpak provides an alternative installation method that delivers the latest mpv releases in a sandboxed environment. This approach is ideal if you want newer features than the Ubuntu repository offers, or if you prefer application isolation for security.

If Flatpak is not installed on your system, follow our Flatpak installation guide for Ubuntu to set up the framework and add the Flathub repository.

Enable Flathub Repository for MPV

Before installing MPV, you must ensure the Flathub repository is enabled on your system. This repository contains an extensive collection of applications packaged in the Flatpak format, and Enabling Flathub is crucial for accessing and managing these packages.

To enable Flathub on your Ubuntu system, execute the following command in the terminal:

sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

This command verifies if Flathub is in your system’s list of repositories and adds it if it’s not already present.

Install MPV via Flatpak Command

Now that the Flathub repository is enabled, we can install MPV. Flatpak commands facilitate installing, updating, and removing Flatpak packages.

Run the following command in the terminal to install MPV:

flatpak install flathub io.mpv.Mpv -y

The command tells Flatpak to fetch and install the mpv package from the Flathub repository. The -y flag automatically confirms installation prompts, which is useful for scripted deployments but means you will not see the package list before installation proceeds.

After installation completes, verify that mpv is accessible through Flatpak:

flatpak info io.mpv.Mpv
          ID: io.mpv.Mpv
         Ref: app/io.mpv.Mpv/x86_64/stable
        Arch: x86_64
      Branch: stable
      Origin: flathub
 Installation: system

Launch mpv Media Player

With mpv installed, you can launch it using several methods depending on your preference for terminal commands or graphical navigation.

Launch mpv from Terminal

For users who prefer keyboard-driven control, mpv works exceptionally well from the terminal. The basic syntax accepts optional flags followed by a file path or URL:

To launch MPV from the terminal, use the command:

mpv [options] [url|path/]filename

In the above command, replace [options] with any additional parameters you want to use, and [url|path/]filename with the file or stream you wish to play.

To view the extensive list of options that can be used with the MPV command, enter the following command:

mpv --list-options

This command displays all available options along with their descriptions, giving you greater customization possibilities for using the MPV Media Player.

Launch mpv from Flatpak Installation

For those who installed MPV using Flatpak, a different command is needed to launch the media player from the terminal:

flatpak run io.mpv.Mpv

This command specifically tells Flatpak to run the MPV Media Player.

Launch mpv from Applications Menu

Alternatively, you can launch mpv directly from Ubuntu’s graphical desktop environment without using the terminal.

Navigate to the MPV Media Player by following this path:

Activities > Show Applications > MPV Media Player

The following screenshots show the mpv application icon in Ubuntu’s application menu and the player interface once launched:

Managing MPV Media Player

Update MPV Media Player

It is important to stay up-to-date with the latest versions. The steps to update the MPV Media Player differ depending on whether you installed it using APT or Flatpak.

Update mpv via APT

If you used APT to install mpv, you can update it alongside other system packages by running:

sudo apt update && sudo apt upgrade

The first command updates the package list, and the second upgrades all the outdated software, including MPV.

Update mpv via Flatpak

If you used Flatpak for installation, the update process is slightly different. Input the following command in the terminal:

flatpak update

This command updates all installed Flatpak applications, including mpv, to their latest available versions from Flathub.

Remove mpv Media Player

If you no longer need mpv on your system, you can remove it using the commands matching your installation method.

Remove mpv via APT

If MPV was installed via APT, use the following commands in the terminal for uninstallation:

sudo apt remove mpv
sudo apt autoremove

The autoremove command cleans up any orphaned dependencies that were installed alongside mpv but are no longer needed by other packages.

Remove mpv via Flatpak

For those who have installed MPV through Flatpak, the command to uninstall it is:

flatpak uninstall --delete-data io.mpv.Mpv

The --delete-data flag removes mpv along with its configuration files stored in the Flatpak data directory. After removal, run flatpak uninstall --unused to clean up any unused runtimes.

Conclusion

You now have mpv media player installed and verified on your Ubuntu system, with the ability to play media files from the terminal or applications menu. To further customize your experience, explore mpv’s configuration file at ~/.config/mpv/mpv.conf where you can set default options for video output, audio, and keyboard bindings. For streaming content, combine mpv with yt-dlp to play online videos directly without opening a browser.

Leave a Comment