Saturday, February 18, 2012

OGG to MP3 Conversion with ID3 tags

I spend ages every time I need to do this to remember the correct format of the command:

here it is at last:

/usr/bin/find -type f -name "*.ogg" | while read file; do echo "working on $file"; /usr/bin/gst-launch filesrc location="${file}" ! oggdemux ! vorbisdec ! audioconvert ! lame quality=4 ! id3v2mux ! filesink location="`/usr/bin/dirname "$file"`/`/usr/bin/basename "$file" .ogg`.mp3" 2>&1 && /bin/rm "$file"; done | /usr/bin/tee -a $HOME/ogg2mp3results.txt

Find all the files
Convert them into mp3 with quality = 4 which is something like 44000khz and br=127kbit
Save them with an mp3 extension next to the original ogg
Remove the ogg file
Tee the output into a log.