Mplayer's FIFO

August 14, 2012 at 9:01AM

I was incredibly excited when I found out that mplayer can be controlled via a FIFO. It wasn't a huge suprise as ofcourse there must be some IPC for mplayer, but still, this is awesome.

First make the FIFO for mplayer:

mkfifo /home/mil/fifos/mplayer

Now, you can control mplayer via the FIFO by specifying a file with -input:

mplayer -input file=/home/mil/fifos/mplayer somemediafiles 
echo "pt_step 1" > /home/mil/fifos/mplayer
echo "pause" > /home/mil/fifos/mplayer

Let's see all the available commands that the FIFO accepts:

mplayer -input cmdlist

And finally if you don't want to have to use the -input file= syntax every time you start mplayer, you can have mplayer by default open the FIFO by specifying the path to your FIFO in your ~/.mplayer/config:

> cat ~/.mplayer/config
# mplayer config file
input=file=/home/mil/fifos/mplayer

And that's all. Use mplayer's FIFO. Here's a link to all the commands the FIFO accepts.