树莓派配置语音环境

以下是失败的尝试:

1.下载yasm

解压后在文件夹中依次执行下命令

./configure --prefix=/usr
make
make install

记得加 sudo

2.下载x264

./configure --enable-shared --prefix=/usr
make  
make install  

3.

sudo apt-get install aptitude
sudo aptitude install libfaac-dev libmp3lame-dev libtheora-dev 
libvorbis-dev libxvidcore-dev libxext-dev libxfixes-dev

树莓派上无法安装libfaac-dev,则下载源码编译安装:

./configure --prefix=/usr
make  
make install

依旧报错,找到如下解决办法:

从123行开始修改此文件mpeg4ip.h,到129行结束。

//修改前:
#ifdef __cplusplus
extern "C" {
#endif
char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif

//修改后:
#ifdef __cplusplus
extern "C++" {
#endif
const char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif

4.安装ffmpeg

./configure --prefix=/usr --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads 
--enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid
--enable-x11grab --enable-libvorbis make make install

5.测试, 只需要ffmpeg的录音功能

ffmpeg -y -f alsa -i hw:0 -t 00:00:06 -ar 16000 -ac 1 lib.wav

但是!!报错:

 好吧,我是实在没有解决这个问题

不过,我换了一种录音方式

下载

sudo apt-get -y install alsa-utils alsa-tools alsa-tools-gui alsamixergui

录音方法

arecord -D "plughw:1,0" -d 3 -r 16000 -c 1 -t wav -f S16_LE test.wav

参数解释如下:

plughw:1,0就是外置声卡设备  -D表示指定设备
-d : 录音时间(s)
-r : 频率
-c : 音轨
-t : 文件类型
-f : 格式

 


PS: 树莓派下mplayer的安装
sudo apt-get install mplayer -y

 

posted @ 2017-05-02 21:07  Not-Bad  阅读(1148)  评论(0编辑  收藏  举报