Recursively convert ogg files to mp3 in Linux

To be compatible with my new mediaplayer I wanted to convert all my ogg files to mp3 files. Since these are stored in subdirectories I wanted it to be recusively. After a lot of searching and hacking I finally found a way to do it.

Sadly ffmpeg on my system wasn't compiled with support for LAME. I didn't want to compile it on my own, so I found a tool called ogg2mp3. The RPM was easy to find and it worked like a charm... the only thing left was to provide the correct output directory. With this command all the ogg files in the subdirectories of the current directory will be converted to mp3 files. The filename will be renamed from *.ogg to *.mp3 and the mp3 ID tags will be copied:

find . -type d -exec nice ogg2mp3 --delete -d "{}" "{}*.ogg" \;

Using the --delete argument the original ogg file will be deleted. By adding the --verbose argument to the ogg2mp3 statement you'll get more information on what is happening and how long it takes to convert the current file.

Note: ogg2mp3 uses the lame encoder, so it needs to be installed.

Add comment

Security code

Share this post
FaceBook  Twitter  


Latest comments