title: How can I immediately override a fallback file in Icecast when the source connects?
body: <h1>Buffering prevents switching back quickly</h1>
  <p>My Icecast <em>fallback-mount</em> file works to play audio when the source mount is disconnected. When the source reconnects, I have <em>fallback-override</em> set to move listeners back to the proper stream. That works, but it doesn't work immediately because the fallback file has been buffered by the clients listening.</p>
  <p>How can I make the audio switch in less than a second?</p>
  <h2>Details</h2>
  <p>I have an Icecast 2.4.4 &quot;radio&quot; station set up with a <em>fallback-mount</em> set up to play an off-the-air audio file when the DJ's source is not connected. That works, with one problem: Icecast sends the file over five times faster than it takes to play, which means a very large buffer can accrue on the client, delaying the time it takes before they hear the DJ once the source is connected.</p>
  <p>For example, imagine a listener who tunes in one minute before the DJ starts playing. While connected for 60 seconds, 6 minutes of the off-the-air audio file has been buffered in their client software. That means that, once the DJ is broadcasting, the listener will not hear them for five minutes. On the other hand, a listener who tunes in after the DJ starts will hear them live.</p>
  <h2>icecast.xml</h2>
  <p>Here is the relevant portion of my config file:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;icecast&gt;
      &lt;mount&gt;
          &lt;mount-name&gt;/stream&lt;/mount-name&gt;
          &lt;username&gt;source&lt;/username&gt;
          &lt;password&gt;hackme&lt;/password&gt;
          &lt;max-listeners&gt;1024&lt;/max-listeners&gt;
          &lt;burst-size&gt;32768&lt;/burst-size&gt;
          &lt;!-- play this to listeners if the source is off the air --&gt;
          &lt;fallback-mount&gt;/offtheair.mp3&lt;/fallback-mount&gt;  
          &lt;!-- reconnect listeners once back on the air--&gt;
          &lt;fallback-override&gt;1&lt;/fallback-override&gt; 
          &lt;hidden&gt;0&lt;/hidden&gt;
      &lt;/mount&gt;
      &lt;fileserve&gt;1&lt;/fileserve&gt;
      &lt;paths&gt;
          &lt;webroot&gt;/etc/icecast2/web&lt;/webroot&gt;
      &lt;/paths&gt;
  &lt;/icecast&gt;
  </code></pre>
  <p>As you can see, the off-the-air file is just a plain mp3 named <code>/etc/icecast2/web/offtheair.mp3</code>.</p>
  <h3>Ugly possibilities</h3>
  <p>I have heard that Icecast does not understand the timing of audio files, which suggests that one solution might be to use a tool like <code>ices2</code> to broadcast the offtheair.mp3 to icecast and use that as the fallback mount. That would be gross, so I suspect there's a simpler way to do it. If there is not a better solution, is it at least possible to have icecast start ices only when it is needed for the fallback?</p>