How to Install mpv Media Player on Ubuntu 24.04/22.04/20.04

The mpv Media Player is a versatile tool that offers straightforward and efficient video playback. It’s known for supporting various media formats and providing a customizable user experience.

  • Versatile Playback: Supports numerous video and audio formats.
  • User Customization: Allows various configurations and scripts.
  • Open Source: Free to use and constantly updated by the community.

To install mpv on Ubuntu 24.04, 22.04, or 20.04 LTS, you have two main options:

  • Using the apt repository: This method uses Ubuntu’s default package manager to install mpv directly from the official Ubuntu repositories.
  • Using Flatpak: This method involves using Flatpak, a popular package manager, to install mpv from the Flathub repository, providing a more isolated and updated software version.

With the introduction out of the way, let’s explore how to install mpv on your Ubuntu system utilizing the command-line terminal.

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

Note: If you prefer to use the newest version of MPV, you might want to consider an alternative installation method, which will be covered below.

Method 2: Install MPV via Flatpak and Flathub

This section will discuss an alternative approach to installing the MPV Media Player on your Ubuntu system, utilizing Flatpak and Flathub. Flatpak is a universal package manager that allows you to run applications in an isolated environment. Flathub serves as the primary repository for distributing applications in Flatpak format. This section assumes that Flatpak has already been installed on your system.

Note: If your system lacks Flatpak, please consult our comprehensive guide on How to Install Flatpak on Ubuntu for detailed instructions on installing the most recent supported version of Flatpak.

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 automates the process by assuming ‘yes’ as the answer to installation prompts.

Initiating the MPV Media Player

After successfully installing the MPV Media Player on your Ubuntu system, you’ll want to launch it to explore its functionalities. This section demonstrates different methods to initiate the MPV Media Player on your system.

Launching MPV Through the Command-Line Interface

The command-line interface (CLI) is a text-based interface that enables you to interact with your system using commands. For those who prefer the precision and control offered by the CLI, MPV can be launched directly from the terminal.

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.

Initiating MPV for Flatpak Users

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.

Launching MPV From the Desktop Environment

While the command line is a powerful tool, it’s not always the most convenient way to launch applications. Ubuntu lets you start the MPV Media Player directly from the desktop environment.

Navigate to the MPV Media Player by following this path:

Activities > Show Applications > MPV Media Player

Additionally, here’s where an example image of the MPV Media Player application icon on the Ubuntu desktop taskbar can be placed:

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.

APT Update Command Method for MPV

If you installed the APT package manager to install MPV, you can update it alongside other system packages. Use the terminal and enter the following commands:

sudo apt update
sudo apt upgrade

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

Flatpak Update Command Method for MPV

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

flatpak update

This command updates the MPV Media Player without affecting other applications.

Remove the MPV Media Player

There could be various reasons for wanting to uninstall MPV, such as preference for another media player or troubleshooting. Similar to updating, the uninstallation process also depends on the installation method.

APT Remove Command Method for MPV

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

sudo apt remove mpv

Flatpak Remove Command Method for MPV

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

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

This command will effectively remove MPV Media Player from your Ubuntu system.

Conclusion

In this guide, we’ve covered how to install and set up mpv Media Player on Ubuntu 24.04, 22.04, and 20.04 LTS. We’ve walked through the installation process using both the apt repository and Flatpak and discussed optimizing playback quality. Remember to explore mpv’s customization options to enhance your viewing experience. If you encounter any issues or want to learn more, the mpv community is a great resource. Enjoy your media with mpv on your Ubuntu system!

Joshua James
Follow me

Leave a Comment


en_USEnglish