一、环境准备
1、brew准备
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
2、gcc准备
MBP ~ % gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.21)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
3、ffmpeg准备
huangshihui@huangshihuideMBP ~ % brew install ffmpeg
二、找到微信语音文件
1、导出聊天记录内的语音信息
在聊天框中选中某张图片,然后在finder中打开,进入微信存储目录
微信语音格式:.silk或.aud.silk格式
2、导出微信收藏内的语音信息,切换至Favorites目录
语音格式:.silk或.aud.silk格式
三、格式转换执行
1、git拉取silk包git clone https://github.com/kn007/silk-v3-decoder.git silk-v3-decoder
MBP silk % ls
Makefile libSKP_SILK_SDK.a
decoder src
interface test
2、将silk先转化为pcm
./decoder ~/Desktop/Audio/1100ff0d291cf89e903.aud.silk ~/Desktop/Audio/1100ff0d291cf89e903.pcm
3、将pcm转化为wav即可导出语音正常播放
ffmpeg -y -f s16le -ar 24000 -ac 1 -i ~/Desktop/Audio/1100ff0d291cf89e903.pcm -f wav -ar 16000 -b:a 16 -ac 1 ~/Desktop/Audio/1100ff0d291cf89e903.wav