Degraded G.726 quality with pops and clicks
Posted: 02 Mar 2007 12:29
When streaming G.726 audio, I heard degraded G.726 quality(32Kbps) with pops and clicks(24Kbps). After a series of experiments, I find out the problem results from the bitstream packing order.
According to RFC3551 4.5.4, a example of the packing scheme for G.726-24 codewords follows, where bit 7 is the least significant bit of the first octet, and bit A2 is the least significant bit of the first codeword:
0 1 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|C C|B B B|A A A|F|E E E|D D D|C|H H H|G G G|F F| ...
|1 2|0 1 2|0 1 2|2|0 1 2|0 1 2|0|0 1 2|0 1 2|0 1|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
This order is also what Awave Studio assumes to play. However, ffmpeg seems to assume the opposite order as follows:
0 1 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|A A A|B B B|C C|C|D D D|E E E|F|F F|G G G|H H H| ...
|0 1 2|0 1 2|0 1|2|0 1 2|0 1 2|0|1 2|0 1 2|0 1 2|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Therefore, VLC can not play G.726 audio stream correctly.
To solve this problem, one may ask ffmpeg to support the two flavors of packing schemes or rearrange the G.726 bitstream data before telling ffmpeg to decode it.
Any ideas?
Regards
Brain Lai
According to RFC3551 4.5.4, a example of the packing scheme for G.726-24 codewords follows, where bit 7 is the least significant bit of the first octet, and bit A2 is the least significant bit of the first codeword:
0 1 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|C C|B B B|A A A|F|E E E|D D D|C|H H H|G G G|F F| ...
|1 2|0 1 2|0 1 2|2|0 1 2|0 1 2|0|0 1 2|0 1 2|0 1|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
This order is also what Awave Studio assumes to play. However, ffmpeg seems to assume the opposite order as follows:
0 1 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|A A A|B B B|C C|C|D D D|E E E|F|F F|G G G|H H H| ...
|0 1 2|0 1 2|0 1|2|0 1 2|0 1 2|0|1 2|0 1 2|0 1 2|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Therefore, VLC can not play G.726 audio stream correctly.
To solve this problem, one may ask ffmpeg to support the two flavors of packing schemes or rearrange the G.726 bitstream data before telling ffmpeg to decode it.
Any ideas?
Regards
Brain Lai