Oggify

index | bash scripts

Convert all your .wav and .mp3 to .ogg

#!/bin/bash
 
 
# convert wma, mp3 and wav to ogg
# tony baldwin http://www.BaldwinSoftware.com/
# cleaning up file names
 
echo cleaning file names...
 
rename 's/ /_/g' *
rename y/A-Z/a-z/ *
rename 's/_-_/-/g' *
rename 's/\,//g' *
 
# converting all mp3 files to wav,
#so there will be nothing but wavs
 
echo Converting mp3 to wav...
 
for i in $(ls -1 *.mp3)
do
n=$i
mpg123 -w "$n.wav" "$n"
if [ -f $i.ogg ]; then
rename 's/.mp3//g' $i.ogg
rm $i 
fi
done
 
# and, now, converting those wav files to ogg
 
echo Converting .wav to .ogg
 
for i in *.wav
do
oggenc $i
if [ -f $i.ogg ]; then
rm $i 
fi
done
 
# now the wma files
 
for i in *.wma; 
do ffmpeg -i $i -acodec libvorbis -aq 100 $i.ogg;
if [ -f $i.ogg ]; then
rename 's/.wma//g' $i.ogg
rm $i 
fi
done
 
ls *.ogg
 
echo -e "Your oggs are ready, friend.\nHappy listening!"
 
exit
 
# This program was written by tony baldwin - tony @ baldwinsoftware.com
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

tonybaldwin 2012.02.20.01.08


~~DISQUS~~