Batch conversion of Sounds with Different Format to one Format, how?

4

Discussion in Freesound.org, here, is stagnated. You could do this with Audacity but their developer warned about that (apparently stupid idea to load the GUIs or something like that). Is there something like ImageMagick for sounds? I have a repository full of small music pieces (UX sounds etc) that I need to one consistent format, how can I do that?

hhh

Posted 2012-05-14T02:15:55.033

Reputation: 267

I would search the web for a sound converter for your system. Whether you're on Linux, Windows or OS X, you'll probably going to find something. – None – 2012-05-14T13:39:45.253

Answers

6

The following example will make a directory called outputdir and then re-encode all wav inputs in the current directory to mp3:

mkdir outputdir
for f in *.wav; do ffmpeg -i "$f" -c:a libmp3lame -q:a 4 outputdir/"${f%.wav}.mp3"; done

You can use a slightly modified command to convert multiple formats to MP3:

mkdir outputdir
for f in *.{wav,aiff,flac,m4a}; do ffmpeg -i "$f" \
-c:a libmp3lame -q:a 4 outputdir/"${f%.*}.mp3"

Use whatever file extensions you want in there, but remember that converting one from one lossy codec to another is a bad idea (so converting ogg vorbis to mp3 wouldn't work well).

llogan

Posted 2012-05-14T02:15:55.033

Reputation: 336

1

If you're on Windows, ffmpeg + Avanti will do the trick. Just perform the conversion on a single audio file, then queue all the rest in the job manager and go.

Gyan

Posted 2012-05-14T02:15:55.033

Reputation: 544

...well not using W but *ix systems but perhaps useful for others. – hhh – 2012-05-14T17:15:48.550