3

I'm trying to add background audio to a primary wav file.

sox -m primary.wav background.wav output.wav 

I have about 5s of background chatter in background.wav and I'd like the output to always be at the length of primary. How can I make sox loop and trim background.wav to the length of primary for mixing in shell?

codekitty
  • 133
  • 4

1 Answers1

2

ffmpeg does it very well. For example:

ffmpeg -i input1.mp3 -i input2.mp3 -filter_complex amerge -ac 2 -c:a libmp3lame -q:a 4 output.mp3

See the FFmpeg manual for Manipulating audio channels

cmak.fr
  • 8,411
  • 2
  • 29
  • 45
  • 1
    in order to add background wav to my input wav (mono) I used: ffmpeg -i input.wav -i background.wav -filter_complex amerge -ac 1 output.wav – codekitty Jun 19 '18 at 08:27