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
Refresh

Share this post
FaceBook  Twitter  

Archives

Latest comments

  • The powerless God

    Bas
    Hi Chris, Well... I'm not saying that there is no free will in the afterlife. But life as we know is ...

    Read more...

     
  • The powerless God

    Chris Donges
    How do you see the afterlife if there is no free will? If there can be an afterlife with no free will ...

    Read more...

     
  • The powerless God

    Bas
    Hi Chris, I'm curious where you are heading with your questions :-) I'm not that interested in heaven ...

    Read more...

     
  • The powerless God

    Chris Donges
    I know you said free will may not be the correct answer but I asked so I could ask you this follow ...

    Read more...

     
  • The powerless God

    Bas
    Hi Chris! No, I don't think so. May I ask you why you asked me this? I've re-read my blogpost and ...

    Read more...