title: Mplayer and pipe streaming
body: <p>I'd like to use mplayer to play a stream of files via a named pipe.</p>
  
  <p>From <a href="http://www.mplayerhq.hu/DOCS/HTML/en/streaming.html" rel="nofollow noreferrer">here</a> I read that <em>MPlayer can read from stdin (not named pipes)</em>.</p>
  
  <p>named pipes can still be used in a bash script this way:</p>
  
  <pre><code>mkfifo pipe
  cat pipe | mplayer -cache 1024 -cache-min 10 -really-quiet - &amp;
  cat test.wav &gt; pipe
  </code></pre>
  
  <p>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 <a href="https://stackoverflow.com/questions/8410439/how-to-avoid-echo-closing-fifo-named-pipes-funny-behavior-of-unix-fifos">this</a>, from which the following script, meant to keep the pipe opened, is inspired:</p>
  
  <pre><code>mkfifo pipe
  cat pipe | mplayer -cache 1024 -cache-min 10 -really-quiet - &amp;
  exec 3&gt;pipe
  cat test1.wav &gt;&amp;3
  cat test2.wav &gt;&amp;3
  ..
  exec 3&gt;&amp;- # close the pipe
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>mkfifo pipe
  cat pipe | mplayer -cache 1024 -cache-min 10 -really-quiet - &amp;
  exec 3&gt;pipe
  cat test1.wav &gt;&amp;3
  echo &gt;&amp;3
  ..
  exec 3&gt;&amp;- # close the pipe
  </code></pre>
  
  <p>but still no luck.</p>
  
  <p>Any suggestions on how to use mplayer as a stream player from a named pipe?</p>