yevt
yevt

Reputation: 816

How to batch convert .ogg files to .wav using a command line utility?

I have a bunch of files:

dir/file1.ogg
dir/file2.ogg
...

How could I convert them to .wav files

dir/wav/file1.wav
dir/wav/file2.wav
...

by using a console command? Now I'm using OSX, but I need the answer for Windows as well.

Upvotes: 3

Views: 11503

Answers (1)

Adam Katz
Adam Katz

Reputation: 16146

Your sample code is close.

for i in *.ogg; do
  ffmpeg -acodec libvorbis -i "$i" -acodec pcm_s16le "${i%ogg}wav"
done

This decodes with ffmpeg and generates an output file name that removes the trailing ogg and appends a trailing wav.

Upvotes: 11

Related Questions