I hear someone is talking about me
Currently I'm working on the speex implementation. Its almost done but I
have some problems with computing the duration of the media based on the
Shouldn't be hard to fix. Let's discuss ilbc, shall we.
The encoder and decoder requires byte arrays as input and output. So as
I'm not so familiar with this codec I don't know for example how to
compute the length of the output array for the IlbcDecoder based on the
As per RFC specifications of the ilbc codec, the input data MUST be 8000
Hz sampled 16 bits data. To express this in more friendly words, the
data comes as 16 bits elements (a short int) and you need 8000 such
elements (samples) to represent one second.
Now, we still have to talk about how to feed it to the codec. Once again
we refer to the RFC and it says that ilbc can operate using two modes.
It always has to handle data by blocks, but can do so with 20 or 30
milliseconds blocks. Since we have 8000 samples per seconds this means
that an input block is exactly 160 samples (in 20ms mode) or 240 samples
(in 30 ms mode).
I'll have to look at the code again but I think that there is a version
of the coding/decoding function that works with shorts. Otherwise, you
have to split all your 16-bits values in the byte array. This means that
if you use byte arrays, they are 320 bytes large (20ms mode) or 480
bytes large (30 ms mode).
Of course, the size of the compressed data is also defined in the RFC.
For the 20ms mode, the compressed data stream is 304 bits large (38
bytes) and in the 30ms mode, it is 400 bits large (50 bytes). Bitrates
are respectively around 15 and 13 kbps.
Symmetrically, if you decode 50 bytes of data, you will get 480 bytes of
sound (or 240 samples or 30 ms) and if you decode 38 bytes of data
you'll get 320 bytes of data (or 160 samples or 20 ms).
As a sidenote, the 20ms/30ms mode must be configurable because although
ilbc is interoperable, a 20ms stream is no good when decoded with 30ms
mode et vice versa.
And also the same problem as the one with speex how to
compute the duration in milliseconds of the media based on the given
length of the data.
As you can see from ilbc example, it all depends on the specifications.
If you have some document about speex at handy, I'll check right away.
Otherwise I'll dig the web to find the answers =)
To unsubscribe, e-mail: firstname.lastname@example.org
For additional commands, e-mail: email@example.com