How to Install mpv on Ubuntu 24.04, 22.04 or 20.04

This tutorial will show how to install mpv Media Player on Ubuntu 24.04, 22.04, or 20.04 LTS through the command-line interface, leveraging either the APT Package Manager or Flatpak via Flathub for an alternate method.

mpv Media Player stands out in the realm of multimedia players with its minimalistic approach, yet it packs a powerful punch when it comes to performance and versatility. As an open-source software, it supports a wide range of audio and video formats, ensuring seamless playback without the need for external codecs. Its user interface is clean and unobtrusive, designed to put the focus squarely on the content being played. Here are some of its standout features:

  • Highly customizable through simple configuration files, allowing users to tailor the player to their preferences.
  • Efficient video scaling with high-quality algorithms for an enhanced viewing experience.
  • Command-line driven interface for those who prefer keyboard shortcuts and scripts.
  • On-the-fly playback adjustments, including speed changes, chapter skipping, and subtitle synchronization.
  • Support for the latest video codecs and formats, ensuring compatibility with a broad range of multimedia files.
  • Integration with various streaming protocols, allowing for the playback of online content directly.
  • Lightweight and resource-efficient, making it suitable for systems with limited hardware capabilities.
  • Active community development, ensuring regular updates and the addition of new features.

mpv Media Player’s flexibility and performance make it a preferred choice for users who value a no-frills approach to video playback while still demanding quality and efficiency.

Let’s dive into the technical aspects of getting mpv operational on your Ubuntu system.

Install MPV Media Player on Ubuntu via APT

Update Ubuntu System Packages Before MPV Installation

Before embarking on the installation of MPV, it’s prudent to ensure that your system packages are up-to-date. Keeping the system updated minimizes the chances of running into 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 on Ubuntu

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

sudo apt install mpv

Note: If you have a preference for using the newest version of MPV, you might want to consider an alternative installation method, which will be covered below.

Install MPV via Flatpak and Flathub on Ubuntu

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 is already 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, it’s imperative to make sure that the Flathub repository is enabled on your system. This repository contains an extensive collection of applications packaged in the Flatpak format. 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 on Ubuntu

Now that the Flathub repository is enabled, we can move ahead with installing 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 on Ubuntu

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, launching MPV can be done 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.

Display of mpv Media Player terminal options for Ubuntu 24.04, 22.04, or 20.04.
Terminal commands for launching mpv Media Player on Ubuntu 24.04, 22.04, or 20.04.

Initiating MPV for Flatpak Users on Ubuntu

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 on Ubuntu

While the command line is a powerful tool, it’s not always the most convenient way to launch applications. Ubuntu also allows you to 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:

How to launch mpv Media Player using the application icon on Ubuntu 24.04, 22.04, or 20.04.
Visual guide on opening mpv Media Player via its icon on Ubuntu 24.04, 22.04, or 20.04.

First-Time Tips with MPV Media Player on Ubuntu

Now that mpv Media Player is set up on your Ubuntu system, here are some insights to help you maximize its potential:

Getting Comfortable with mpv Media Player

Diving into mpv Media Player, it’s essential to familiarize yourself with its core functionalities and how it can be adapted to enhance your media consumption experience. Here’s what you need to know:

  • Explore Configuration Options: Customize your viewing experience by editing the mpv.conf file located in ~/.config/mpv/. If it doesn’t exist, feel free to create it. This file allows you to set default options such as video output driver, audio settings, and subtitle preferences.
nano ~/.config/mpv/mpv.conf
  • Utilize Scripts for Enhanced Functionality: Enhance mpv’s capabilities by adding scripts to the ~/.config/mpv/scripts/ directory. Scripts can add new features like automatic subtitle downloading, video filtering, or interface modifications.
  • Adjust Playback Options on-the-fly: Learn how to adjust playback options such as audio delay, subtitle sync, and video aspect ratio during playback with keyboard shortcuts or command-line arguments for a tailored viewing experience.

Keyboard Shortcuts

