【问题标题】:Linphone opus codec sampling rateLinphone opus 编解码器采样率
【发布时间】:2020-06-20 03:51:30
【问题描述】:

我想在 linphone 中使用 opus 编解码器

但我在使用它时遇到了一些问题。如果有作品编解码器知识的人可以帮助我,将不胜感激。 如何将音频采样方案强制为 8000 Hz?目前,它仅使用 48000 Hz。

提前致谢

【问题讨论】:

  • Opus 在 sdp 中使用“opus/48000”进行协商:但它可以配置为以 8000、16000、32000 和 48000 进行编码。可能是您正在混合时间戳和实际采样率的 sdp 频率/编码器使用的质量!
  • 那么,您的意思是 SDP 中的“opus/48000”并不意味着 48000 Hz 采样率?例如,GSM 是一个 8000 Hz 的采样率,编码为大约 24 Kbps 的上传数据。但是当我在 linphone 中使用 Opus (48000) 时,我有 50 Kbps 的上传数据。我想使用 Opus 8000 以降低数据使用量。
  • 是的:sdp 中的 opus/48000 并不意味着采样率中的 48kHz。请参阅 rfc7587 和 rfc6716(例如第 2.1.1 节。比特率)。 code 和 sdp 选项将匹配 libopus 的设置以使用较低的比特率。

标签: sip voip linphone opus linphone-sdk


【解决方案1】:

如果您查看rfc7587 Section 4.1,您可以阅读:

Opus supports 5 different audio bandwidths, which can be adjusted
during a stream.  The RTP timestamp is incremented with a 48000 Hz
clock rate for all modes of Opus and all sampling rates.  The unit
for the timestamp is samples per single (mono) channel.  The RTP
timestamp corresponds to the sample time of the first encoded sample
in the encoded frame.  For data encoded with sampling rates other
than 48000 Hz, the sampling rate has to be adjusted to 48000 Hz.

在 rfc7587 中阅读更多内容,您会发现,在 SDP 中,无论实际采样率如何,您总是会看到编解码器使用“OPUS/48000/2”。

无论实际采样率如何,如上所述,RTP 时间戳将始终以 48000 Hz 时钟频率递增。

如果您希望控制编解码器的实际采样率(进而控制带宽),您可以使用以下 SDP 参数:ma​​xplaybackrate 和 ma​​xaveragebitrate 是要使用的。

第 3.1.1 节列出了 ma​​xaveragebitrate 和采样率之间的关系:

3.1.1.  Recommended Bitrate

   For a frame size of 20 ms, these are the bitrate "sweet spots" for  Opus in various configurations:

   o  8-12 kbit/s for NB speech,
   o  16-20 kbit/s for WB speech,
   o  28-40 kbit/s for FB speech,
   o  48-64 kbit/s for FB mono music, and
   o  64-128 kbit/s for FB stereo music.

结论:要在OPUS中只使用8000Hz,你必须与这些参数协商,其中12kbit/s是NB语音中opus的最大设置:

   m=audio 54312 RTP/AVP 101
   a=rtpmap:101 opus/48000/2
   a=fmtp:101 maxplaybackrate=8000; sprop-maxcapturerate=8000; maxaveragebitrate=12000

我不知道 linphone 是否遵循所有参数,但这是理论上的!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-11
    • 2016-10-30
    • 2016-02-08
    • 1970-01-01
    • 2019-04-29
    • 2015-10-23
    相关资源
    最近更新 更多