Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 260
Fake Fish Avatar asked Sep 06 '25 03:09

Fake Fish


1 Answers

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.

like image 82
Adam Katz Avatar answered Sep 09 '25 18:09

Adam Katz