我有一个使用WebRTC
的应用程序调用。但是在通话中,我需要录制麦克风。 WebRTC
具有用于录制音频的对象WebRTCAudioRecord
,但是音频文件太大(PCM_16bit
)。我想录制但要缩小。
我已经尝试过MediaRecorder
,但由于记录了WebRTC
并且在呼叫时MediaRecorder
没有记录权限,所以它不起作用。
有人这样做或有任何想法可以帮助我吗?
Video,Webrtc被认为是相对更好的pre-processing工具。
Webrtc本机开发包括完整的optimized native C and C++
类,以保持很好的音频和视频的语音质量和可理解性
,这很有趣。定期访问参考链接:https://github.com/jitsi/webrtc/tree/master/examples。我想记录但尺寸较小。我已经尝试了MediaRecorder,但由于记录了WebRtc并且MediaRecorder在调用时没有记录权限,因此无法正常工作。
reduce or minimize
记录数据的大小
(音频字节),您应该查看不同类型的语音编解码器,它们基本上通过保持sound quality
来减小记录数据的大小。 ]。要查看不同的voice codecs,以下是一些著名的语音编解码器:和时间。 Supppose time = 40ms ---then---> Reocrded Data = 640 bytes (or 320 short)
Size of recorded data is **directly proportional** to both Time and Sample rate.
Sample Rate = 8000 or 16000 etc. (greater the sample rate, greater would be the size)
要查看更多详细信息,请访问:fundamentals of audio data representation。但是实例,那么实际上是不可能的。由于Webrtc
主要处理10ms
音频数据以进行预处理,其中数据包的大小减小到160 bytes
。
第二,如果您想一次使用multiple AudioRecorder
WebRtc
已经从麦克风录制,因此实际上MediaRecorder
实例将不会执行任何功能,因为此答案描述了audio-record-multiple-audio-at-a-time。 Webrtc具有以下管理音频字节的方法,例如; 1. Push input PCM data into `ProcessCaptureStream` to process in place.
2. Get the processed PCM data from `ProcessCaptureStream` and send to far-end.
3. The far end pushed the received data into `ProcessRenderStream`.
我已经维护了有关使用Webrtc进行音频处理的完整教程,您可以访问以查看更多详细信息; Android-Audio-Processing-Using-Webrtc。