Skip to content

Instantly share code, notes, and snippets.

@dveeden
Created June 20, 2015 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dveeden/f7c881e1d38c9abb37f8 to your computer and use it in GitHub Desktop.
Save dveeden/f7c881e1d38c9abb37f8 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Converts ogg vorbis to mp3 using gstreamer.
# Requires gstreamer-plugins-ugly for the lame mp3 encoding
if [ -z $1 ]; then
echo "Usage $0 <location>"
exit 1
fi
location=$1
echo "==> Location: ${location}"
find "${location}" -name "*\.ogg" -print0 | while read -d $'\0' oggfile
do
mp3file=${oggfile:0:-4}.mp3
echo "==> Converting ${oggfile} to ${mp3file}"
gst-launch filesrc location=\"${oggfile}\" ! oggdemux ! vorbisdec ! audioconvert ! \
lamemp3enc target=quality quality=2 ! id3v2mux ! filesink location=\"${mp3file}\" \
&& rm "${oggfile}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment