Edit3, 2018: Just use ffmpeg
.
Re-encode is usually not what you are after, specially if the source itself is already a low qualtiy MP3 file.
So, prep your file list in files.txt
:
file part1.mp3
file part2.mp3
file part3.mp3
And run:
ffmpeg -f concat -i files.txt -c copy out.mp3
Original post:
It’s 2014 and yet it’s not an obvious thing for some strange reason. Luckly someone else was as frustrated as me.
Here’s my a bit shorter version of it:
find . -name '*.mp3' -exec lame --decode '{}' - ';' | lame -a -b 64 - out.mp3
Edit: I found out, that the max length of a output is around 3.5 hours. Don’t know why, but something happens and lame decode stops:
...
input: ./input-04.mp3
(44.1 kHz, 2 channels, MPEG-1 Layer III)
output: <stdout> (16 bit, Microsoft WAVE)
skipping initial 529 samples (encoder+decoder delay)
Frame# 5505/80510 64 kbps MS LAME 3.99.5 64bits (http://lame.sf.net)
Autoconverting from stereo to mono. Setting encoding to mono mode.
Using polyphase lowpass filter, transition band: 16538 Hz - 17071 Hz
Encoding <stdin> to out.mp3
Encoding as 44.1 kHz single-ch MPEG-1 Layer III (11x) 64 kbps qval=3
Everything works nicely if I keep input below 3.5 hours.
Edit2: Sometimes you want to sort your input..
find
really doesn’t execute files in “sorted” order, so sometimes you need
to sort the output of find by file name before concatenating things. More pipes are
needed then:
find . -name '*.mp3' | sort | xargs -i lame --decode {} - | lame -a -b 64 - out.mp3