Restrict Audio sampling rate to 16 kHz

Hi all,

Iwould like to restrict audio sampling rate to 16 kHz. At one of Jitsi calls I have heard this is impossible to do it in frontend.
But it is possible to do it by setting SDP sesion parameters.

How can I do it? I was looking into Jicofo, but haven’t found any place there where SDP session is handled.
May be this can be not into Jicofo or anywhere else?

Thanks in advance for your help!!

Regards,
Ivan

Any update?

I think you should change it in the client: https://github.com/jitsi/lib-jitsi-meet/blob/master/modules/RTC/RTCUtils.js#L359
Why you want to change that?

Hi @damencho! Thanks for the reply!
I would like to restrict audio sampling rate to optimize consumed bandwidth.

I took a look at https://github.com/jitsi/lib-jitsi-meet/blob/master/modules/RTC/RTCUtils.js#L359. It looks like there is no way to set up particularly audio sampling rate there. What I see there, is the ability to change audio params like echoCancellation, noiseSupression, highPassFilter etc. But nothing like sampling rate, frame rate or similar.

You can https://blog.addpipe.com/audio-constraints-getusermedia/
We don’t have such setting, that’s why I sent you the source code where you need to apply your changes.

Are you sure that you will have any big improvement with opus and changing the sample rate? I think I have seen some studies about opus that it is pretty optimised right now and doing that change will not give you the desired optimisation at all.

@damencho, thanks for the reply!
Well, not sure audio sample rate constraints will bring some meaningful difference, but at least I want to implement it and the try it and measure the difference.

Ivan, reducing the sampling rate is not a good way to optimize bandwidth. You should instead restrict the bandwidth and let the opus encoder adapt. I’m not sure if this is easy with jitsi, but you can see what the SDP should look like here:
https://webrtchacks.com/limit-webrtc-bandwidth-sdp/

Boris

hi all, any news on this?
How can I change the sampling rate to 16kHz just to tweak (mainly reduce the bandwidth and also the depth of voice for smoother performance) ? is this possible from lib jitsi meet?
or anyone tried this and what is the outcome?
Edit : I found a way to change, so I will try and give feedback
Thanks in advance :heart:

@damencho
I tried to set the audio constraints as “sampleRate” and “sampleSize” in the RTCUtils.js in the lib-jitsi-meet and in config.js I set the maxOpusBitrate to 510000 but it didn’t seem to work properly.I actually added/push these properties in the objects that also had the properties of auto gain controls or highpassfilters enabling/disabling.

But as in the SDP packet it was ‘48000’. I saw the trsansport layer log message that the clockrate is still 48000 with the websocket message. Or how can I even check the sample rate in webrtc-internals? I was just able to see sending/recieving bits/sec (which was arounf 150kb/s even I change the sampleRate/sampleSize). And even if I configure the getUserMedia to set audio sample rate to 16000 or whatever, does this value also need to be passed to opus encoder? or it is just ok or I have look to munge SDP packet as Boris suggested?
Thanx in advance :heart: