Page 1 of 1

SoX: concat audiofiles and convert to MP3

Posted: Thu Aug 16, 2012 2:13 pm
by peter_b
I needed to transcode >2GB WAVs to MP3s, so I couldn't just use lame, because I had to glue the WAVs together first.
My set of WAVs looked like this:
audio.wav
audio.w01
audio.w02
Unfortunately, Debian ships with a SoX version which cannot output MP3s (The package "libsox-fmt-mp3" is only for SoX being able to handle MP3 as input).

So I'm connecting SoX with Lame, using StdIn/StdOut pipes like this:

Code: Select all

sox audio.wav audio.w01 audio.w02 -r 44100 -b 16 -c 2 -t raw - | lame -s 44.1 --bitwidth 16 -r -b 192k - output.mp3
The "-" as sox-output and lame-input is the default character for the standard in/out pipe.
Important is to tell both sides (SoX and Lame) the properties of the raw audio stream. In this case it's "stereo" (=2 channels), "16 bits", "44100 Hz" sample rate.