lunatechian (lunatech-ian)

one relating to, belonging to, or resembling lunatech

converting spx to mp3

Since my constant companion, the video ipod, cannot play Speex format, I needed to convert a bunch of files .spx files to mp3 format.

This shell script should do the work for you (it will work for files with spaces in them)

sudo find ./ -name '*.spx' | while read FILE; do ogg123 -d wav -f - "$FILE" | lame - "$FILE.mp3" ; done

The -d wav -f - argument to ogg123 make it(ogg123) use the WAV driver and output the result to the stdout (given by -f -). The stdout from ogg123 is passed to lame, which converts the wav to mp3. Caveat: The id3 info in the spx file is lost and you have to add that to the mp3 files manually.

One interesting thing I came to know in this was how to loop over files with spaces in them. This is done by piping the result of find to the while read part. More details of this is here

Trackbacks

Trackback specific URI for this entryTrackback URL

Comments

    • Posted byanonymous
    • on
    It worked. Thank you!
    Reply
    • Posted byAnonymous
    • on
    I'm getting the error "Can't init outfile"
    Reply
  1. Check the permissions on the directory where the ogg files are kept - I think you do not have write permissions there. Change the part lame - "$FILE.mp3" to "/tmp/MUSIC/$FILE.mp3" and thy
    Reply
    • Posted byJon
    • on
    It worked perfectly. I don't know how you figured out how to do it, but thanks a lot!
    Reply
  2. AWESOME! Thanx for sharing!
    Reply

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.