2

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.

yevt
  • 732
  • 1
  • 6
  • 21
  • For macOS & Linux: modified from this [answer](https://stackoverflow.com/a/33766147/) in duplicate question: `mkdir wav; for i in *.ogg; do ffmpeg -i "$i" "wav/${i%.*}.wav"; done` – llogan Jun 08 '20 at 21:26

1 Answers1

9

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.

Adam Katz
  • 14,455
  • 5
  • 68
  • 83