Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a command-line utility to convert mp3s to ogg vorbis that I can install with apt-get?

Alternatively, is there an extension for nginx so I can point it to a directory with mp3 files and have it serve ogg files on the fly?

share|improve this question

migrated from serverfault.com Apr 21 '11 at 18:33

This question came from our site for system and network administrators.

up vote 3 down vote accepted

On Debian, a quick search with aptitude showed me the packages mp32ogg and dir2ogg. Have a look, maybe they do what you need.

share|improve this answer

ffmpeg (or more likely the fork avconv if you're using Debian or Ubuntu - these instructions should apply equally to both, though nobody knows how far apart they may drift in the future) should be in the repositories of your distro.

ffmpeg -i input.mp3 -c:a libvorbis -q:a 4 output.ogg

To do a whole directory full of MP3s:

for f in ./*.mp3; do ffmpeg -i "$f" -c:a libvorbis -q:a 4 "${f/%mp3/ogg}"; done

Recursively, with find:

find . -type f -name '*.mp3' -exec bash -c 'ffmpeg -i "$0" -c:a libvorbis -q:a 4 "${0/%mp3/ogg}"' '{}' \;

Set the output quality by adjusting the value of -q:a: for this codec the range is 0-10 and higher gives better quality.

On older versions of ffmpeg, you may need to use -acodec and -aq instead of -c:a and -q:a.

Of course, converting from one lossy format to another is not ideal; but such is life.

share|improve this answer
1  
For the quality parameter, a higher number gives better quality. See here: trac.ffmpeg.org/wiki/TheoraVorbisEncodingGuide – Christian Long Feb 10 '14 at 17:03
    
It`s work, Thank you! – Chu-Saing Lai Jan 29 '15 at 16:09
    
Super - duper, thank you. Very useful in cases like this github.com/nwjs/nw.js/issues/4687 – loretoparisi Apr 6 at 23:01
    
Confirmed: using those params with avconv does indeed work. Great answer. – aggregate1166877 Jul 13 at 11:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .