Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1373678
  • 博文数量: 140
  • 博客积分: 8518
  • 博客等级: 中将
  • 技术积分: 1822
  • 用 户 组: 普通用户
  • 注册时间: 2005-03-01 22:23
个人简介

嘿嘿!

文章分类
文章存档

2016年(2)

2015年(5)

2014年(6)

2013年(11)

2012年(11)

2011年(3)

2010年(4)

2009年(4)

2008年(8)

2007年(23)

2006年(26)

2005年(37)

分类: LINUX

2012-05-24 14:02:08

在 Asterisk 中提供了錄音功能,只是錄下來的 WAV 都很大,最好可以直接轉成 MP3,這樣就不會佔太多空間了。

1.安裝 LAME MP3

1yum -y install lame

2. 作一個自動壓縮的 shell (謝謝 A-Lang 的提供)

01vi /bin/ari-wav2mp3.sh
02 

#!/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

=============================================================

3. 設定排程

1crontab -e
2; 加上
3*/5 * * * * su - asterisk -c "/bin/ari-wav2mp3.sh"
阅读(3353) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~