Luciel Campbell
Luciel Campbell

Reputation: 29

How to batch downsample MP3 files using lame?

I found on another question how to do singular files, which worked great.

"lame --mp3input -b birtratenumber input.mp3 output.mp3"

Thing is, I have around 60 files and doing each individually is very time consuming (the total amount of time does not bother me, it´s more about having to stay there waiting to input the next command).

So, Is there a way to run this command for all files in the folder, telling it to use the same filename as source filename but adding "_48" at the end of it, before the .mp3 part and saving it in the source folder (same folder as original files).

Thanks in advance for any and all help.

Upvotes: 2

Views: 1063

Answers (1)

Pedro Almeida
Pedro Almeida

Reputation: 31

Use a shell for loop to process the files in turn:

for i in *.mp3; do
     lame --mp3input -b 48 "$i" "${i%%.mp3}_48.mp3"
done

Upvotes: 3

Related Questions