作一個自動壓縮的 shell (謝謝 A-Lang 提供)
vi /bin/ari-wav2mp3.sh
#!/bin/bash
#
# file : ari-wav2mp3.sh
# author: A-Lang, alang[dot]hsu[at]gmail[dot]com
# this is for debugging
#RECORD_PATH="/var/lib/asterisk/mytemp"
#
RECORD_PATH="/var/spool/asterisk/monitor"
LAME="/usr/bin/lame"
cd $RECORD_PATH
#for WAV in $(ls *.wav 2> /dev/null)
#
# Ignore the audio files that are recording.
for WAV in $(ls *.wav | grep -v -e "-out.wav" | grep -v -e "-in.wav" 2> /dev/null)
do
echo "Encoding MP3 file from $WAV ..."
OUT=${WAV%.*}
$LAME --silent -V7 -B24 --tt $OUT.wav --add-id3v2 $OUT.wav $OUT.mp3
test -r $OUT.mp3 && rm -f $OUT.wav
done
#EOF
=============================================================