Familiarizing yourself with keyboard shortcuts can drastically improve your efficiency and enjoyment when using mpv Media Player. Here are a few to get started:

  • Space: Pause or resume playback.
  • F: Toggle fullscreen mode.
  • S: Take a screenshot.
  • [ and ]: Decrease or increase playback speed.
  • J: Cycle through available subtitles.
  • #: Cycle through available audio tracks.
  • Arrow keys: Seek through the video.

Optimizing Video and Audio Quality

To get the most out of your media, consider these tips for optimizing video and audio playback:

  • Enable Hardware Acceleration: Improve performance and reduce CPU load by enabling hardware acceleration with the --hwdec option in your mpv.conf file.
hwdec=auto
  • Experiment with Video Output Drivers: Find the best video output driver for your system by trying different drivers with the --vo= option. Options include gpu, vdpau, and vaapi.
  • Enhance Audio Quality: Use the --audio-normalize-downmix option to improve audio quality, especially useful for content with varying volume levels.
  • Customize Subtitles: Adjust subtitle appearance for better readability by setting font, size, and color in the mpv.conf file.

Networking and Streaming

mpv is not just for local files; it’s also a powerful tool for streaming content:

  • Play Streams Directly: Open network streams by passing the URL to mpv. It supports a wide range of protocols, including HTTP, HTTPS, and more.
mpv https://example.com/stream
  • Use youtube-dl for Online Content: Combine mpv with youtube-dl to stream video from supported sites directly. mpv will automatically use youtube-dl if it’s installed on your system.
  • Cache Settings: For smoother playback of online content, adjust cache settings in mpv.conf to buffer more data upfront.
  • Network Performance Tweaks: If you’re experiencing buffering or playback issues, consider adjusting network-related settings like cache-secs or network-timeout in your configuration file.

Troubleshooting and Community Resources

Encountering issues or looking to dive deeper? Here’s how to troubleshoot and learn more:

  • Check the Log for Errors: Run mpv with the --log-file option to generate a log file. This can be invaluable for troubleshooting playback issues or crashes.
mpv --log-file=output.log your_video.mp4
  • Engage with the Community: The mpv community is active and welcoming. Forums, the mpv GitHub page, and IRC channels are great places to ask questions, share tips, and stay updated on new features.
  • Documentation is Your Friend: The mpv manual (man mpv) is comprehensive and offers in-depth information on every feature, command, and configuration option.
  • Experiment: Don’t be afraid to experiment with different settings and configurations. mpv is highly customizable, and exploring its features is the best way to learn.

With these tips and insights, you’re well on your way to mastering mpv Media Player on Ubuntu. Remember, experimentation and customization to fit your preferences are the keys to getting the most out of mpv.

mpv Media Player ready for use on Ubuntu 24.04, 22.04, or 20.04.
A look at mpv Media Player open and operational on Ubuntu 24.04, 22.04, or 20.04.

Managing MPV Media Player on Ubuntu

When utilizing open-source software such as the MPV Media Player on Ubuntu, it’s crucial to ensure that your applications are current. This involves regular updates for optimized performance and robust security. This section will guide you through updating and uninstalling the MPV Media Player on Ubuntu based on your method of installation.

Update MPV Media Player

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

APT Update Command Method for MPV

If you employed 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 one upgrades all the outdated software, including MPV.

Flatpak Update Command Method for MPV

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

flatpak update

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

Remove 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

Throughout this guide, we’ve walked through the essentials of getting mpv Media Player up and running on Ubuntu 24.04, 22.04, and 20.04 LTS. From installation basics, diving into first-time user tips, to keyboard shortcuts and optimizing playback quality, we aimed to cover everything you need to start enjoying your media seamlessly. Remember, the beauty of mpv lies in its customization capabilities—take the time to tweak it to your liking. And don’t hesitate to dive into the community for further insights or help. Happy viewing, and here’s to many enjoyable moments with mpv on your Ubuntu system!

Leave a Comment