I'd like to use mplayer to play a stream of files via a named pipe.
From here I read that MPlayer can read from stdin (not named pipes).
named pipes can still be used in a bash script this way:
mkfifo pipe
cat pipe | mplayer -cache 1024 -cache-min 10 -really-quiet - &
cat test.wav > pipe
the problem with this is that after mplayer receives an EOF, it exits and I cannot pass more than one file, while I'd like mplayer to keep playing files through the pipe. The problem is somehow similar to this, from which the following script, meant to keep the pipe opened, is inspired:
mkfifo pipe
cat pipe | mplayer -cache 1024 -cache-min 10 -really-quiet - &
exec 3>pipe
cat test1.wav >&3
cat test2.wav >&3
..
exec 3>&- # close the pipe
the pipe remains indeed open; however, now despite the cache of mplayer getting filled, I get no playback unless I close the pipe, in which case it plays the first file only. I tried to send, after a file, an EOF signal:
mkfifo pipe
cat pipe | mplayer -cache 1024 -cache-min 10 -really-quiet - &
exec 3>pipe
cat test1.wav >&3
echo >&3
..
exec 3>&- # close the pipe
but still no luck.
Any suggestions on how to use mplayer as a stream player from a named pipe?