# Usage

## Command line

MPlayer utilizes a complex playtree. It consists of global options written as first, for example

    mplayer -vfm 5

and options written after filenames, that apply only to the given filename/URL/whatever, for example:

    mplayer -vfm 5 movie1.avi movie2.avi -vfm 4

You can group filenames/URLs together using `{` and `}`. It's useful with option `-loop`:

    mplayer { 1.avi -loop 2 2.avi } -loop 3

The above command will play files in this order: 1, 1, 2, 1, 1, 2, 1, 1, 2.

Playing a file:

    mplayer [options] [path/]filename

Playing more files:

    mplayer [default options] [path/]filename1 [options for filename1] filename2 [options for filename2] ...

Playing VCD:

    mplayer [options] vcd://trackno [-cdrom-device /dev/cdrom]

Playing DVD:

    mplayer [options] dvd://titleno [-dvd-device /dev/dvd]

Playing from the WWW:

    mplayer [options] http://site.com/file.asf

(playlists can be used, too)

Playing from RTSP:

    mplayer [options] rtsp://server.example.com/streamName

Examples:

    mplayer -vo x11 /mnt/Films/Contact/contact2.mpg
    mplayer vcd://2 -cdrom-device /dev/hdc
    mplayer -afm 3 /mnt/DVDtrailers/alien4.vob
    mplayer dvd://1 -dvd-device /dev/hdc
    mplayer -abs 65536 -delay -0.4 -nobps ~/movies/test.avi

## 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.

### 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`).

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`.

#### 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

### 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 on the LIRC homepage.

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

The application name for MPlayer is - surprise - `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 makes sense (seek, volume, etc). Here's an excerpt from a sample `.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.

### Slave mode

The slave mode allows you to build simple frontends to MPlayer. When run with the `-slave` option MPlayer will read commands separated by a newline (\n) from stdin. The commands are documented in the slave.txt file.

## Streaming from network or pipes

MPlayer can play files from the network, using the HTTP, FTP, MMS or RTSP/RTP protocol.

Playing works simply by passing the URL on the command line. MPlayer honors the `http_proxy` environment variable, using a proxy if available. Proxies can also be forced:

    mplayer http_proxy://proxy.micorsops.com:3128/http://micorsops.com:80/stream.asf

MPlayer can read from stdin (not named pipes). This can for example be used to play from FTP:

    wget ftp://micorsops.com/something.avi -O - | mplayer -

It's also recommended to enable `-cache` when playing from the network:

    wget ftp://micorsops.com/something.avi -O - | mplayer -cache 8192 -

## Remote streams

Remote streams allow you to access most MPlayer stream type from a remote host. The main purpose of this feature is to make it possible to directly use the CD or DVD drive of another computer on the network (provided you have the required bandwidth). On the downside some stream type (currently TV and MF) are not usable remotely because they are implemented at the demuxer level. It's sad for MF but TV stream would anyway require an insane amount of bandwidth.

### Compiling the server

After having compiled MPlayer go to the `TOOLS/netstream` directory and enter make to build the server binary. You can then copy the netstream binary to the right place on your system (usually `/usr/local/bin` on Linux).

### Using remote streams

First you have to start the server on the computer you intend to remotely access. Currently the server is very basic and doesn't have any commands line arguments so just enter `netstream`. Now you can for example play the second track of a VCD on the server with :

    mplayer -cache 5000 mpst://servername/vcd://2

You can also access files on this server :

    mplayer -cache 5000 mpst://servername//usr/local/movies/lol.avi

Note that paths which aren't starting with a / will be relative to the directory where the server is running. The `-cache` option is not needed but highly recommended.

Be aware that currently the server is not secure at all. So don't complain about the numerous exploits which are possible through this. Instead send some (good) patch to make it better or start writing your own server.

## Edit Decision Lists (EDL)

The edit decision list (EDL) system allows you to automatically skip or mute sections of videos during playback, based on a movie specific EDL configuration file.

This is useful for those who may want to watch a film in "family-friendly" mode. You can cut out any violence, profanity, Jar-Jar Binks .. from a movie according to your own personal preferences. Aside from this, there are other uses, like automatically skipping over commercials in video files you watch.

The EDL file format is pretty bare-bones. Once the EDL system has reached a certain level of maturity, an XML-based file format will probably be implemented (keeping backwards compatibility with previous EDL formats).

The maximum number of EDL entries for the current incarnation of EDL is 1000. If you happen to need more, change the #define MAX_EDL_ENTRIES in the `edl.h` file.

### Using an EDL file

Include the `-edl <filename>` flag when you run MPlayer, with the name of the EDL file you want applied to the video.

### Making an EDL file

The current EDL file format is:

    [begin second] [end second] [action]

Where the seconds are floating-point numbers and the action is either `0` for skip or `1` for mute. Example:

    5.3   7.1    0
    15    16.7   1
    420   422    0

This will skip from second 5.3 to second 7.1 of the video, then mute at 15 seconds, unmute at 16.7 seconds and skip from second 420 to second 422 of the video. These actions will be performed when the playback timer reaches the times given in the file.

To create an EDL file to work from, use the `-edlout <filename>` flag. During playback, when you want to mark the previous two seconds to skip over, hit i. A corresponding entry will be written to the file for that time. You can then go back and fine-tune the generated EDL file.