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

02.17.2009
| 17095 views |
  • 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

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

Comments

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

Hi, We have a similar projet in https://code.launchpad.net/~ubuntu-fr-scripts/ubuntu-fr-scripts/dev-Audio We use ffmpeg for fic in "*.mp3" ; do ffmpeg -i "${fic}" "${fic%.mp3}.ogg" done