Script convert wav files to mp3 files / wav2mp3 on Linux / Asterisk

Script convert wav files to mp3 files / wav2mp3 on Linux / Asterisk

1. First we need read this topic for install lame

http://ithelpblog.com/voice/asterisk/howto-install-lame-mp3-convert-on-centos-redhat-rhel-asterisk/

2. Create bash script

[root@localhost bashscripts]# vi wav2mp3.sh
#!/bin/bash
LAMEOPT=”-V 1″for FILE in *.wav ; do
ONAME=”${FILE%%.wav}.mp3″
lame $LAMEOPT “$FILE” “$ONAME”
done[root@localhost bashscripts]#
[root@localhost bashscripts]# chmod 755 wav2mp3.sh

3. Run script to convert wav files to mp3 files

[root@localhost bashscripts]# ./wav2mp3.sh vm-deleted.wav
LAME 3.99.5 64bits (http://lame.sf.net)
polyphase lowpass filter disabled
Encoding vm-deleted.wav to vm-deleted.mp3
Encoding as 8 kHz single-ch MPEG-2.5 Layer III VBR(q=0.49495)
Frame | CPU time/estim | REAL time/estim | play/CPU | ETA
18/18 (100%)| 0:00/ 0:00| 0:00/ 0:00| 0.0000x| 0:00
8 [ 1] ***************************
16 [ 0]
24 [ 2] ******************************************************
32 [ 3] *********************************************************************************
40 [ 7] *******************************************************************************************************************************************************************************************
48 [ 4] ***********************************************************************************************************
56 [ 1] ***************************
64 [ 0]
—————————————————————————————————————————————————————————————————-
kbps mono % long switch short %
37.8 100.0 22.2 22.2 55.6
Writing LAME Tag…done
ReplayGain: -3.4dB
[root@localhost bashscripts]#

That’s all. Thanks for using IThelpblog.com

 

 

 

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>