title: Streaming different MP3 files using Ezstream and Icecast
body: <p>I am trying to stream two MP3 files to Icecast using Ezstream and the stream should run in web browsers. The files I am testing with were downloaded as webm and converted to MP3 using <code>ffmpeg</code>. They have the same channels count, same bitrate and same sample rate but different duration.</p>
  
  <p>My setup: the Ezstream xml configuration file is set to stream MP3 and a program playlist is used to identify what is the next file to be streamed, and no encoders or decoders are used. When I start streaming I save the process ID of the Ezstream process (using the <code>-p</code> argument), and then I use the command <code>kill -10 $(cat currentpid)</code> with <code>currentpid</code> as the file containing the process ID so Ezstream executes the playlist program to get the next file name and skips the current file to play the next one. Basically I am just switching between <code>1.mp3</code> and <code>2.mp3</code>.</p>
  
  <hr>
  
  <p>The problem is that on Chrome web browser, when I switch between the two files the player (default HTML5 player) will suddenly stop (sometimes I can switch multiple times before it happens and sometimes it happens quickly) and the error <code>PIPELINE_ERROR_DECODE</code> is what I find when I access <code>player.error</code> in JavaScript. Although Firefox handles the change and continues the stream normally, I am convinced that Firefox here is the exception, that it is not a bug in Chrome (in my case), and that there is something wrong with my setup that needs to be fixed to support other browsers.</p>
  
  <p>Doing the same using <code>mpv</code> player, I get the following errors but the audio keeps streaming normally (sometimes it takes multiple switches before it happens just like in Chrome):</p>
  
  <pre><code>[ffmpeg/audio] mp3float: big_values too big
  [ffmpeg/audio] mp3float: Error while decoding MPEG audio frame.
  Error decoding audio.
  </code></pre>
  
  <p>I tried using MP3 encoder and decoder I copied from the Ezstream example files (<code>lame</code> and <code>madplay</code>) but the problem still existed.</p>
  
  <p>I am not sure if the problem is basic and I cannot see it or it is more complicated. Also I do not have a problem if I need to use other format than MP3 to fix that issue, as long as that format is supported by Ezstream and Icecast.</p>
  
  <p>Thanks.</p>