How to map MPV Player for game controllers?

Hello, I’d like to map play/pause to button A and close/exit to buttom B for mpv player in emuelec.
There is a way to do it? Please tell me.

FYI I finally got it.
You just need to add an input.cfg file into \\Emuelec\configfiles\mpv with the actions for Remote Controller (Vontar x3) and Game Controller (XBox 360 type)

#MPV MAPPING FOR IR REMOTE AND GAME CONTROLLER

#Common keys
RIGHT seek +10
LEFT seek -10
DOWN seek -60
UP seek +60

#Remote Controller
ENTER cycle pause # Pause/Resume
ESC quit # Exit video

#Game controller
x cycle pause # Pause/Resume A
z quit # Exit video B
c add volume -1 # Decrease volume X
a add volume 1 # Increase volume Y
s cycle mute # Mute sound R1

I’d like to identify which keyboard letter is the L1 button to use L1 and R1 as Vol- and Vol+ that is more intuitive, but I was not able to do it. I tried all the keyboard keys, caps, numbers and symbos. I think it doesn’t exist an associated key to L1. So I finished leaving R1 as Mute and X and Y for volume control.

Well, when I am using mplayer on EmuElec 4.6, my controller (PS5 Dualshock connected via 8bitdo-USB-dongle) has the following (pre-configured ?) inputs:

UP: jump forward some seconds (15 seconds ?)
DOWN: jump back some seconds (15 seconds ?)

RIGHT: forward some seconds
LEFT: backward some seconds

LEFT THUMB: PAUSE / PLAY
X: SUB DELAY -100 ms
O: SUB DELAY +100 ms
R1: save screenshot

That’s right. You need to create that mpv folder. I left directions pad as is. But I didn’t like those pre-configured controls. I just need vol control, play/pause and exit. No screenshot, no sub delay. What I mean is that you can remap the controls using input.cfg file.

Okay, I figured it out, your filename was wrong. It’s not input.cfg, but input.conf

I am going to try out some combinations and try to find out which key name is for L1.

With my PS5-controller connected, MPlayer maps the “create”-button to QUIT and the option button, the left thumb and the homebutton to PAUSE/PLAY.

So I think perhaps there is a chance to find the right code for R1…

Oh. You were right. It is input.conf. Excuse me for the mistake. I just realizad that I can’t edit my previous post to avoid confusión for other users. Thanks anyway.

No problem. I think I might be up to something… it seems that the option/playstation-button is mapped to the ENTER command. And the create button seems to be mapped to ESC.
Perhaps I will find the right keymap for R1 on this list:

That is not MPV. You should use this instead https://github.com/mpv-player/mpv/blob/master/etc/input.conf

Thank you… But you wrote before that you already tried all of the key combinations (from the input.conf)? And none of them worked? If so, there is no need for me to repeat the endeavour…

I just managed to run “mpv --input-test --force-window --idle” via ssh in Emuelec and was able to test my controller buttons.

L1 is strangely NOT RECOGNIZED AT ALL, unfortunately, but at least I found the following keybinds out:

END #R2
HOME #L2
MBTN_RIGHT #LEFT THUMB

The whole left analog stick is seen by mpv as “Key MOUSE_MOVE”.
That means that the movement of the left analog stick seems to be defined as a mouse (with the thumb as a right mouse button). So I don’t think it can be used for any command (except for the mouse button).

If you use the thumb on the right analog stick while moving it in a direction, it’s defined as:
Key Shift+LEFT, UP, RIGHT or DOWN

Hope that helps. At least you can now put the volume controls on R2 and L2

thaks for the info! That is a great advance, and a faster way to map the gamecontroller keys than test and error. My problem is that I use a SNES style (Xbox compatible) gamepad so I only have L1 and R1. I think that MPV creator forgot to give a default action to the function related to L1 or doesn’t need more shortcuts for any reason and leave this button excluded