How to reduce the size of mp3s in linux? [closed]
Asked Answered
M

3

20

Does anyone know of any linux software to reduce the size of mp3 files while having a minimal effect on quality?

I just used pngcrush to do this to all the pngs in our asset library with good results, and would love to be able to do the same to our mp3s. Even if there is a 10% reduction in file size that would be a decent win for me.

Any suggestions? It needs to be something i can call from a shell script.

cheers, max

Marxmarxian answered 26/7, 2013 at 15:59 Comment(0)
U
41

You can use lame with the --mp3input option.

For example you can do a downsampling of the mp3 quality, specifing the a new lower bitrate using the -b option. For example if your starting mp3 has a quality of 256kbs you can lower it's bitrate to 128kbs:

lame --mp3input -b 128 input.mp3 output.mp3

Depending from the input file bitrate, the output.mp3 file has lower quality and so a file size reduction.

From the lame manuale page:

--mp3input Assume the input file is a MP3 file. Useful for downsampling from one mp3 to another. As an example, it can be useful for streaming through an IceCast server.

Unmeaning answered 26/7, 2013 at 16:5 Comment(2)
Worth noting, you may want to explicitly re-sample, eg --resample 22.05 which is often fine for voice. eg: mkdir out ; for f in *.mp3 ; do lame --mp3input -b 64 --resample 22.50 "$f" "out/$f" ; doneDeciare
Looking for another solution. lame is problematic and fails on random files that otherwise play perfectly using mplayer.Elbert
H
3

It depends on what you want to achieve. avconv (formerly ffmpeg) is a good tool, but there's no one size fits all solution pertaining the parameters, since it depends heavily on the type of audio data (music, speech, etc) and the original bitrate, etc. Try the different settings, maybe convert it to mono, see what produces still acceptable results for you.

As a general rule of thumb: Speech compresses really well, downsampling it to 11kHz may still give acceptable results, but music can also be downsized by decreasing the bitrate or switching to mono.

Hockey answered 26/7, 2013 at 16:4 Comment(1)
Great tip about speech, thanks!Marxmarxian
D
-2

Try to use Audacity. It's a free audio editing program

Dett answered 26/7, 2013 at 16:5 Comment(2)
It needs to be scriptable. I have audacity but i don't think you can use it purely as a command line tool can you?Marxmarxian
Try using avconv (ffmpeg) for scriptability.Hockey

© 2022 - 2024 — McMap. All rights reserved.