3.2. Control
Prev | Chapter 3. Usage | Next

## 3.2. Control

MPlayer has a fully configurable, command driven, control layer which lets you control MPlayer with keyboard, mouse, joystick or remote control (using LIRC). See the man page for the complete list of keyboard controls.

### 3.2.1. Controls configuration

MPlayer allows you bind any key/button to any MPlayer command using a simple config file. The syntax consist of a key name followed by a command. The default config file location is `$HOME/.mplayer/input.conf` but it can be overridden using the `-input `conf`` option (relative path are relative to `$HOME/.mplayer`).

Example 3.1. A simple input control file

    ##
    ## MPlayer input control file
    ##

    RIGHT seek +10
    LEFT seek -10
    - audio_delay 0.100
    + audio_delay -0.100
    q quit
    > pt_step 1
    < pt_step -1
    ENTER pt_step 1 1

#### 3.2.1.1. Key names

You can have a full list by running mplayer -input keylist.

Keyboard

- Any printable character
- `SPACE`
- `ENTER`
- `TAB`
- `CTRL`
- `BS`
- `DEL`
- `INS`
- `HOME`
- `END`
- `PGUP`
- `PGDWN`
- `ESC`
- `RIGHT`
- `LEFT`
- `UP`
- `DOWN`

Mouse (only supported under X)

- `MOUSE_BTN0` (Left button)
- `MOUSE_BTN1` (Right button)
- `MOUSE_BTN2` (Middle button)
- `MOUSE_BTN3` (Wheel)
- `MOUSE_BTN4` (Wheel)
- ...
- `MOUSE_BTN9`

Joystick (support must be enabled at compile time)

- `JOY_RIGHT` or `JOY_AXIS0_PLUS`
- `JOY_LEFT` or `JOY_AXIS0_MINUS`
- `JOY_UP` or `JOY_AXIS1_MINUS`
- `JOY_DOWN` or `JOY_AXIS1_PLUS`
- `JOY_AXIS2_PLUS`
- `JOY_AXIS2_MINUS`
- ...
- `JOY_AXIS9_PLUS`
- `JOY_AXIS9_MINUS`

#### 3.2.1.2. Commands

You can have a full list of known commands by running mplayer -input cmdlist.

- `seek` (int) val [(int) type=0]

  Seek to some place in the movie. Type `0` is a relative seek of +/- val seconds. Type `1` seek to val % in the movie.

- `audio_delay` (float) val

  Adjust the audio delay of val seconds

- `quit`

  Quit MPlayer

- `pause`

  Pause/unpause the playback

- `grap_frames`

  Somebody know ?

- `pt_step` (int) val [(int) force=0]

  Go to next/previous entry in playtree. Val sign tell the direction. If no other entry is available in the given direction it won't do anything unless force is non 0.

- `pt_up_step` (int) val [(int) force=0]

  Like pt_step but it jump to next/previous in the parent list. It's useful to break inner loop in the playtree.

- `alt_src_step` (int) val

  When more than one source is available it select the next/previous one (only supported by asx playlist).

- `sub_delay` (float) val [(int) abs=0]

  Adjust the subtitles delay of +/- val seconds or set it to val seconds when abs is non zero.

- `osd` [(int) level=-1]

  Toggle osd mode or set it to level when level > 0.

- `volume` (int) dir

  Increase/decrease volume

- `contrast` (int) val [(int) abs=0]
- `brightness` (int) val [(int) abs=0]
- `hue` (int) val [(int) abs=0]

- `saturation` (int) val [(int) abs=0]

  Set/Adjust video parameters. Val range from -100 to 100.

- `frame_drop` [(int) type=-1]

  Toggle/Set frame dropping mode.

- `sub_visibility`

  Adjust subtitles visibility.

- `sub_pos` (int) val

  Adjust subtitles position.

- `vobsub_lang`

  Change the language of VobSub subtitles.

- `vo_fullscreen`

  Switch fullscreen mode.

- `vo_ontop`

  Toggle stay-on-top. Supported by drivers which use X11, except SDL, as well as directx and gl2 under Windows.

- `tv_step_channel` (int) dir

  Select next/previous tv channel.

- `tv_step_norm`

  Change TV norm.

- `tv_step_chanlist`

  Change channel list.

- `gui_loadfile`
- `gui_loadsubtitle`
- `gui_about`
- `gui_play`
- `gui_stop`
- `gui_playlist`
- `gui_preferences`

- `gui_skinbrowser`

  GUI actions

### 3.2.2. Control from LIRC

Linux Infrared Remote Control - use an easy to build home-brewn IR-receiver, an (almost) arbitrary remote control and control your linux box with it! More about it at www.lirc.org.

If you have installed the lirc-package, configure will autodetect it. If everything went fine, MPlayer will print a message like "`Setting up lirc support...`" on startup. If an error occurs it will tell you. If it doesn't tell you anything about LIRC there's no support compiled in. That's it :-)

The application name for MPlayer is - oh wonder - `mplayer`. You can use any mplayer commands and even pass more than one command by separating them with `\n`. Don't forget to enable the repeat flag in `.lircrc` when it make sense (seek, volume, etc). Here's an excerpt from my `.lircrc`:

    begin
         button = VOLUME_PLUS
         prog = mplayer
         config = volume 1
         repeat = 1
    end

    begin
        button = VOLUME_MINUS
        prog = mplayer
        config = volume -1
        repeat = 1
    end

    begin
        button = CD_PLAY
        prog = mplayer
        config = pause
    end

    begin
        button = CD_STOP
        prog = mplayer
        config = seek 0 1\npause
    end

If you don't like the standard location for the lirc-config file (`~/.lircrc`) use the `-lircconf `filename`` switch to specify another file.

### 3.2.3. Slave mode

The slave mode allow you to build simple frontend to MPlayer. When enabled (with the `-slave` option) MPlayer will read commands separated by new line (\n) from stdin.

Prev | Up | Next
3.1. Command line | Home | 3.3. Streaming from network or pipes