title: FFMPEG trim and concat mp3 without re-encoding
body: <p>Good Day,</p>
  
  <p>I would like to know if it is possible to "join" a portion of an mp3 file to another <strong>without re-encoding</strong> using ffmpeg. I need to prepend an audio mp3 file with silence to ensure it is 60 seconds long.</p>
  
  <p>i.e if my audio file a.mp3 is 40 seconds I need to prepend 20 seconds of silence without re-encoding.</p>
  
  <p>My thoughts on doing this was to have a 60 second long silence mp3 (silence.mp3) at the same CBR and sample rate of my audio (44100 and 40kbps). I then need to "trim" this file and concat/join with the audio file (a.mp3) appropriately.</p>
  
  <p>I have a linux script that computes the required seconds to prepend and I tried using the following filter_complex expression:</p>
  
  <pre><code>ffmpeg -i silence.mp3 -i a.mp3 -filter_complex "[1]adelay=20000[b];[0][b]amix=2" out.mp3
  </code></pre>
  
  <p>This works however takes too long as it performs re-encoding which takes a long to process. Im looking for a non re encoding solution that can just join the correct sized portion of silence.mp3 to a.mp3. The commands would need to include as a parameter the length of silence that must be used from the overall silence.mp3 file.</p>
  
  <p>Any advise is appreciated.</p>