[Freeswitch-dev] Recompile mod_opus for 8KHz sampling rate
Hi all, Playing with mod_opus came up with the following. I am trying to recompile the codec with 8Khz and 40ms ptime. I am not familiar with the codec internals and not really sure what parameters should I change... In mod_opus.c : Line 59: int bitrate_bps = codec->implementation->bits_per_second; int use_vbr = 1; int complexity = 10; int use_inbandfec = 1; int use_dtx = 1; int bandwidth = OPUS_BANDWIDTH_FULLBAND; int err; I suppose that the bandwidth must be changed to OPUS_BANDWIDTH_NARROWBAND and use_vbr=0 and I haven't found yet whether the FEC parameter is passed to opus encoder. And in Line 184 , I think the following parameters must be changed switch_codec_interface_t *codec_interface; int samples = 480; int bytes = 960; int mss = 10000; int x = 0; int rate = 48000; int bits = 32000; Can you propose any values about these parameters to achieve 8khz with 40ms packet time? Thanks for any help, Dimosthenis
Opus always uses 48khz On Aug 1, 2013 2:15 PM, "Dimosthenis Arkoudeas" <dimosthenis@arkoudeas.com> wrote:
Hi all,****
** **
Playing with mod_opus came up with the following.****
I am trying to recompile the codec with 8Khz and 40ms ptime. I am not familiar with the codec internals and not really sure what parameters should I change…****
** **
In mod_opus.c :****
** **
** **
Line 59:****
int bitrate_bps = codec->implementation->bits_per_second;****
int use_vbr = 1;****
int complexity = 10;****
int use_inbandfec = 1;****
int use_dtx = 1;****
int bandwidth = OPUS_BANDWIDTH_FULLBAND;****
int err;****
** **
I suppose that the bandwidth must be changed to OPUS_BANDWIDTH_NARROWBAND and use_vbr=0 and I haven’t found yet whether the FEC parameter is passed to opus encoder.****
** **
And in Line 184 , I think the following parameters must be changed****
** **
switch_codec_interface_t *codec_interface;****
int samples = 480;****
int bytes = 960;****
int mss = 10000;****
int x = 0;****
int rate = 48000;****
int bits = 32000;****
** **
** **
Can you propose any values about these parameters to achieve 8khz with 40ms packet time? ****
** **
** **
Thanks for any help,****
** **
Dimosthenis****
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
Is there any info how much bandwidth is required for 48kHz audio? How CPU hungry is downsampling to 8kHz G711? According to opus-codec.org, opus can use sampling rates from 8kHz, not just 48kHz. In cases when the call ends in PSTN, won't be appropriate to support 8kHz sampling rate in FS too? On Thu, Aug 1, 2013 at 9:18 PM, Anthony Minessale < anthony.minessale@gmail.com> wrote:
Opus always uses 48khz On Aug 1, 2013 2:15 PM, "Dimosthenis Arkoudeas" <dimosthenis@arkoudeas.com> wrote:
Hi all,****
** **
Playing with mod_opus came up with the following.****
I am trying to recompile the codec with 8Khz and 40ms ptime. I am not familiar with the codec internals and not really sure what parameters should I change…****
** **
In mod_opus.c :****
** **
** **
Line 59:****
int bitrate_bps = codec->implementation->bits_per_second;****
int use_vbr = 1;****
int complexity = 10;****
int use_inbandfec = 1;****
int use_dtx = 1;****
int bandwidth = OPUS_BANDWIDTH_FULLBAND;****
int err;****
** **
I suppose that the bandwidth must be changed to OPUS_BANDWIDTH_NARROWBAND and use_vbr=0 and I haven’t found yet whether the FEC parameter is passed to opus encoder.****
** **
And in Line 184 , I think the following parameters must be changed****
** **
switch_codec_interface_t *codec_interface;****
int samples = 480;****
int bytes = 960;****
int mss = 10000;****
int x = 0;****
int rate = 48000;****
int bits = 32000;****
** **
** **
Can you propose any values about these parameters to achieve 8khz with 40ms packet time? ****
** **
** **
Thanks for any help,****
** **
Dimosthenis****
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
On Mon, 2013-08-05 at 16:59 +0200, Tamas Jalsovszky wrote:
Is there any info how much bandwidth is required for 48kHz audio? How CPU hungry is downsampling to 8kHz G711? According to opus-codec.org, opus can use sampling rates from 8kHz, not just 48kHz. In cases when the call ends in PSTN, won't be appropriate to support 8kHz sampling rate in FS too?
Hi, As in all things in life - it's complicated :) Opus is actually two codecs combined together - CELT, which always uses 48kHz (but can apply a bandpass to improve efficiency at low rates), and SILK, which runs at 8, 12, or 16kHz. The encoder dynamically selects between them (and can even use both in parallel in hybrid mode) based on the selected bitrate, the chosen voice/music mode, and analysis of the audio. The sampling rate selected can change within the stream as the audio changes. The end result is that the Opus codec actually has an internal resampler, and it cannot be disabled. However, the libopus API interface can allow the input/output audio to be any of 8, 12, 16, 24, or 48kHz. This sets the mode of the internal resampler used by Opus to a different value. It might be interesting to try adding support for selecting the API interface rate in freeswitch, as this could avoid running a *second* resample step when you are transcoding into a different format. -- Calvin Walton <calvin.walton@kepstin.ca>
The programing API for opus only uses 48khz signed linear audio. We add the codec to the system with that as the native rate and it translates for us. I don't know what the cost is really. Its not really useful to use if you plan to bridge to the PSTN anyway but it will work fine in FS at probably some noticeable cpu usage. On Mon, Aug 5, 2013 at 9:59 AM, Tamas Jalsovszky <jalsot@gmail.com> wrote:
Is there any info how much bandwidth is required for 48kHz audio? How CPU hungry is downsampling to 8kHz G711? According to opus-codec.org, opus can use sampling rates from 8kHz, not just 48kHz. In cases when the call ends in PSTN, won't be appropriate to support 8kHz sampling rate in FS too?
On Thu, Aug 1, 2013 at 9:18 PM, Anthony Minessale < anthony.minessale@gmail.com> wrote:
Opus always uses 48khz On Aug 1, 2013 2:15 PM, "Dimosthenis Arkoudeas" < dimosthenis@arkoudeas.com> wrote:
Hi all,****
** **
Playing with mod_opus came up with the following.****
I am trying to recompile the codec with 8Khz and 40ms ptime. I am not familiar with the codec internals and not really sure what parameters should I change…****
** **
In mod_opus.c :****
** **
** **
Line 59:****
int bitrate_bps = codec->implementation->bits_per_second;****
int use_vbr = 1;****
int complexity = 10;****
int use_inbandfec = 1;****
int use_dtx = 1;****
int bandwidth = OPUS_BANDWIDTH_FULLBAND;****
int err;****
** **
I suppose that the bandwidth must be changed to OPUS_BANDWIDTH_NARROWBAND and use_vbr=0 and I haven’t found yet whether the FEC parameter is passed to opus encoder.****
** **
And in Line 184 , I think the following parameters must be changed****
** **
switch_codec_interface_t *codec_interface;****
int samples = 480;****
int bytes = 960;****
int mss = 10000;****
int x = 0;****
int rate = 48000;****
int bits = 32000;****
** **
** **
Can you propose any values about these parameters to achieve 8khz with 40ms packet time? ****
** **
** **
Thanks for any help,****
** **
Dimosthenis****
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org googletalk:conf+888@conference.freeswitch.org pstn:+19193869900
participants (4)
-
Anthony Minessale
-
Calvin Walton
-
Dimosthenis Arkoudeas
-
Tamas Jalsovszky