Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

A command line ogg to mp3 converter UNIX
Using the same paradigm as ChrisR's flac to mp3 command line script, I've done the same to convert ogg files to mp3s using command line tools.

You'll need to download and compile the vorbis player/encoder tools for everyone from vorbis.com. Its kind of tricky; you'll need to install libao2, libogg and libvorbis libraries using fink, then compile with the following:
./configure --with-ogg=/sw --with-ao=/sw --without-flac
I didn't bother to compile with flac support, because I use flac to do that. You might get some errors during the configuration, and they are pretty good about what's causing the problem. If you're missing any libraries, check to see if fink has (or can) install them. You'll also need to install LAME with fink. It was simple.

Finally, here's the shell script that you can run in a directory full of .ogg files when you're ready for bed. Feel free to change any of the options in the lame converter, and see ChrisR's post for information about IDv3 tags with command line tools if you're interested.
#! /bin/sh
# Andy Freed - 2004
# this uses fink installed flac to convert
# .ogg vorbis audio to .mp3 files with 
# the fink installed LAME encoder.
# modified from flac script by ChrisR on MacOSXHints.com
for file in *.ogg
do
  ogg123 -d raw -f - "$file" |
  lame -h -m s -b 192 - "$(basename "$file" .ogg).mp3"
done
[robg adds: I haven't tested this one ... and remember to make the script executable (chmod 755 script_name).]
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[52,532 views]  

A command line ogg to mp3 converter | 14 comments | Create New Account
Click here to return to the 'A command line ogg to mp3 converter' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
fink already has the vorbis-tools
Authored by: The Tired Saint on Mon, Aug 9 2004 at 5:16PM PDT
You don't need to download and compile anything yourself! Fink already has the vorbis-tools package (which includes ogg123), although it is in the unstable tree. To access it, just add "unstable/main" to the Trees: line in your /sw/etc/fink.conf file. (While you're at it, "unstable/crypto" might not be a bad idea.) Then do a selfupdate, and the vorbis-tools package will become available.

[ Reply to This | # ]
Pointless?
Authored by: react on Mon, Aug 9 2004 at 8:32PM PDT
I really don't see the point in this script?

You're converting from a lossy format to another lossy format.....so you'll end up with a worse quality mp3 in the end than if you just stuck with the ogg vorbis file.

The only I can see for doing this is converting a ogg to mp3 to play on your iPod, but then it would be better if you just went and download a mp3 in the first place. Plus if you share your converted mp3 you're just going to be contaminating p2p with a crappy quality version.

[ Reply to This | # ]
Pointless? I don't think so...
Authored by: dontlikehippies on Mon, Aug 9 2004 at 9:54PM PDT
i used this script because iTunes hiccups when reading .ogg files. before this, if i wanted to convert .ogg to .mp3, i was forced to use AudioHijack Pro (and play each song all the way through). thanks!

[ Reply to This | # ]
Pointless? I still think so...
Authored by: react on Mon, Aug 9 2004 at 10:59PM PDT
Yeh, well that pretty much fits into my iPod reasoning, but as I said for that you would be better off grabbing a mp3 encoded from the original cd.

Converting from one lossy codec to another is not the way to go.

[ Reply to This | # ]
Pointless? I don't think so...
Authored by: miggins on Mon, Aug 9 2004 at 11:54PM PDT
Have you tried using the faster version? Get the latest from here: http://qtcomponents.sourceforge.net/

[ Reply to This | # ]
Pointless?
Authored by: mrgerbek on Mon, Aug 9 2004 at 11:36PM PDT
I agree that its not ideal, but even you point out a reason for it in your explanation of why its pointless ;)

I was looking for a way to do it, noticed that someone else had also asked how to do it, then decided to submit it as a hint instead of a reply. Except for a few malformed bits, no harm done.

Andy

---
~~~~~~~~~~
Be Green

[ Reply to This | # ]
Pointless?
Authored by: /mecki78 on Tue, Aug 10 2004 at 7:05AM PDT
It's not pointless at all! I make all my CDs to OGG and I buy music *legally* online in OGG format, too! Why? It sounds better and needs less space! Why should I use crappy MP3 for that?

But mobile players (unless the very expensive ones) don't play OGG. So to play them out of house, I must covert them to MP3. But this is just for the mobile player. At home I keep using the OGGs.

For a mobile player, MP3 with 128 kbit/s may even be enough, they won't sound much worse through crappy headphones and with all the street noise around me. But at home I want High Fidelity! 192 kbit/s MP3 are hardly enough, while OGG Level 5-6 (170-200 kbit/s) are usually transparent for me, even on good sound equipment.

I don't "share" the "bad" MP3s or anything, they are for my private use on mobile players or wherever I can't use OGG out of some other reason. Wherever I can, I only use OGG.

The MP3s are just cheap copies (I don't even keep them! I usually create them when I want them on my player and delete them if I replace them --- I have no IPOD and may player has only 256 MB storage for MP3s).

And trust me, I bet $1000 that you won't be able to tell the difference between

CD -> MP3 192 kbit/s
CD -> Ogg q6 -> MP3 192 kbit/s

No way!

I know losy to losy is bad, but some pictures where also stored as JPG multiple times and you still can barely see any artifacts. Same with audio. You can re-compress a MP3 to MP3 three to four times without having crap as result (of course only if the bitrate is high enough; 128 to 128 is already very bad). And OGG takes much "less" away of the music than MP3 does and since OGG adds different kind of artifacts than MP3, they don't sum up as in MP3 to MP3 re-encoding.

However, I would always choose LAME VBR (e.g. lame --preset standard) for re-encoding, as it preserves most quality.

[ Reply to This | # ]
Pointless?
Authored by: midtoad on Mon, Jul 11 2005 at 8:17PM PDT
the point might be that iTunes is very slow in adding .ogg files to its library, and it skips a lot when playing .ogg files if you are doing anything else at the same time (at least for my case, with the .ogg files on a remote PC on my home network; YMMV).

As for transcoding crapping out the quality, that's certainly the accepted view. But at least one individual's report suggests that he couldn't tell the difference, even with a double-blind test.



[ Reply to This | # ]
a plugin to play oggs in iTunes
Authored by: alys on Mon, Aug 9 2004 at 11:19PM PDT
This hint tells you how to install a plugin that allows iTunes to play ogg files. If you're thinking of converting oggs to mp3s solely so that you can play them in iTunes, then using the plugin is a much better option. Ogg files will be smaller for the same quality (or better quality for the same size) than mp3 files.

[ Reply to This | # ]
a plugin to play oggs in iTunes
Authored by: midtoad on Mon, Jul 11 2005 at 8:13PM PDT
Sure, ogg files are smaller than mp3 files. But iTunes is *very* slow to add .ogg files into its library. Trust me, I just imported 26000 songs, of which half were .oggs. It took at least 8 hours, IIRC (with my library on a USB drive connected to a Windows PC on the home network).

It would probably be faster to convert my entire collection to .mp3 and then add those to the library!


[ Reply to This | # ]
A command line ogg to mp3 converter
Authored by: midtoad on Mon, Jul 18 2005 at 2:22AM PDT
Would it be possible to modify the flac-to-mp3 script so that after the ogg files are converted to mp3, the ogg comments are converted to mp3 ID3 tags, and finally the original ogg file is deleted?

Has anyone done that, and would like to share their script?

thanks
S


---
Calgary, Alberta
Mac Mini

[ Reply to This | # ]
A command line ogg to mp3 converter
Authored by: daveola on Mon, Feb 13 2006 at 8:21PM PST
There's a command line script (written in perl, which OSX comes with) that does exactly this at MarginalHacks.com:

http://marginalhacks.com/#ogg2mp3

---
http://GetDave.com/
http://MarginalHacks.com/

[ Reply to This | # ]

A command line ogg to mp3 converter
Authored by: daveola on Mon, Feb 13 2006 at 8:23PM PST
There's a command line script (written in perl, which OSX comes with) that does exactly this (including copying tags) at MarginalHacks.com:

http://marginalhacks.com/#ogg2mp3

---
http://GetDave.com/
http://MarginalHacks.com/

[ Reply to This | # ]

A command line ogg to mp3 converter
Authored by: reformist on Sat, Jan 27 2007 at 1:30AM PST
I just realized this, but ID3 has the limitation of only allowing 30 characters per field. I have tons of song titles over that length, and the marginalhacks script (or any script for that matter) truncates the title.

Unacceptable!

I'm trying to convert away from ogg to mp3 or some popular format, because ogg is not well supported by hardware or itunes.

[ Reply to This | # ]