本文介绍了WebRTC - 禁用所有音频处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在试图通过webrtc获得尽可能干净的音频频道。通过getUserMedia mediaconstraints对象,我设置了以下选项:

 约束:{
audio:{
强制:{
echoCancellation:false,
googEchoCancellation:false,
googAutoGainControl:false,
googAutoGainControl2:false,
googNoiseSuppression:false,
googHighpassFilter :false,
googTypingNoiseDetection:false,
// googAudioMirroring:false //出于某种原因设置googAudioMirroring会导致navigator.getUserMedia错误:NavigatorUserMediaError
}
},
视频:false
},

这大大提高了音频质量,但似乎仍然是存在的音频处理,其中一些测试样本导致以高频噪声形式的音频的残缺。

有一个Chrome标记 - use-file-for-fake-audio-capture 一个href =http://peter.sh/experiments/chromium-command-line-switches/#use-file-for-fake-audio-capture> http://peter.sh/experiments/chromium-command- line-switches /#use-file-for-fake-audio-capture ,它允许通过文件输入进行测试。正如在该标志的描述中提到的那样,所有的音频处理必须被禁用,否则音频将会失真 - 所以似乎还有其他的选择。
$ b 我也尝试过了 - disable-audio-track-processing --audio-buffer-size = 16 --enable-exclusive-audio Chrome标志,但仍然有一些音频处理。

是否有任何方法来禁用仍然存在的音频处理(最好通过JS API)?

解决方案

我打赌,opus编解码器的可变比特率(默认)行为导致一些压缩或调整。您可以手动调整SDP报价以使用CBR(恒定比特率)而不是VBR(可变比特率)。当您从浏览器获得SDP优惠时,请更改以下行:

  a = fmtp:111 minptime = 10; useinbandfec = 1 

到:

  a = fmtp:111 minptime = 10; cbr = 1 

请注意,我是添加 cbr = 1 和删除 useinbandfec = 1 。我不认为放弃 useinbandfec 是必要的,但似乎带内FEC(转发错误修正)导致压缩调整,这也是你想避免的。

I'm currently trying to get a clean as possible audio channel via webrtc. Via the getUserMedia mediaconstraints object, I've set the following options:

constraints: {
        audio: {
            mandatory: {
                echoCancellation: false,
                googEchoCancellation: false,
                googAutoGainControl: false,
                googAutoGainControl2: false,
                googNoiseSuppression: false,
                googHighpassFilter: false,
                googTypingNoiseDetection: false,
                //googAudioMirroring: false // For some reason setting googAudioMirroring causes a navigator.getUserMedia error:  NavigatorUserMediaError
            }
        },
        video: false
    },

This greatly improves the audio quality, but there still seems to be audio processing present which causes the mutilation of the audio in the form of high frequency noise with some of the test samples.

There is a Chrome flag --use-file-for-fake-audio-capture as described at http://peter.sh/experiments/chromium-command-line-switches/#use-file-for-fake-audio-capture which allows input via file for testing. As mentioned in the description of the flag, all audio processing has to be disabled or the audio will be distorted - so there seems to be additional options for this purpose.

I also tried the --disable-audio-track-processing --audio-buffer-size=16 --enable-exclusive-audio Chrome flags, but still there seems to be some audio processing.

Is there any way to disable the still present audio processing (preferably via JS API)?

解决方案

I'd wager that the variable bitrate (default) behavior of the opus codec is causing some compression or adjustment. You could manually mangle the SDP offer to use CBR (constant bitrate) instead of VBR (variable bit rate). When you get the SDP offer from the browser, change the line:

a=fmtp:111 minptime=10; useinbandfec=1

to:

a=fmtp:111 minptime=10; cbr=1

Note that I'm both adding cbr=1 and removing useinbandfec=1. I'm not positive that dropping useinbandfec is necessary, but it seems that in-band FEC (forwarding error correction) causes compression adjustment which you'd want to avoid as well.

这篇关于WebRTC - 禁用所有音频处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 20:35