3

How can I bind character keys to command? Like binding RIGHT seek +5 and something like that but with character keys like a, b, c etc.

UPDATE

This answer (which this question is marked as duplicate to that question) is talking about to configure keybinding like:

LEFT seek -5
RIGHT seek +5

that I already know. What I'm asking here is not to use LEFT or RIGHT as key bindings. I'm asking about using H or L as key bindings. Which I've tried this:

H seek -5
L seek +5

and doesn't work. I know that the mplayer -input keylist command not listing any character keys as available key. What I'm asking here is: is it possible to bind charater keys to command in Mplayer?

2
  • 1
    @Helio updated about my specific question.
    – Mas Bagol
    Apr 8, 2015 at 11:33
  • Sorry, I misunderstood your post.
    – 0x2b3bfa0
    Apr 8, 2015 at 21:36

2 Answers 2

2

The quick answer is no, however you can edit the source code or make a feature request.

  • The mplayer documentation says this:

    You can get a full list of supported key names by running mplayer -input keylist and a full list of available commands by running mplayer -input cmdlist.

  • In my computer mplayer -input keylist returns this:

    SPACE
    SHARP
    ENTER
    TAB
    CTRL
    BS
    DEL
    INS
    HOME
    END
    PGUP
    PGDWN
    ESC
    RIGHT
    LEFT
    DOWN
    UP
    F1
    F2
    F3
    F4
    F5
    F6
    F7
    F8
    F9
    F10
    F11
    F12
    KP0
    KP1
    KP2
    KP3
    KP4
    KP5
    KP6
    KP7
    KP8
    KP9
    KP_DEL
    KP_DEC
    KP_INS
    KP_ENTER
    MOUSE_BTN0
    MOUSE_BTN1
    MOUSE_BTN2
    MOUSE_BTN3
    MOUSE_BTN4
    MOUSE_BTN5
    MOUSE_BTN6
    MOUSE_BTN7
    MOUSE_BTN8
    MOUSE_BTN9
    MOUSE_BTN10
    MOUSE_BTN11
    MOUSE_BTN12
    MOUSE_BTN13
    MOUSE_BTN14
    MOUSE_BTN15
    MOUSE_BTN16
    MOUSE_BTN17
    MOUSE_BTN18
    MOUSE_BTN19
    MOUSE_BTN0_DBL
    MOUSE_BTN1_DBL
    MOUSE_BTN2_DBL
    MOUSE_BTN3_DBL
    MOUSE_BTN4_DBL
    MOUSE_BTN5_DBL
    MOUSE_BTN6_DBL
    MOUSE_BTN7_DBL
    MOUSE_BTN8_DBL
    MOUSE_BTN9_DBL
    MOUSE_BTN10_DBL
    MOUSE_BTN11_DBL
    MOUSE_BTN12_DBL
    MOUSE_BTN13_DBL
    MOUSE_BTN14_DBL
    MOUSE_BTN15_DBL
    MOUSE_BTN16_DBL
    MOUSE_BTN17_DBL
    MOUSE_BTN18_DBL
    MOUSE_BTN19_DBL
    JOY_UP
    JOY_DOWN
    JOY_LEFT
    JOY_RIGHT
    JOY_AXIS0_PLUS
    JOY_AXIS0_MINUS
    JOY_AXIS1_PLUS
    JOY_AXIS1_MINUS
    JOY_AXIS2_PLUS
    JOY_AXIS2_MINUS
    JOY_AXIS3_PLUS
    JOY_AXIS3_MINUS
    JOY_AXIS4_PLUS
    JOY_AXIS4_MINUS
    JOY_AXIS5_PLUS
    JOY_AXIS5_MINUS
    JOY_AXIS6_PLUS
    JOY_AXIS6_MINUS
    JOY_AXIS7_PLUS
    JOY_AXIS7_MINUS
    JOY_AXIS8_PLUS
    JOY_AXIS8_MINUS
    JOY_AXIS9_PLUS
    JOY_AXIS9_MINUS
    JOY_BTN0
    JOY_BTN1
    JOY_BTN2
    JOY_BTN3
    JOY_BTN4
    JOY_BTN5
    JOY_BTN6
    JOY_BTN7
    JOY_BTN8
    JOY_BTN9
    AR_PLAY
    AR_PLAY_HOLD
    AR_NEXT
    AR_NEXT_HOLD
    AR_PREV
    AR_PREV_HOLD
    AR_MENU
    AR_MENU_HOLD
    AR_VUP
    AR_VDOWN
    POWER
    MENU
    PLAY
    PAUSE
    PLAYPAUSE
    STOP
    FORWARD
    REWIND
    NEXT
    PREV
    VOLUME_UP
    VOLUME_DOWN
    MUTE
    XF86_PAUSE
    XF86_STOP
    XF86_PREV
    XF86_NEXT
    CLOSE_WIN
    

Source: http://www.mplayerhq.hu/DOCS/HTML/en/control.html

2

The answer is YES you can. Put you bindings in a file named ~/.mplayer/input.config. Here is my file dumped out for you (with my personal mods):

    ##
    ## MPlayer input control file
    ##
    ## You are able to redefine default keyboard/joystick/mouse/LIRC bindings, or
    ## add new ones here.
    ## See DOCS/tech/slave.txt for possible commands that can be bound.
    ## Also see mplayer -input cmdlist for other possible options.
    ## The file should be placed in the $HOME/.mplayer directory.
    ##
    ## If you wish to unbind a key, use key ignore.
    ## e.g. ENTER ignore
    ##

    RIGHT seek +2
    LEFT seek -2
    DOWN volume -1
    UP volume +1
    PGUP seek 300
    PGDWN seek -300
    m mute
    # switch_audio          # switch audio streams
    + audio_delay 0.100
    = audio_delay 0.100
    - audio_delay -0.100
    [ speed_mult 0.9091 # scale playback speed
    ] speed_mult 1.1
    { speed_mult 0.5
    } speed_mult 2.0
    BS speed_set 1.0    # reset speed to normal
    q quit
    ENTER osd       #pt_step 1 1 (skip to next file (too much for an edge key))
    ESC pause
    p pause
    . frame_step            # advance one frame and pause
    SPACE pause
    HOME pt_up_step 1
    END pt_up_step -1
    > pt_step 1             # skip to next file
    < pt_step -1            #         previous
    INS alt_src_step 1
    DEL alt_src_step -1
    o osd
    I osd_show_property_text "${filename}"     # display filename in osd
    P osd_show_progression
    z sub_delay -0.1        # subtract 100 ms delay from subs
    x sub_delay +0.1        # add
    9 volume -1
    / volume -1
    0 volume 1
    * volume 1
    1 contrast -1
    2 contrast 1
    3 brightness -1
    4 brightness 1
    5 hue -1
    6 hue 1
    7 saturation -1
    8 saturation 1
    ( balance -0.1          # adjust audio balance in favor of left
    ) balance +0.1          #                                  right
d frame_drop
D step_property deinterlace  # toggle deinterlacer, requires -vf yadif or kerndeint
r sub_pos -1            # move subtitles up
t sub_pos +1            #                down
#? sub_step +1      # immediately display next subtitle
#? sub_step -1      #                     previous
#? sub_scale +0.1   # increase subtitle font size
#? sub_scale -0.1   # decrease subtitle font size
f vo_fullscreen
f11 vo_fullscreen   # to match my WinVice mod, both to match FireFox - F11 full screen
T vo_ontop              # toggle video window ontop of other windows
w panscan -0.1          # zoom out with -panscan 0 -fs
e panscan +0.1          #      in
c capturing             # save (and append) file/stream to stream.dump with -capture
s screenshot            # take a png screenshot with -vf screenshot
                        # S will take a png screenshot of every frame

h tv_step_channel 1
l tv_step_channel -1
n tv_step_norm
b tv_step_chanlist

##
## Joystick section
## WARNING: joystick support has to be explicitly enabled at
##          compiletime with --enable-joystick
##

JOY_RIGHT seek 10
JOY_LEFT seek -10
JOY_UP seek 60
JOY_DOWN seek -60
JOY_BTN0 pause
JOY_BTN1 osd
JOY_BTN2 volume 1
JOY_BTN3 volume -1
JOY_BTN4 set_menu main

##
## Apple Remote section
##
## To use OSD menu with Apple Remote, set key AR_MENU to any OSD menu command,
## or just comment out the 'AR_MENU osd' line and uncomment the line after it.
##

AR_PLAY pause
AR_PLAY_HOLD quit
AR_NEXT seek 30
AR_NEXT_HOLD seek 120
AR_PREV seek -10
AR_PREV_HOLD seek -120
AR_MENU menu up
#AR_MENU menu cancel
AR_MENU_HOLD mute
AR_VUP volume 1
AR_VDOWN volume -1

##
## OSD Menu movement keys
##
## If you are using only the keyboard it is enough to define one command (like
## "menu up"), because then that single key will display the menu, which can
## then be navigated with the cursor keys and ENTER (defined in menu.conf).
##
## LIRC users should bind each "menu" command to a button on their remote.
##
## The set_menu command directly displays the (sub)menu specified as
## its argument. Usage should be self-explanatory (although not likely
## to be needed), after reading input.conf.
##

#MOUSE_BTN0 menu up
#y menu down
#y menu ok
#y menu cancel
#y menu hide
#y set_menu general_pref

##
## DVDNAV
## Requires dvdnav://
##

UP    {dvdnav} dvdnav up          # DVDNav UP
DOWN  {dvdnav} dvdnav down        # DVDNav DOWN
LEFT  {dvdnav} dvdnav left        # DVDNav LEFT
RIGHT {dvdnav} dvdnav right       # DVDNav RIGHT
ESC   {dvdnav} dvdnav menu        # DVDNav MENU
ENTER {dvdnav} dvdnav select      # DVDNav SELECT (ok)
BS    {dvdnav} dvdnav prev        # DVDNav PREVIOUS menu (in the order chapter->title->root)

AR_VUP    {dvdnav} dvdnav up      # DVDNav UP
AR_VDOWN  {dvdnav} dvdnav down    # DVDNav DOWN
AR_PREV   {dvdnav} dvdnav left    # DVDNav LEFT
AR_NEXT   {dvdnav} dvdnav right   # DVDNav RIGHT
AR_MENU   {dvdnav} dvdnav menu    # DVDNav MENU
AR_PLAY   {dvdnav} dvdnav select  # DVDNav SELECT (ok)

#? seek_chapter -1      # skip to previous dvd chapter
#? seek_chapter +1      #         next

##
## Advanced seek
## Uncomment the following lines to be able to seek to n% of the media with
## the Fx keys.
##
#F1 seek 10 1
#F2 seek 20 1
#F3 seek 30 1
#F4 seek 40 1
#F5 seek 50 1
#F6 seek 60 1
#F7 seek 70 1
#F8 seek 80 1
#F9 seek 90 1
1
  • Thanks, worked great for me. There's even a run command to execute shell commands. Jan 19, 2018 at 20:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .