How to Play Videos with MPV on Arch Linux
Categories:
5 minute read
When it comes to video playback on Linux, MPV stands out as one of the most lightweight, efficient, and flexible media players available. Its minimalist interface, powerful command-line options, and broad codec support make it a favorite among advanced users. On Arch Linux, installing and using MPV is straightforward and opens the door to a highly customizable multimedia experience.
This guide walks you through everything you need to know about using MPV on Arch Linux—from installation and basic playback to configuration and advanced tips.
What Is MPV?
MPV is a free, open-source, cross-platform media player based on MPlayer and mplayer2. It supports a wide variety of video and audio formats without requiring external codecs. MPV can be controlled entirely from the command line or via keyboard shortcuts, and it supports hardware acceleration, scripting, and integration with other tools.
Key features include:
- Hardware-accelerated video decoding (VA-API, VDPAU, Vulkan, etc.)
- High-quality video output via OpenGL or Vulkan
- Minimalist interface, distraction-free playback
- Lua scripting support for automation and UI enhancements
- Extensive command-line options for power users
Why Use MPV on Arch Linux?
Arch Linux is known for giving users full control over their systems. MPV fits this philosophy well. It’s lean, efficient, and respects user configuration. Whether you’re watching videos, streaming content, or integrating MPV with custom scripts, it’s a great match for Arch users who value simplicity and power.
Installing MPV on Arch Linux
Step 1: Update Your System
Before installing any new packages, make sure your system is up to date:
sudo pacman -Syu
Step 2: Install MPV
MPV is available in the official Arch Linux repositories. You can install it using pacman
:
sudo pacman -S mpv
This installs the core MPV player along with its necessary dependencies.
Optional: Install Additional Codecs and Tools
MPV usually supports most popular codecs out-of-the-box via ffmpeg
, but you may want to install some optional tools:
sudo pacman -S youtube-dl ffmpeg libva libvdpau
youtube-dl
: Enables MPV to stream online videos directly from websites like YouTube.ffmpeg
: Backend for codec support.libva
/libvdpau
: For hardware-accelerated decoding on supported GPUs.
💡 Tip: You can also use
yt-dlp
as a faster and more actively maintained alternative toyoutube-dl
.
Basic Usage of MPV
Once installed, you can launch MPV directly from your terminal. Here’s a simple example:
mpv myvideo.mp4
MPV opens a window and starts playing the video immediately.
Common Playback Controls
Here are some useful default keyboard shortcuts:
Key | Action |
---|---|
SPACE | Pause/Resume |
LEFT/RIGHT | Seek backward/forward (5s) |
UP/DOWN | Seek backward/forward (1 min) |
[ and ] | Decrease/Increase playback speed |
9 and 0 | Volume down/up |
m | Mute/Unmute |
f | Toggle fullscreen |
q or ESC | Quit playback |
MPV is designed to be minimal, so the interface will not display any GUI buttons. You control it entirely via keyboard or CLI.
Playing Online Videos with MPV
One of the coolest features of MPV is its ability to stream videos from online sources using youtube-dl
or yt-dlp
.
For example:
mpv https://www.youtube.com/watch?v=VIDEO_ID
This will stream the video directly in MPV without needing a browser.
To use yt-dlp
, install it from the AUR:
yay -S yt-dlp
Then ensure MPV is using yt-dlp
instead of youtube-dl
:
sudo ln -sf /usr/bin/yt-dlp /usr/local/bin/youtube-dl
Enabling Hardware Acceleration
To improve performance and reduce CPU usage, especially on high-resolution videos, you can enable hardware acceleration.
Check Your GPU
- Intel: Use VA-API
- AMD: Use VA-API (on newer GPUs) or VDPAU
- NVIDIA: Use VDPAU
Example: Run MPV with VA-API (Intel or AMD)
mpv --hwdec=vaapi myvideo.mp4
Example: Run MPV with VDPAU (NVIDIA)
mpv --hwdec=vdpau myvideo.mp4
You can set this permanently in the configuration file.
MPV Configuration
MPV allows user configuration via simple text files.
Config File Location
Create the directory and config file if it doesn’t already exist:
mkdir -p ~/.config/mpv
touch ~/.config/mpv/mpv.conf
Sample mpv.conf
# Enable hardware decoding
hwdec=auto
# Set default video output to GPU
vo=gpu
# Set fullscreen mode by default
fullscreen=yes
# Enable high-quality scaling
scale=ewa_lanczossharp
# Volume level
volume=50
You can also add a input.conf
file to customize keybindings:
touch ~/.config/mpv/input.conf
Sample input.conf
# Custom keybindings
q quit
SPACE cycle pause
f cycle fullscreen
Subtitles and Audio Tracks
MPV supports subtitles out-of-the-box. It automatically loads subtitle files (like .srt
) with the same name as the video.
You can also:
Load a specific subtitle file:
mpv --sub-file=subtitle.srt myvideo.mp4
Select an audio track:
mpv --aid=2 myvideo.mkv
Select a subtitle track:
mpv --sid=1 myvideo.mkv
Advanced Features
1. Creating Playlists
You can create a playlist of video files:
mpv file1.mp4 file2.mp4 file3.mp4
Or:
mpv --playlist=playlist.txt
playlist.txt
contains a list of file paths or URLs.
2. Looping Videos
Loop a video indefinitely:
mpv --loop myvideo.mp4
3. Screenshots
Take a screenshot during playback:
Press
s
(default) to save a screenshot.Save screenshots to a custom location:
screenshot-directory=~/Pictures/mpv-shots
Add this to your mpv.conf
.
4. Lua Scripts and Extensions
MPV supports Lua scripting. You can enhance it with community scripts from mpv.net.
Popular scripts include:
mpv-youtube-dl-quality
: Choose video quality for online streaming.autoload.lua
: Automatically load all files in the current folder as a playlist.
Scripts go into:
~/.config/mpv/scripts/
Just place the .lua
files there.
Troubleshooting Tips
- Video is choppy or lags: Try enabling hardware acceleration (
--hwdec=auto
). - Audio desyncs: Add
--audio-delay=0.1
or try disabling sync with--no-audio
for debugging. - Missing codecs: Ensure
ffmpeg
is installed and updated. - Subtitles not displaying: Make sure the subtitle file is correctly named or manually load it.
Conclusion
MPV is an exceptional video player for Arch Linux users who appreciate speed, control, and minimalism. Whether you’re watching local files, streaming YouTube videos, or crafting custom playback environments with configuration files and scripts, MPV delivers outstanding performance and flexibility.
Its no-frills interface may seem daunting at first, but once you get familiar with the shortcuts and command-line options, you’ll find it incredibly powerful. For those willing to tinker, MPV offers a highly customizable and efficient way to enjoy media on Linux.
So, fire up your terminal, open a video with MPV, and enjoy a smoother, leaner media experience tailored to your needs.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.