[英]How to convert silk audio file from WeChat to amr format?
When I developing WeChat mini program, I want to achieve the voice control. 当我开发微信迷你程序时,我想实现语音控制。 but the audio provided by WeChat client is silk. 但微信客户提供的音频是丝绸。
I need to convert the silk file to some format can be recognized by 3rd voice detection service. 我需要将丝绸文件转换为某种格式,可以通过第3种语音检测服务识别。
Some 3rd services support amr format. 一些第三服务支持amr格式。 It's really great, because the size could be very small. 这真的很棒,因为尺寸可能非常小。
The steps as follows: 步骤如下:
brew install ffmpeg --with-opencore-amr --with-speex
. 最简单的方法是brew install ffmpeg --with-opencore-amr --with-speex
。 ffmpeg -y -f s16le -ar 24000 -ac 1 -i "$1.pcm" -ar 8000 "${1%.*}.$2”
. 我们必须将第70行中的命令更改为ffmpeg -y -f s16le -ar 24000 -ac 1 -i "$1.pcm" -ar 8000 "${1%.*}.$2”
。 On MacOS, the procedure is working for converting silk to mp3, you may manipulate a little bit and test on other OS for amr. 在MacOS上,程序正在将丝绸转换为mp3,你可以稍微操作一下并在其他操作系统上测试amr。
Download lame http://lame.sourceforge.net/ , run 下载跛脚http://lame.sourceforge.net/ ,运行
./configure && make && sudo make install
If you encounter 如果遇到
Undefined symbols for architecture x86_64: 架构x86_64的未定义符号:\n"_lame_init_old", referenced from: “_lame_init_old”,引自:\n -exported_symbol[s_list] command line option -exported_symbol [s_list]命令行选项\nld: symbol(s) not found for architecture x86_64 ld:找不到架构x86_64的符号\nclang: error: linker command failed with exit code 1 (use -v to see invocation) clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)\nRemove line
lame_init_old
from ${lame}/include/libmp3lame.sym
before ./configure
在./configure
之前从${lame}/include/libmp3lame.sym
删除行lame_init_old
Download ffmpeg from http://ffmpeg.org/ , run 从http://ffmpeg.org/下载ffmpeg,运行
./configure --enable-libmp3lame && make && sudo make install
If you encounter 如果遇到
nasm/yasm not found or too old. nasm / yasm未找到或太旧。 Use --disable-x86asm for a crippled build. 使用--disable-x86asm进行残缺的构建。\n. 。 Then run
brew install yasm
before ./configure
然后在./configure
之前运行brew install yasm
Download https://github.com/kn007/silk-v3-decoder 下载https://github.com/kn007/silk-v3-decoder
Run the command to convert silk to mp3. 运行命令将silk转换为mp3。
${your-silk-v3-decoder-folder}/converter.sh {silk file full path} mp3
And you will see the mp3 file in the same path as the input silk. ${your-silk-v3-decoder-folder}/converter.sh {silk file full path} mp3
你会看到mp3文件与输入丝相同的路径。 And the path to silk file MUST be full path. 丝绸档案的路径必须是完整的路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.