1、微信小程序錄音,提交到伺服器(此時音頻格式為silk);
2、利用silk-v3-decoder(https://github.com/kn007/silk-v3-decoder), 把silk 轉換成pcm格式 (silk/decoder /data/test.silk /data/1.pcm);
3、 用 ffmpeg 把 44100 采樣率 單聲道 16bts pcm 文件轉 16000采樣率 16bits 位深的單聲道pcm文件
ffmpeg -y -f s16le -ac 1 -ar 44100 -i test44.pcm -acodec pcm_s16le -f s16le -ac 1 -ar 1600016k.pcm (獲得pcm文件)
ffmpeg -y -f s16le -ar 24000 -ac 1 -i /data/1.pcm -f wav -ar 16000 -b:a 16 -ac 1 /data/1.wav (獲得wav文件)
4、調用網路api 轉換 pcm , 就能獲取網路轉換後的 文字
⑵ 基於webrtc以及nodejs的P2P實時視頻demo
吐槽, 你的分類錯了, 導致不能貼代碼。
github:
priologic/easyrtc
webRTC/webRTC.io
自己開發推薦使用/easyrtc
只是玩玩 對於webRTC.io使用簡單
npm install webrtc.io
Client
<video id="local" autoplay="autoplay"></video>
<video id="remote" autoplay="autoplay"></video>
<script src="/webrtc.io.js"></script>
<script>
// note: make sure hostname available to all connecting clients
// (ie. probably not `localhost`)
rtc.connect('ws://yourserveraddress:8001');
rtc.createStream({"video": true, "audio":false}, function(stream){
// get local stream for manipulation
rtc.attachStream(stream, 'local');
});
rtc.on('add remote stream', function(stream){
// show the remote video
rtc.attachStream(stream, 'remote');
});
// more rtc callbacks are available
</script>
Server
var webRTC = require('webrtc.io').listen(8001);
//then a bunch of callbacks are available