Server Side

Server related posts

Convert a batch of MP3 files to OGG using dir2ogg

Written by: Peter Fisher on October 6, 2012
Tagged under: ,
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Linux penguin Tux

I have been doing some work for a musician  and  needed to convert a batch of MP3 files to the open source OGG format. At first I went down the route of creating my own bash script that loops through the directories and converts each file in turn. I then discovered the dir2ogg application.

Dir2ogg is a python script that can convert MP3, WAV and MP4A files to the OGG format. You can supply the -r flag which will make dir2ogg descend recursively into sub directories and convert any valid files that it finds.  The application will create an OGG file with the same name as the target file and you can you use the -c flag to target an audio CD.

To download dir2ogg simply type the following in a terminal under Linux (I’m using Ubuntu)

apt-get install dir2ogg

To run the dir2ogg type the following in a terminal:

dir2ogg -r /my-folder-full-of-mp3s

The above will convert any mp3 files within the folder /my-folder-full-of-mp3s and any sub directories that it contains.

I recommend going through the man pages as there are some clever flags that you can pass to the dir2ogg application that cater for compression rates and so forth.

 

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Peter Fisher is a web developer working in Gloucester UK. Founder of the digital agency Websomatic, author of this blog and the HowToCodeWell Youtube channel. Peter has over ten years of web development experience under his belt

Read all about Peter Fisher

Leave a Reply

Your email address will not be published. Required fields are marked *