Sunday, October 18, 2009

Converting ogg and m4a audio files to mp3 [Linux]

Days ago, I bought a 'mp3 device'. The nice thing about this gadget is that it is more than a mp3 player. This device can also take pictures, record audio and video, display plain files, among others. It's is very cheap, $60.oo, and now it's my partner during my daily long trips.
Today, I was setting up my device with some e-books and meditation CDs. However, I found that some audio files were with  m4a and ogg extension. I googled, how to convert from these formats  to mp3 and I found some useful thinks that I'm sharing with you.

From ogg to mp3

for file in *.ogg;do oggdec -o - "$file"|lame -h -V 4 –-vbr-new - "$(basename "$file" .ogg).mp3";done

From m4a to mp3

for i in *.m4a; do echo "Converting: ${i%.m4a}.mp3"; faad -o - "$i" | lame - "${i%.m4a}.mp3"; done

For additional short scripts, check this link

No comments: