安裝 LAME MP3
1 | yum -y install lame |
1 | yum -y install lame |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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 ============================================================= |
1 2 3 | crontab -e ; 加上 * /5 * * * * su - asterisk -c "/bin/ari-wav2mp3.sh" |