I realize that this isn’t my typical kind of post but, I found this particular snippet of shell script so ridiculously useful that I felt compelled to share it with you.

Recently I paved over a Windows 8 box with Fedora Linux (there will be a blog post forthcoming about this as well). One of the things I did on this fresh Linux box was rip a couple of import CDs that I couldn’t get from iTunes or anywhere else digitally. The application I was using ripped them as Ogg Vorbis and I needed them in MP3 so I could put them on my Shuffle for when I go running.

First, I just installed ffmpeg. If you’re on Fedora, you might need to edit your /etc/yum.repos.d files to turn off the gpgcheck for certain repos, like the ‘RPM Fusion Free’ one from which ffmpeg comes. To install, it’s just yum install ffpmeg.

Next, here’s the good part, the shell script to convert a whole directory of Ogg Vorbis files into MP3 and strip out the .ogg extension and replace it with .mp3:

for name in *.ogg; do ffmpeg -ab 192k -i "$name" "$(basename "$name" .ogg).mp3"; done;

And that’s it. Easy as pie.