Posts Tagged ‘ogg’

Batch converting audio files :

Sunday, May 16th, 2010

This script may be of interest and value :

File: convertomp3
#!/bin/bash
#
# Usage: convertomp3 fileextention
#
if [ $1 = "" ];then
  echo 'Please give a audio file extention as argument.'
  exit 1
fi

for i in *.$1
do
  if [ -f "$i" ]; then
  rm -f "$i.wav"
  mkfifo "$i.wav"
  mplayer \
   -quiet \
   -vo null \
   -vc dummy \
   -af volume=0,resample=44100:0:1 \
   -ao pcm:waveheader:file="$i.wav" "$i" &
  dest=`echo "$i"|sed -e "s/$1$/mp3/"`
  lame -V0 -h -b 160 --vbr-new "$i.wav" "$dest"
  rm -f "$i.wav"
fi
done

Running convertomp3 wma will covert every .wma file in the current folder to .mp3.