Skip to main content
mpv’s command interface is shared across all control surfaces: input.conf key bindings, the JSON IPC protocol, Lua/JavaScript scripts, and the libmpv C API all use the same commands and property names.

input.conf

The input.conf file maps keys to commands. It lives at ~/.config/mpv/input.conf.
Default bindings are defined at https://github.com/mpv-player/mpv/blob/master/etc/input.conf. List all available key names:
Test key bindings interactively (shows the binding on OSD instead of executing it):

Syntax

  • Multiple commands can be chained with ;
  • # begins a comment (outside quoted strings); use SHARP to bind the # key
  • Strings with spaces or special characters must be quoted: "...", '...', or `X...X` (custom quotes)

Multiple commands on one key

Key sequences

Key modifiers

For text keys, use the character produced by the key rather than adding Shift+. For example, @ instead of Shift+2 on a US keyboard. ASCII letters are an exception: Shift+a is interpreted as A.

Special key names (selected)


Input command prefixes

Prefixes go between the key name and the command in input.conf. Multiple prefixes are separated by spaces.

Property system

Properties allow reading and writing player state at runtime. They are used by:
  • set, add, cycle, multiply commands
  • ${property} expansion in show-text, print-text
  • Scripting APIs (mp.get_property, mp.observe_property, etc.)
  • IPC get_property / set_property commands
Most command-line options are also available as properties (strip the leading --). Properties marked (RW) can be written; others are read-only.

Key properties

Playback state

Audio / video

File information

Playlist


Command reference

Playback control

Change playback position.Flags (combine with +):By default keyframes is used for relative seeks and exact for absolute seeks. Combine flags:
In scripts:
Undo the most recent seek. Call again to undo the revert. Works within a single file.Flags: mark (mark current position for revert), mark-permanent (always revert to this position until changed).
Advance or step back by frames. Default is 1 frame. Flags: play (default — play then pause), seek (precise seek), mute (like play but muted). Does not work with audio-only playback.
Step back exactly one frame. Equivalent to frame-step -1 seek. Does not work with audio-only playback.
Stop playback. With keep-playlist, the playlist is not cleared.

Property manipulation

Set a property or option to a value.
Add value (default: 1) to a property, clamping at min/max. Scalable: on high-precision inputs (touchpads), the value is scaled to finer steps automatically.
Multiply a property by the given numeric factor.
Cycle a property through its valid values. Wraps around at min/max. Default direction is up.
Cycle through a specific list of values. Each invocation advances to the next value, wrapping around.
The !reverse argument (must come first) cycles in reverse order.
Delete a property. Most properties cannot be deleted.
Modify a list-type option. Operations include append, prepend, remove, clr, etc.

Playlist

Load and play a file or URL.Flags:The fourth argument is a comma-separated opt=value list of per-file options.
Load a playlist file or URL. Same flags as loadfile (replace, append, insert-next, insert-at, play).
Go to the next playlist entry. Flags: weak (default — do nothing on last entry), force (quit on last entry).
Go to the previous playlist entry. Same flags as playlist-next.
Start or restart playback at the given playlist index (0-based). current replays the current entry; none stops playback.
Clear the playlist, except the currently playing file.
Remove a playlist entry by index. current removes the currently playing entry and starts the next.
Move the entry at index1 to the position of index2.
Shuffle the playlist.
Attempt to undo a previous playlist-shuffle. Works only once.

Screenshot

Take a screenshot. Flags (combine with +):
Returns a node map with filename set to the saved path.
Take a screenshot and save it to a specific file. The format is determined by the file extension. Existing files are overwritten. Property expansion is applied to filename.

OSD and text

Show text on the OSD. Properties are expanded (e.g. ${playback-time}). no-osd prefix has no effect on this command.duration is in milliseconds (default: --osd-duration). level is the minimum OSD level required to show the text.
Show the progress bar, elapsed time, and total duration on the OSD.

Scripting and messaging

Send a message to all scripts. Arguments are arbitrary strings. All scripts receive the message.
In Lua, register a handler with mp.register_script_message("my-event", fn).
Like script-message, but send only to the named client. The target name is the script’s internal name (as returned by mp.get_script_name()).
Invoke a key binding registered by a script via mp.add_key_binding. Useful for remapping script bindings.
Load a script at runtime, similar to --script. Returns a client_id field in the result.

Execution

Run an external program. Unlike the shell, arguments are passed directly without shell interpretation. The program is detached — mpv continues immediately without waiting.
Use subprocess when you need to wait for the result or capture output.
Run an external program with full control. Uses named arguments.Key parameters:
The result includes status, stdout, stderr, error_string, and killed_by_us.

Quit

Track manipulation

Filter commands

Configuration commands

Miscellaneous


Property expansion

Properties can be embedded in string arguments with ${property-name}. Use ${=property-name} for the raw (unformatted) value.
Disable expansion with the raw prefix or $> within the string:
Property expansion happens after argument parsing. It applies by default in input.conf commands but not in scripting API calls (use expand-properties prefix to enable it there).

Events

Events are notifications sent from the player core to scripts and IPC clients. See also: Lua scripting events.

start-file

Before a file starts loading. Fields: playlist_entry_id.

file-loaded

After a file is loaded and playback begins.

end-file

After a file is unloaded. Fields: reason (eof, stop, quit, error, redirect), playlist_entry_id.

seek

On any seek (including internal seeks).

playback-restart

Start of playback after seek or file load.

shutdown

mpv is exiting.

property-change

An observed property changed. Fields: name, data.

log-message

A log message. Fields: prefix, level, text.

video-reconfig

Video output or filter reconfigured.

audio-reconfig

Audio output or filter reconfigured.

client-message

A script-message was received. Fields: args (string array).

Hooks

Hooks block the player until all registered handlers call cont() (or return if defer() was not called). They provide synchronous control at specific points. See Lua scripting — hooks for usage details.