Home Desktop Tips Using MPlayer for the command line
Using MPlayer for the command line PDF Print E-mail
Written by Fr. Robert   
Saturday, 18 April 2009 05:52
Often people look for a way to play audio files from the command line. My preferred application for the command line is mplayer. I like to use slave mode as it gives me an a way to pause, search, or add files to my playlist.

normal syntax is below.
mplayer -slave -quiet examplefile.ogg

Once the player starts playing you can enter commands to effect playback. Here is is a list of common commands from http://www.mplayerhq.hu/DOCS/tech/slave.txt

get_time_length
Print out the length of the current file in seconds.

get_time_pos
Print out the current position in the file in seconds, as float.

get_percent_pos
Print out the current position in the file, as integer percentage [0-100).

loadfile <file|url> <append>
Load the given file/URL, stopping playback of the current file/URL. If <append> is nonzero playback continues and the file/URL is appended to the current playlist instead.

loadlist <file> <append>
Load the given playlist file, stopping playback of the current file. If <append> is nonzero playback continues and the playlist file is appended to the current playlist instead.

pause
Pause/unpause the playback. quit [value]
Quit MPlayer. The optional integer [value] is used as the return code for the mplayer process (default: 0).

seek <value> [type] Seek to some place in the movie. 0 is a relative seek of +/- seconds (default). 1 is a seek to % in the movie. 2 is a seek to an absolute position of seconds.

volume <value> [abs]
Increase/decrease volume or set it to if [abs] is nonzero.

Example: volume 50 1 sets the volume to 50%
 
Copyright © 2010 Batushka's Web Hosting & Design. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.