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
Theinput.conf file maps keys to commands. It lives at ~/.config/mpv/input.conf.
https://github.com/mpv-player/mpv/blob/master/etc/input.conf.
List all available key names:
Syntax
- Multiple commands can be chained with
; #begins a comment (outside quoted strings); useSHARPto 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
| Modifier | Example |
|---|---|
Shift+ | Shift+LEFT |
Ctrl+ | ctrl+q |
Alt+ | Alt+F4 |
Meta+ | Meta+a |
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)
| Name | Description |
|---|---|
LEFT, RIGHT, UP, DOWN | Arrow keys |
ENTER, ESC, TAB, BS | Control keys |
SPACE | Space bar |
KP* | Numpad keys (e.g. KP0, KP_ENTER) |
MOUSE_BTN0–MOUSE_BTN19 | Mouse buttons |
WHEEL_UP, WHEEL_DOWN, WHEEL_LEFT, WHEEL_RIGHT | Mouse wheel |
CLOSE_WIN | Window close button |
GAMEPAD_* | Gamepad inputs (SDL backend) |
UNMAPPED | Any unmapped key |
ANY_UNICODE | Any key that produces text |
Input command prefixes
Prefixes go between the key name and the command ininput.conf. Multiple prefixes are separated by spaces.
| Prefix | Description |
|---|---|
osd-auto | Default OSD behavior for this command (default for input.conf) |
no-osd | Suppress OSD for this command |
osd-bar | Show a progress bar |
osd-msg | Show a text OSD message |
osd-msg-bar | Show both a message and a bar |
raw | Do not expand ${property} placeholders in string arguments |
expand-properties | Expand ${property} in all string arguments (default for input.conf) |
repeatable | Force key repeat for this command |
nonrepeatable | Force disable key repeat |
nonscalable | Disable high-resolution scaling for scalable commands |
async | Run command asynchronously if possible |
sync | Run command synchronously if possible |
Property system
Properties allow reading and writing player state at runtime. They are used by:set,add,cycle,multiplycommands${property}expansion inshow-text,print-text- Scripting APIs (
mp.get_property,mp.observe_property, etc.) - IPC
get_property/set_propertycommands
--). Properties marked (RW) can be written; others are read-only.
Key properties
Playback state
| Property | Type | Description |
|---|---|---|
pause (RW) | bool | Paused state |
speed (RW) | number | Playback speed multiplier |
time-pos (RW) | number | Current position in seconds |
playback-time (RW) | number | Alias for time-pos |
percent-pos (RW) | number | Position as 0–100 percent |
duration | number | File duration in seconds |
time-remaining | number | Remaining time in seconds |
Audio / video
| Property | Type | Description |
|---|---|---|
volume (RW) | number | Audio volume (0–100+) |
mute (RW) | bool | Mute state |
fullscreen (RW) | bool | Fullscreen state |
video-zoom (RW) | number | Video zoom factor |
brightness (RW) | number | Video brightness (−100 to 100) |
contrast (RW) | number | Video contrast |
sub-delay (RW) | number | Subtitle delay in seconds |
File information
| Property | Type | Description |
|---|---|---|
filename | string | Filename without path |
path | string | Full path of current file |
media-title | string | Title tag or filename |
file-format | string | Format name (e.g. matroska) |
duration | number | Total duration in seconds |
Playlist
| Property | Type | Description |
|---|---|---|
playlist-pos (RW) | integer | Current playlist index (0-based) |
playlist-count | integer | Number of playlist entries |
playlist | list | Full playlist as a list |
loop-playlist (RW) | string | Loop mode (no, inf, force) |
loop-file (RW) | string | File loop (no, inf, integer) |
Command reference
Playback control
seek <target> [<flags>]
seek <target> [<flags>]
+):| Flag | Description |
|---|---|
relative (default) | Seek relative to current position; negative = backwards |
absolute | Seek to exact time; negative = from end of file |
absolute-percent | Seek to a percentage of total duration |
relative-percent | Seek relative to current position in percent |
keyframes | Fast seek to nearest keyframe |
exact | Precise (slow) seek |
keyframes is used for relative seeks and exact for absolute seeks. Combine flags:revert-seek [<flags>]
revert-seek [<flags>]
mark (mark current position for revert), mark-permanent (always revert to this position until changed).frame-step [<frames>] [<flags>]
frame-step [<frames>] [<flags>]
play (default — play then pause), seek (precise seek), mute (like play but muted). Does not work with audio-only playback.frame-back-step
frame-back-step
frame-step -1 seek. Does not work with audio-only playback.stop [<flags>]
stop [<flags>]
keep-playlist, the playlist is not cleared.Property manipulation
set <name> <value>
set <name> <value>
add <name> [<value>]
add <name> [<value>]
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 <name> <factor>
multiply <name> <factor>
cycle <name> [up|down]
cycle <name> [up|down]
up.cycle-values [!reverse] <property> <value1> [<value2> ...]
cycle-values [!reverse] <property> <value1> [<value2> ...]
!reverse argument (must come first) cycles in reverse order.del <name>
del <name>
change-list <name> <operation> <value>
change-list <name> <operation> <value>
append, prepend, remove, clr, etc.Playlist
loadfile <url> [<flags> [<index> [<options>]]]
loadfile <url> [<flags> [<index> [<options>]]]
| Flag | Description |
|---|---|
replace (default) | Stop current file and play the new one |
append | Add to end of playlist |
append+play | Append and start playing if idle |
insert-next | Insert directly after current entry |
insert-at | Insert at the given index (third arg) |
play | Combine with append/insert-* to force playback start |
opt=value list of per-file options.loadlist <url> [<flags> [<index>]]
loadlist <url> [<flags> [<index>]]
loadfile (replace, append, insert-next, insert-at, play).playlist-next [<flags>]
playlist-next [<flags>]
weak (default — do nothing on last entry), force (quit on last entry).playlist-prev [<flags>]
playlist-prev [<flags>]
playlist-next.playlist-play-index <index|current|none> [preserve-options]
playlist-play-index <index|current|none> [preserve-options]
current replays the current entry; none stops playback.playlist-clear
playlist-clear
playlist-remove <index>
playlist-remove <index>
current removes the currently playing entry and starts the next.playlist-move <index1> <index2>
playlist-move <index1> <index2>
index1 to the position of index2.playlist-shuffle
playlist-shuffle
playlist-unshuffle
playlist-unshuffle
playlist-shuffle. Works only once.Screenshot
screenshot [<flags>]
screenshot [<flags>]
+):| Flag | Description |
|---|---|
subtitles (default) | Video with subtitles |
video | Raw video, no OSD or subtitles |
scaled | Video at current display resolution |
window | Entire mpv window (alias for scaled+subtitles+osd) |
osd | Include OSD |
each-frame | Screenshot every frame (toggle; run again to stop) |
filename set to the saved path.screenshot-to-file <filename> [<flags>]
screenshot-to-file <filename> [<flags>]
filename.OSD and text
show-text <text> [<duration>|-1 [<level>]]
show-text <text> [<duration>|-1 [<level>]]
${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-progress
show-progress
print-text <text>
print-text <text>
Scripting and messaging
script-message [<arg1> [<arg2> ...]]
script-message [<arg1> [<arg2> ...]]
mp.register_script_message("my-event", fn).script-message-to <target> [<arg1> ...]
script-message-to <target> [<arg1> ...]
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()).script-binding <name> [<arg>]
script-binding <name> [<arg>]
mp.add_key_binding. Useful for remapping script bindings.load-script <filename>
load-script <filename>
--script. Returns a client_id field in the result.Execution
run <command> [<arg1> ...]
run <command> [<arg1> ...]
subprocess when you need to wait for the result or capture output.subprocess
subprocess
| Parameter | Type | Description |
|---|---|---|
args | string array | Command and arguments |
playback_only | bool | Kill process when playback ends (default: true) |
capture_stdout | bool | Capture stdout (default: false) |
capture_stderr | bool | Capture stderr (default: false) |
capture_size | integer | Max bytes to capture per stream (default: 64 MB) |
stdin_data | string | Data to feed to stdin |
env | string array | Environment variables (NAME=VALUE format) |
detach | bool | Run detached (default: false) |
status, stdout, stderr, error_string, and killed_by_us.Quit
| Command | Description |
|---|---|
quit [<code>] | Exit mpv with optional exit code |
quit-watch-later [<code>] | Exit and save playback position for resuming |
Track manipulation
| Command | Description |
|---|---|
sub-add <url> [<flags> [<title> [<lang>]]] | Load an external subtitle file |
sub-remove [<id>] | Remove subtitle track (external only) |
sub-reload [<id>] | Reload subtitle track (external only) |
sub-step <skip> [<flags>] | Adjust subtitle timing by N events |
sub-seek <skip> [<flags>] | Seek to N-th subtitle event |
audio-add <url> [<flags> [<title> [<lang>]]] | Load external audio track |
audio-remove [<id>] | Remove audio track |
audio-reload [<id>] | Reload audio track |
video-add <url> [<flags> [<title> [<lang>]]] | Load external video track |
video-remove [<id>] | Remove video track |
Filter commands
| Command | Description |
|---|---|
vf <op> <value> | Modify video filter chain (set, add, toggle, remove, clr) |
af <op> <value> | Modify audio filter chain (same ops as vf) |
vf-command <label> <cmd> <arg> | Send a command to a lavfi video filter |
af-command <label> <cmd> <arg> | Send a command to a lavfi audio filter |
Configuration commands
| Command | Description |
|---|---|
apply-profile <name> [apply|restore] | Apply or restore a named config profile |
load-config-file <filename> | Load an additional config file at runtime |
load-input-conf <filename> | Load an additional input config file at runtime |
write-watch-later-config | Save resume position without quitting |
Miscellaneous
| Command | Description |
|---|---|
ignore | Do nothing (use to block a key without disabling all defaults) |
drop-buffers | Flush audio/video/demuxer buffers and restart |
ab-loop | Cycle A-B loop states (set A, set B, clear) |
keypress <name> | Simulate a key press event |
keydown <name> | Simulate key-down (with repeat) |
keyup [<name>] | Simulate key-up, stopping repeat |
keybind <name> <cmd> | Dynamically bind a key to a command |
begin-vo-dragging | Begin window dragging (if VO supports it) |
Property expansion
Properties can be embedded in string arguments with${property-name}. Use ${=property-name} for the raw (unformatted) value.
raw prefix or $> within the string:
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
playlist_entry_id.file-loaded
end-file
reason (eof, stop, quit, error, redirect), playlist_entry_id.seek
playback-restart
shutdown
property-change
name, data.log-message
prefix, level, text.video-reconfig
audio-reconfig
client-message
script-message was received. Fields: args (string array).Hooks
Hooks block the player until all registered handlers callcont() (or return if defer() was not called). They provide synchronous control at specific points.
| Hook | Timing |
|---|---|
on_load | Before opening a file |
on_load_fail | After file open fails |
on_preloaded | After open, before track selection |
on_loaded | After track selection, before playback |
on_unload | Before closing a file |
on_before_start_file | Before start-file event |
on_after_end_file | After end-file event |