Question

I'm trying to convert a bunch of CBR 320 Kbps Mp3 to VBR 0 (max quality), using lame command in bash. However, it seems like lame can't overwrite existing files. It would be much faster that way, as I could use wildcards to do it on an unique, short terminal command, plus I wouldn't have to delete the old files and rename the new.

What I'm trying is:

lame -h -V 0 *.mp3

But I get the following error message:

lame: excess arg %filename%.mp3

Also, if I try on a single file

lame -h -V 0 %filename%.mp3 %filename%.mp3

I get:

Input file and Output file are the same. Abort.

In the command help there's no option mentioned for forced, overwrite or whatever. I searched in the internet and on Stack Overflow and found nothing too. Can anybody help me?

Was it helpful?

Solution

lame just doesn't support this. Few commands do.

Instead, the Unix philosophy is to not require every program to support every possible mode of invocation, and instead lets the user combine commands to do what they want:

for f in *.mp3; do lame -h -V 0 "$f" tmp && mv tmp "$f"; done

If this is something you do often (though I hope not, since transcoding is bad for quality), you can create your own shortcut for it in .bashrc:

superlame() { for f; do lame -h -V 0 "$f" tmp && mv tmp "$f"; done; } 

From then on, you can simply superlame *.mp3

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top