[MPlayer-users] mplayer via ssh on home network

Jan Knutar jknutar at nic.fi
Sun May 22 16:24:01 CEST 2005


On Saturday 21 May 2005 16:04, Cheryl Homiak wrote:

> a more direct way of doing this via the mplayer command-line itself.

I've used esd successfully in the past for doing what you described.

However, here's something that might work without esd:

First, setup a fifo, on the machine you will be executing mplayer on:
mkfifo $HOME/soundfifo

Then, the line that transfers the sound:
while true; do cat $HOME/soundfifo | ssh user at othermachine sox -t raw -r 44100 -w -s -c 2 - -t ossdsp /dev/dsp ; done

I recommend you setup pubkey authentication so you don't need to type
in password all the time.

Then, in a different window/terminal/screen, on the machine on which you
will execute mplayer:
mplayer -srate 44100 -af resample=44100 -ao pcm:nowaveheader:file=$HOME/soundfifo file.mp3


I just tested this between my P3 733Mhz and my Amd 5x86 133Mhz. The AMD has
a crappy sound board and the processor was a bit slow to do the standard 3Des ssh
encryption, so I added -c arcfour to the ssh command
(ssh -c arcfour user at othermachine, etc...).

Here is another way, that does not require ssh, but requires netcat:

On the machine through which you want sound:

while true; do nc -l -p 5086 | sox -t raw -r 44100 -w -s -c 2 - -t ossdsp /dev/dsp ; done

(5086 is the port number, use any that's free...)

On the machine on which you will execute mplayer:

You will need the same fifo as in the version using ssh.

mkfifo $HOME/soundfifo

Then, transfering the sound:

while true; do cat $HOME/soundfifo | nc othermachine 5086

And in another terminal/screen/etc:

mplayer -srate 44100 -af resample=44100 -ao pcm:nowaveheader:file=$HOME/soundfifo


Neither version seems to be totally reliable though... I get lots of
"Broken Pipe" errors with the second version and playback only
succeeds half the time, but ah well... When playing through a
playlist with -shuffle, I guess it wont be too noticeable...




More information about the MPlayer-users mailing list