Converting Ogg to MP3 in Ubuntu

Written by:  • Edited by: Lamar Stonecypher
Updated Jun 28, 2009
• Related Guides: Mp3 Player | Linux | Ubuntu

If your shiny new MP3 player won't play all of your Ogg files that you've piled up, you're not out of luck. Ubuntu (as well as the other flavors of Linux) have multiple tools to convert Ogg to MP3. We'll take a look at two of them.

You've conscientiously imported your entire CD collection into the free Ogg Vorbis format but now you have an mp3 player or cell phone that won't handle .ogg files. Instead of getting out your CDs and importing them into mp3s, Ubuntu has many tools for converting ogg to mp3. The following tools are just two options, but I chose them because of their ease of use, and for the fact that they can convert directly from ogg to mp3 with no additional steps. To give them a try, just download them from the Synaptic package manager or with the apt utility.

Sound Converter

soundconverter
click to enlarge

Sound Converter is a graphical tool that uses gstreamer as its back end. It can read Ogg Vorbis, AAC, MP3, FLAC, WAV, AVI, MPEG, MOV, M4A, AC3, DTS, ALAC, MPC, Shorten, APE, SID and can convert them to WAV, FLAC, MP3, AAC, and Ogg Vorbis files. The nice thing about the software is that you can convert entire directories at one time.

Simply, open the preferences window and choose "MP3 .mp3" from the format drop down list. Then add your .ogg files and click convert. That's it, you're done.

ffmpeg

If you prefer command line tools, or want more control over your conversion, give ffmpeg a try. ffmpeg is designed for video conversion, but it converts audio quite nicely as well. The basic command for ffmpeg is "ffmpeg -i example.ogg to example.mp3". It only converts one file at a time, so wildcards are out of the question. In order to convert large quantities of .ogg files you must use the following small script:

for x in *.ogg; do ffmpeg -i "$x" "`basename "$x" .ogg`.mp3"; done

If you want to change the bitrate of the output file, use the "-ab" switch. There are many more options for ffmpeg, both for audio and video conversion so check out the man page if you want even more control.

Conclusion

If you read the forums, or search for conversion tools, everyone will have a different opinion as to how to convert your files. These are my personal favorites, and are available from the default Ubuntu repository.


Comments

Showing all 10 comments
 
Anonymous Apr 1, 2011 5:59 PM
... Or using only shell builtins
for x in *.ogg; do ffmpeg -qscale 8 -ab 196608 -i "$x" "${x%.ogg}.mp3"; done
Bevor Feb 19, 2011 11:57 AM
Thanks for ther tipp.
Hint: To keep the ogg audio quality, you'd modify the command to:

$ for x in *.ogg; do ffmpeg -qscale 8 -ab 196608 -i "$x" "`basename "$x" .ogg`.mp3"; done
shane Dec 26, 2010 7:58 AM
Thanks
Love the command line, and the basename trick is great! Thanks
Louis Oct 15, 2010 5:32 PM
dont work
this dont work here ):
hype Jul 27, 2010 1:47 AM
CL
Command line rocks !
Chris May 22, 2010 11:22 AM
Online Ogg converter
http://www.oggconvert.com

online tool to convert ogg files, no downloads

works better on smaller files because it's web based
Javier Apr 5, 2010 6:42 AM
RE: Converting Ogg to MP3 in Ubuntu
Sound Converter was perfect for what I needed! Thank you
dnncrew Dec 22, 2009 10:16 AM
compress
i'm looking for mp3 compressor just like Diet Mp3 in Window$..is there any?
Kristen Grubb Aug 11, 2009 9:15 AM
RE: Converting Ogg to MP3 in Ubuntu
Gnac does look great. I will have to try that out next time I go to convert my music. Thanks!
herbert Aug 8, 2009 12:59 PM
What about Gnac?
Gnac is also worth trying. I prefer its interface to the one from soundconverter and it also provides more flexibility in creating folder hierarchy.
 
blog comments powered by Disqus
Email to a friend