LinuxCommandLibrary

mpv

Play audio and video files

TLDR

Play a video or audio from a URL or file

$ mpv [url|path/to/file]
copy

Jump backward/forward 5 seconds
$ [<ArrowLeft>|<ArrowRight>]
copy

Jump backward/forward 1 minute
$ [<ArrowDown>|<ArrowUp>]
copy

Decrease or increase playback speed by 10%
$ [<[>|<]>]
copy

Add subtitles from a file
$ mpv --sub-file=[path/to/file]
copy

Take a screenshot of the current frame (saved to ./mpv-shotNNNN.jpg by default)
$ <s>
copy

Play a file at a specified speed (1 by default)
$ mpv --speed [0.01..100] [path/to/file]
copy

Play a file using a profile defined in the mpv.conf file
$ mpv --profile [profile_name] [path/to/file]
copy

SYNOPSIS

mpv [options] [file|URL|...]

PARAMETERS

--no-osc
    Disables the on-screen controller.

--fs
    Starts in fullscreen mode.

--loop[=N]
    Loops playback indefinitely, or N times if specified.

--volume=
    Sets the initial playback volume (0-100).

--start=
    Starts playback at the specified time (e.g., 'HH:MM:SS', 'SS', 'PP%').

--alang=
    Specifies preferred audio language (e.g., 'en', 'jp').

--slang=
    Specifies preferred subtitle language (e.g., 'en', 'jp').

--sub-file=
    Loads an external subtitle file.

--hwdec=
    Enables hardware decoding using a specified API (e.g., 'auto', 'vaapi', 'vdpau', 'cuda').

--vo=
    Specifies the video output driver (e.g., 'gpu', 'opengl', 'x11').

--ao=
    Specifies the audio output driver (e.g., 'pulse', 'alsa').

--screenshot
    Takes a screenshot at the current playback position.

--ytdl
    Enables youtube-dl integration for online media playback.

--config-dir=
    Specifies a custom configuration directory for mpv.

DESCRIPTION

mpv is a free, open-source, and cross-platform media player that offers high-performance playback of a vast array of media formats.

Originally forked from MPlayer2 (which was a fork of the classic MPlayer), mpv was designed with an emphasis on modern features, cleaner code, and a more robust design, making it a powerful and flexible choice for media consumption. It supports a wide range of video and audio codecs, leveraging FFmpeg for decoding and various video outputs for rendering.

While it features a minimalist on-screen controller (OSC) by default, mpv truly shines through its extensive command-line options and powerful Lua scripting capabilities, allowing users to deeply customize its behavior, appearance, and functionality. It excels at handling complex playback scenarios, including high-bitrate video, multi-track audio/subtitles, and sophisticated filtering. Its lightweight nature and efficient hardware decoding support make it suitable for both high-end systems and less powerful machines.

CAVEATS

mpv's default minimalist interface might be less intuitive for users accustomed to traditional GUI media players. Its full power is unlocked through command-line options and configuration files, which can present a steep learning curve for newcomers. While highly configurable, complex setups might require delving into its extensive documentation.

<B><I>CONFIGURATION FILES</I></B>

mpv's behavior can be extensively customized through configuration files. The main configuration file is typically located at `~/.config/mpv/mpv.conf`. Keyboard shortcuts are defined in `~/.config/mpv/input.conf`. These plain text files allow users to set default options, define custom key bindings, and load scripts.

<B><I>ON-SCREEN CONTROLLER (OSC)</I></B>

By default, mpv features a minimalistic on-screen controller (OSC) that appears when the mouse is moved over the video window. This GUI provides basic playback controls like play/pause, seek bar, volume, and fullscreen toggle. It can be disabled with the `--no-osc` option for a completely minimalist experience.

HISTORY

mpv began its development around 2012 as a fork of MPlayer2, which itself originated from the MPlayer project. The primary motivation for the fork was to address long-standing design issues in MPlayer, remove deprecated features, and improve the codebase with a focus on modern APIs and maintainability. It quickly gained traction for its efficient performance, extensive customization options, and commitment to a cleaner, more robust architecture, evolving into a widely used media player among power users.

SEE ALSO

mplayer(1), ffmpeg(1), vlc(1), ffplay(1)

Copied to clipboard