0

I'm already taking advatage of two command line utilities. I'm using ffmpeg to convert m4a to mp3, and then I'm combining a few mp3's into one large one using mp3wrap. The resulting file is something like this:

BackgroundMusic.mp3 > Audio1.mp3 > Audio2.mp3

I need something more like

Audio1.mp3 > Audio2.mp3
|_____________________|
           |
  BackgroundMusic.mp3

To where the background music runs continuously in the background. Would be nice to be able to change the volume of each track too.

Does anyone know a command line program like mp3wrap but can also add in a background track?

I will not be able to use a GUI program such as Audacity, as all of this will be automated on the server.

Thanks!

1
  • No need for the extra step to convert the m4a to mp3 if you're using ffmpeg. Please show the complete console output of ffmpeg -i Audio1 -i Audio2.
    – llogan
    Aug 13, 2015 at 17:16

1 Answer 1

1

You should be able to do this with sox, a cli audio manipulation tool. For example to concat two files, and mix in a third, then play it:

sudo apt-get install sox libsox-fmt-all
sox Audio1.mp3 Audio2.mp3 out1.mp3
sox -m out1.mp3 BackgroundMusic.mp3 out2.mp3
play out2.mp3
2
  • if BackgroundMusic.mp3 is longer than Primary.mp3, how can I cut backgroundmusic fit to primary length? and if Primary.mp3 is longer than BackgroundMusic.mp3, how can I loop backgroundmusic follow primary length?
    – VnDevil
    Nov 15, 2022 at 15:57
  • 1
    You should post this as a new question. There might be answers not using sox but some other utility.
    – meuh
    Nov 16, 2022 at 11:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .