DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Convert From MP3 To OGG

  • submit to reddit
        // I had a collection of mp3 and wanted have it in OGG
// you should have 'oggenc' 'mpg123' 'sox' to be installed
// call: convert file.mp3 file.ogg

mpg123 -b 10000 -s "$1" | sox -t raw -r 44100 -s -w -c2 - "temp.wav"
oggenc -o "$2" "temp.wav"
rm temp.wav


Snippets Manager replied on Thu, 2009/03/12 - 2:47pm

Hi, We have a similar projet in We use ffmpeg for fic in "*.mp3" ; do ffmpeg -i "${fic}" "${fic%.mp3}.ogg" done