Mp3splt is an old but pretty nice console utility for splitting MP3 files without re-encoding them (it can apparently handle a few other types as well). I'm working on a project that makes use of it to batch-trim extra silence from the beginning and end of MP3s and one of the long-time gripes i've had with Mp3splt is that it adds "_trimmed" to the output file names by default. Not being the sharpest knife in the drawer, it took me a long bloody time to FINALLY figure out how to eliminate that. I'm disclosing my solution here with the hope that someone else benefits since i never found a solution anywhere else.
man mp3splt, the clues are all there, primarily with the
@f options, but what complicated matters for me what that i wanted to run Mp3splt in a directory above the MP3s which would be dumped first in
/input and then in
/output and i wanted to do it without using
cd in my script.
Here's what worked for me:
../ is eliminated, then Mp3split creates the
/output directory in the
/input directory which is just plain strange i think. Anyway, the
@f will cause Mp3splt to retain the original file name.
The full command:
mp3splt -r -f -p th=-50,min=0.2 -o '../output/@f' 'input/song.mp3'
One of the other gripes i had with Mp3splt is that, in some cases, it will keep trimming "silence" that isn't silence from an MP3 every time you run it on the same file, thus the file size will keep getting smaller and smaller and you lose a little more audio each time. The
min=0.2 seems to prevent that. When Mp3splt is used in trim mode (
-r), the value of
min= is the amount of silence in seconds that must be detected before trimming occurs. It is also the the amount of silence that will be retained at the beginning and end of the MP3. This value can of course be changed to whatever you want, but obviously Mp3splt cannot add silence.