Shuffle my GStreamer

less than 1 minute read

I bought Tiff an Ipod Shuffle for her birthday (which she absolutely loves) and have had to figure out what to do about my ogg collection. I found info on adding ogg support to iTunes and had no problems getting it mostly working. Tho iTunes will recognize most of my oggs (as quicktime movies!) and convert to aac on the fly, it won’t read all the info from the tags so my track numbers don’t show up. I also had an issue with it importing my Zeppelin How The West Was Won set that required finding a quick n dirty conversion option.

I tried using SoX, but it didn’t retain the tags so I looked at some of the ogg2mp3 scripts floating around and was sorely dissapointed. They either didn’t keep tags, or were too old to be of any real use. Enter GStreamer and it’s beautiful pipeline system. I was able to run the simple bash script below and convert an entire directory to 128k mp3’s while keeping the metadata intact.

#!/bin/bash

file="$@"
mp3name=${file/ogg/mp3}

gst-launch-0.8 filesrc location="$file" ! oggdemux ! vorbisdec ! audioconvert ! lame ! filesink location="$mp3name"

Leave a Comment