How to Customize mpv Keyboard Shortcuts with input.conf?
The mpv media player is highly praised for its minimalist interface
and powerful command-line foundations, allowing users to deeply
personalize their viewing experience. By utilizing the
input.conf configuration file, you can easily remap
existing hotkeys, create brand-new shortcuts, and bind complex commands
to single keystrokes. This guide will walk you through locating your
configuration directory, creating the file, and writing custom key
bindings to take full control of your mpv playback.
Locating or Creating the input.conf File
Before you can add your custom shortcuts, you need to place the
input.conf file in the correct configuration directory. The
location varies depending on your operating system:
- Windows:
C:\Users\YourUsername\AppData\Roaming\mpv\or inside a folder namedportable_configin the same directory as yourmpv.exeif you are using a portable installation. - macOS:
/Users/YourUsername/.config/mpv/ - Linux:
/home/YourUsername/.config/mpv/
Note: If the
input.conffile does not exist in that folder, simply create a new blank text file, rename it toinput.conf, and ensure the file extension is.confand not.txt.
Syntax for Customizing Shortcuts
The syntax inside input.conf is straightforward. Each
line represents a single shortcut and follows a strict pattern:
Key Command. You can also use the # symbol
to add comments for organizing your file.
# Syntax template:
[KEY] [COMMAND] [ARGUMENTS]
Common Examples of Custom Key Bindings
To give you an idea of how to structure your file, here are some
popular modifications you can copy and paste directly into your
input.conf:
| Desired Action | Key to Bind | Line to Add to input.conf |
|---|---|---|
| Skip forward 5 seconds | Right Arrow | RIGHT seek 5 |
| Skip backward 5 seconds | Left Arrow | LEFT seek -5 |
| Increase volume by 2% | Mouse Wheel Up | WHEEL_UP add volume 2 |
| Decrease volume by 2% | Mouse Wheel Down | WHEEL_DOWN add volume -2 |
| Cycle through subtitle tracks | āsā Key | s cycle sub |
| Toggle fullscreen | Double Click | MBTN_LEFT_DBL cycle fullscreen |
Advanced Customization and Multi-command Adjustments
You can also bind keys to specific absolute values or chain commands
together using the ; separator. For instance, if you want a
key that instantly resets the playback speed back to normal and displays
a message, you can write:
SHAPE speed set 1.0; show-text "Speed reset to normal"
Once you have finished adding your desired shortcuts, save the
input.conf file and restart mpv. Your new custom keyboard
shortcuts will immediately take effect.