天天看点

VoIP常见编码的带宽计算

voip带宽计算计算方法与所选用的编码方法有关,而与哪个厂家的没有什么关系,公式如下:

带宽=包长度×每秒包数

=包长度×(1/打包周期)

=(ethernet头+ip头+udp头+rtp头+有效载荷)×(1/打包周期)

=(208bit

+160bit+64bit+96bit +有效载荷)×(1/打包周期)

=(528bit+(打包周期(秒)×每秒的比特数))×(1/打包周期)

=(

528 / 打包周期 ) + 每秒比特数

根据各种编码方式,得出:

g711:20ms打包,带宽为 ( 528/20 + 64) kbit/s=90.4 kbit/s

g729:20ms打包,带宽为 ( 528/20

+ 8 ) kbit/s= 34.4 kbit/s

g723:5.3k,30ms打包,带宽为 ( 528/30 + 5.3 ) kbit/s=22.9

kbit/s

业界一般按照下表提供的ip网带宽系数和以太网带宽系数来设计网络带宽:

编解码技术       

压缩速率(kbps)       

打包周期(ms)       

ip网带宽系数        以太网带宽系数

g.711

a/u          

64                    

20                 

1.25                     

1.41

g.729 a/b          

8                     

0.38                     

0.54

g.723.1(5.3kbit/s) 

5.3                   

30                 

0.27                     

0.37

g.723.1(6.3kbit/s) 

6.3                   

0.25                     

0.36

h.263(384kbit/s)   

≈384                 

10                  

6                        

6.2

备注:采用某种编码方式时,用64k乘以相应的带宽系数就可以得出其实际占用的带宽。当然如果是中继接口,还需要考虑信令占据一定的带宽,一般按照2.5%来计算。

举例:

    pbx--e1--router---ip----router---e1---pbx

这里的带宽占用分为2个部分,1是与pbx连接的pots部分,1是路由器之间的voip部分。一般来说,每路模拟线路的带宽占用是64kbps,而ip语音的占用会因不同的编码标准有所不同,从8k到80k可供选择。qos的保证有个要求,就是延迟<=150ms,抖动<=30ms,丢包率<=1%

speex 带宽

we have finally almost finished speex coding on ar1688 dsp. this open source

voice codec turned out to be much more complicated than we expected. there are 8

different bitrate with 8k sampling from 2.15kpbs to 24.6kpbs. i am writing this

article to answer a question of how much bandwidth this codec actually use

during a call.

let us calculate based on 802.3 ethernet using sip

protocol:

ethernet crc: 4 bytes

mac header: 14 bytes

ip header: 20

bytes

udp header: 8 bytes

rtp header: 12 bytes

speex data: x

bytes x depends on bitrate used and number of frames packed in an ethernet

packet ("voice frames per tx" option in ar1688)

total: (58 + x)

speex uses 20ms as a frame the size of compressed data in a frame

with different bitrate are:

2.15kbps: 6 bytes

3.95kbps: 10

5.95kbps: 15 bytes

8kbps: 20 bytes

11kbps: 28 bytes

15kbps: 38

18.2kbps: 46 bytes

24.6kbps: 62 bytes

when only 1 frame is

included in an ethernet frame the actually used bandwidth

are: 

2.15k: 25.6k

3.95k: 27.2k

5.95k: 29.2k

8k:

31.2k

11k: 34.4k

15k: 38.4k

18.2k: 41.6k

24.6k: 48k

when 2

frames are included in an ethernet frame the actually used bandwidth

are:

2.15k: 14k

3.95k: 15.6k

5.95k: 17.6k

8k: 19.6k

11k:

22.8k

15k: 26.8k

18.2k: 30k

24.6k: 36.4k

when 3 frames are

included in an ethernet frame the actually used bandwidth are:

2.15k:

10.1k

3.95k: 11.7k

5.95k: 13.7k

8k: 15.7k

11k: 18.9k

15k:

22.9k

18.2k: 26.1k

24.6k: 32.5k

when 4 frames are included in an

ethernet frame the actually used bandwidth are:

2.15k: 8.2k

3.95k:

9.8k

5.95k: 11.8k

8k: 13.8k

11k: 17k

15k: 21k

18.2k:

24.2k

24.6k: 30.6k

speex 带宽计算方法

计算公式:(  网络包数据  +  数据包数据  )  /  采样时间 

网络包数据 :  58 bytes

 由以下五个部分组成

网络 crc: 4 bytes

(2)mac 地址: 14 bytes

(3)ip 头: 20 bytes

(4)udp 头: 8 bytes

(5)rtp 头: 12 bytes

数据包数据: 20bytes  

采样时间:20ms 

如果每个rtp包只传输1个数据包:

(58 +20)*8 /20*1000 = 31.2kb/s

如果每个rtp包只传输2个数据包:

(58 +40)*8 /40*1000 = 19.6 kb/s

如果每个rtp包只传输3个数据包:

(58 +60)*8 /60*1000 = 15.7 kb/s

如果每个rtp包只传输4个数据包:

(58 +80)*8 /80*1000 = 13.8 kb/s