FFmpeg: How to convert whole directory of OGG files to MP3 using single command?

2018-02-25 Software

Converting a song from one format to another using FFmpeg is extra handy. What if you have a whole directory of files you would like to convert to mp3?

Let’s check below example.

Open Terminal and go to the directory that contains files you would like to convert, then type:

for f in *.ogg; do ffmpeg -i "$f" -acodec libmp3lame -q:a 2 "${f%.*}.mp3"; done

Accordingly change:


to the extension that’s matching with your input files.

That’s it.