PDA

View Full Version : mp3gain on entire library?



Thomas J. Angstman
2004-10-10, 12:00
I would like to run mp3gain on my entire library.



For some reason when I run this:



# mp3gain -r /mp3/*/*/*.mp3



I get the following output.



/usr/local/bin/mp3gain: Argument list too long.



It works fine if I limit the path to a single folder, but with 15000
songs, that would take forever. Has anybody else dealt with this
before?



Thanks!



TJ Angstman

ddewey@cyberthugs.com
2004-10-10, 12:00
Quoting Thomas J. Angstman (tj (AT) angstman (DOT) com):

>
> I would like to run mp3gain on my entire library.
>
>
> For some reason when I run this:
>
>
> # mp3gain -r /mp3/*/*/*.mp3

maybe something like 'find . -name *.mp3 | xargs mp3gain -r {}\;

untested, but should work.

dave

Robin Bowes
2004-10-10, 12:02
Thomas J. Angstman wrote:
>
> /usr/local/bin/mp3gain: Argument list too long.
>

Try googling for "Argument list too long".

R.
--
http://robinbowes.com

Robin Bowes
2004-10-10, 12:10
ddewey (AT) cyberthugs (DOT) com wrote:
> Quoting Thomas J. Angstman (tj (AT) angstman (DOT) com):
>
>
>> I would like to run mp3gain on my entire library.
>>
>>
>> For some reason when I run this:
>>
>>
>> # mp3gain -r /mp3/*/*/*.mp3
>
>
> maybe something like 'find . -name *.mp3 | xargs mp3gain -r {}\;
>
> untested, but should work.

This will have problems with spaces or other special characters in
filenames.

The stock answer to this problem is:

# find some_dir -name 'file.spec' -print0 | xargs -0 some_command

or more specifically:

# find /mp3 -name '*.mp3' -print0 | xargs -0 mp3gain

Why you would want to do this is another question entirely.

Investigate ReplayGain.

R.
--
http://robinbowes.com

Roy M. Silvernail
2004-10-10, 12:32
On Sun, 2004-10-10 at 15:00, ddewey (AT) cyberthugs (DOT) com wrote:
> Quoting Thomas J. Angstman (tj (AT) angstman (DOT) com):
>
> >
> > I would like to run mp3gain on my entire library.
> >
> >
> > For some reason when I run this:
> >
> >
> > # mp3gain -r /mp3/*/*/*.mp3
>
> maybe something like 'find . -name *.mp3 | xargs mp3gain -r {}\;
>
> untested, but should work.

That won't apply album gain settings, though. It will flatten all
tracks to a common median loudness. For album gain, you need to process
a directory at a time.

Maybe something like this?

find /mp3 -type d | xargs mp3gain -a "{}/*.mp3" \;

--
Roy M. Silvernail is roy (AT) rant-central (DOT) com, and you're not
"Progress, like reality, is not optional." - R. A. Hettinga
SpamAssassin->procmail->/dev/null->bliss
http://www.rant-central.com

Roy M. Silvernail
2004-10-10, 12:38
On Sun, 2004-10-10 at 15:32, Roy M. Silvernail wrote:

> That won't apply album gain settings, though. It will flatten all
> tracks to a common median loudness. For album gain, you need to process
> a directory at a time.
>
> Maybe something like this?
>
> find /mp3 -type d | xargs mp3gain -a "{}/*.mp3" \;

Oops! That won't work. This might:

find /mp3 -type d -exec mp3gain -a "{}/*.mp3" \;
--
Roy M. Silvernail is roy (AT) rant-central (DOT) com, and you're not
"Progress, like reality, is not optional." - R. A. Hettinga
SpamAssassin->procmail->/dev/null->bliss
http://www.rant-central.com

Jules Taplin
2004-10-10, 13:52
Hey Thomas.

That's an easy one. Basically... the problem is that the shell expands the wildcard for you, and there's a limit on the number of characters it can cope with.

But... UNIX magic can always fix this. You probably want the following:

find -print0 /mp3 -name \*.mp3 | xargs -0 -n 10 mp3gain -r

Basically... the 'find' command finds all the mp3s, and pipes the filenames to xargs. xargs repeatedly invokes your command, stuffing (in this case) 10 filenames onto the command line.

Hope that helps!


-- Jules
----- Original Message -----
From: Thomas J. Angstman
To: discuss (AT) lists (DOT) slimdevices.com
Sent: Sunday, October 10, 2004 8:00 PM
Subject: [slim] mp3gain on entire library?


I would like to run mp3gain on my entire library.



For some reason when I run this:



# mp3gain -r /mp3/*/*/*.mp3



I get the following output.



/usr/local/bin/mp3gain: Argument list too long.



It works fine if I limit the path to a single folder, but with 15000 songs, that would take forever. Has anybody else dealt with this before?



Thanks!



TJ Angstman





------------------------------------------------------------------------------