Mailing List Archive

Decoding G.729 using Ethereal, rtpdump and VoiceAge decoder
Hi,



I am trying to decode a VoIP conversation using G.729 encoding. I have read
older messages on this list (and others) but I am still not able to dump a
listenable .au file.



The steps that I made so far:

- capture the traffic using Ethereal and dumping the RTP data
(Statistics -> RTP -> Show all streams -> SaveAs).

- Use rtpdump (http://www.cs.columbia.edu/IRT/software/rtptools/)
to dump only the audio payload ("rtpdump -F payload -f in.rtp -o out.rtp")

- Use self-made code (see the code at the end of the e-mail) to
convert the rtpdump into the bitstream expected by the decoder

- Decode the bitstream using the VoiceAge decoder (decoder out.rtp
test2.au)

- Play the test2.au using GoldWave, (with all possible combinations
between 16bit signed/unsigned 8000Hz)



Unfortunately all I can hear is some weird sound ( I can see voice patterns
in GoldWave, but the sound is metalic, almost alien-like). Am I doing
something wrong ?



References:

http://www.ethereal.com/lists/ethereal-dev/200505/msg00399.html

http://www.dsprelated.com/groups/speechcoding/show/666.php



//rtp_bitstream.c



[code]

#include <stdio.h>



int main(int argc, char **argv)

{

char c;

FILE *f=fopen("in.rtp", "r");

FILE *fileout = fopen("out3.rtp","w");



long lSize;

char * buffer, * out;

char qbyte, q;



int i, j =0, k;



fseek (f , 0 , SEEK_END);

lSize = ftell (f);

rewind (f);



buffer = (char*) malloc (lSize);

out = (char*) malloc (lSize * 16);



fread (buffer,1,lSize,f);



for (i = 0; i<lSize; i++)

{



qbyte = buffer[i];

for (k=0;k<8;k++)

{



q = qbyte & 1;

out[j] = 0x00;

j++;



if (q == 0)

out[j] = 0x71;

else

out[j] = 0x81;

j++;



qbyte >>= 1;



}

}



fwrite (out , 1 , lSize * 16, fileout);





return 0;

}

[/code]



Best regards,

Gabriel.
Re: Decoding G.729 using Ethereal, rtpdump and VoiceAge decoder [ In reply to ]
Looks you are close because you get some voice patterns. If the RTP packetization period is 20ms, then there are two 10byte samples of G729 encoded data per RTP packet, so make sure when you run the "rtpdump" the samples are in the correct order when generating the bitstream.

Gabriel M. wrote:


Hi,



I am trying to decode a VoIP conversation using G.729 encoding. I have read older messages on this list (and others) but I am still not able to dump a listenable .au file.



The steps that I made so far:

- capture the traffic using Ethereal and dumping the RTP data (Statistics -> RTP -> Show all streams -> SaveAs).

- Use rtpdump (http://www.cs.columbia.edu/IRT/software/rtptools/"]http://www.cs.columbia.edu/IRT/software/rtptools/) to dump only the audio payload (&#8220;rtpdump -F payload -f in.rtp -o out.rtp&#8221;)

- Use self-made code (see the code at the end of the e-mail) to convert the rtpdump into the bitstream expected by the decoder

- Decode the bitstream using the VoiceAge decoder (decoder out.rtp test2.au)

- Play the test2.au using GoldWave, (with all possible combinations between 16bit signed/unsigned 8000Hz)



Unfortunately all I can hear is some weird sound ( I can see voice patterns in GoldWave, but the sound is metalic, almost alien-like). Am I doing something wrong ?



References:

http://www.ethereal.com/lists/ethereal-dev/200505/msg00399.html"]http://www.ethereal.com/lists/ethereal-dev/200505/msg00399.html

http://www.dsprelated.com/groups/speechcoding/show/666.php"]http://www.dsprelated.com/groups/speechcoding/show/666.php



//rtp_bitstream.c




Code
  

#include <stdio.h>



int main(int argc, char **argv)

{

char c;

FILE *f=fopen("in.rtp", "r");

FILE *fileout = fopen("out3.rtp","w");



long lSize;

char * buffer, * out;

char qbyte, q;



int i, j =0, k;



fseek (f , 0 , SEEK_END);

lSize = ftell (f);

rewind (f);



buffer = (char*) malloc (lSize);

out = (char*) malloc (lSize * 16);



fread (buffer,1,lSize,f);



for (i = 0; i<lSize; i++)

{



qbyte = buffer;

for (k=0;k<8;k++)

{



q = qbyte & 1;

out[j] = 0x00;

j++;



if (q == 0)

out[j] = 0x71;

else

out[j] = 0x81;

j++;



qbyte >>= 1;



}

}



fwrite (out , 1 , lSize * 16, fileout);





return 0;

}






Best regards,

Gabriel.
_______________________________________________ Ethereal-dev mailing list Ethereal-dev@ethereal.com http://www.ethereal.com/mailman/listinfo/ethereal-dev"]http://www.ethereal.com/mailman/listinfo/ethereal-dev
RE: Decoding G.729 using Ethereal, rtpdump and VoiceAgedecoder [ In reply to ]
I came across this article
(http://www.cisco.com/warp/public/788/pkt-voice-general/bwidth_consume.html)
that states there is a non-default version of g.729 which uses 30ms
packetization period, thus the RTP payload is 30bytes (I have just noticed
that now, I was under the impression that the payload was 20bytes).

Any idea what to do in this case?



_____

From: ethereal-dev-bounces@ethereal.com
[mailto:ethereal-dev-bounces@ethereal.com] On Behalf Of Alejandro Vaquero
Sent: Tuesday, July 25, 2006 4:41 AM
To: Ethereal development
Subject: Re: [Ethereal-dev] Decoding G.729 using Ethereal, rtpdump and
VoiceAgedecoder



Looks you are close because you get some voice patterns. If the RTP
packetization period is 20ms, then there are two 10byte samples of G729
encoded data per RTP packet, so make sure when you run the "rtpdump" the
samples are in the correct order when generating the bitstream.

Gabriel M. wrote:

Hi,



I am trying to decode a VoIP conversation using G.729 encoding. I have read
older messages on this list (and others) but I am still not able to dump a
listenable .au file.



The steps that I made so far:

capture the traffic using Ethereal and dumping the RTP data (Statistics ->
RTP -> Show all streams -> SaveAs).

Use rtpdump (http://www.cs.columbia.edu/IRT/software/rtptools/) to dump only
the audio payload ("rtpdump -F payload -f in.rtp -o out.rtp")

Use self-made code (see the code at the end of the e-mail) to convert the
rtpdump into the bitstream expected by the decoder

Decode the bitstream using the VoiceAge decoder (decoder out.rtp test2.au)

Play the test2.au using GoldWave, (with all possible combinations between
16bit signed/unsigned 8000Hz)



Unfortunately all I can hear is some weird sound ( I can see voice patterns
in GoldWave, but the sound is metalic, almost alien-like). Am I doing
something wrong ?



References:

http://www.ethereal.com/lists/ethereal-dev/200505/msg00399.html

http://www.dsprelated.com/groups/speechcoding/show/666.php



//rtp_bitstream.c



[code]

#include <stdio.h>



int main(int argc, char **argv)

{

char c;

FILE *f=fopen("in.rtp", "r");

FILE *fileout = fopen("out3.rtp","w");



long lSize;

char * buffer, * out;

char qbyte, q;



int i, j =0, k;



fseek (f , 0 , SEEK_END);

lSize = ftell (f);

rewind (f);



buffer = (char*) malloc (lSize);

out = (char*) malloc (lSize * 16);



fread (buffer,1,lSize,f);



for (i = 0; i<lSize; i++)

{



qbyte = buffer[i];

for (k=0;k<8;k++)

{



q = qbyte & 1;

out[j] = 0x00;

j++;



if (q == 0)

out[j] = 0x71;

else

out[j] = 0x81;

j++;



qbyte >>= 1;



}

}



fwrite (out , 1 , lSize * 16, fileout);





return 0;

}

[/code]



Best regards,

Gabriel.







_____




_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@ethereal.com
http://www.ethereal.com/mailman/listinfo/ethereal-dev
Re: Decoding G.729 using Ethereal, rtpdump and VoiceAgedecoder [ In reply to ]
Gabriel,
As mentioned in that doc, the G729 Codec Sample size it is 10bytes and those 10bytes represent 10ms of voice. Then if you put one, two, three or more of those 10byte samples in one RTP packet it is a different story. The default it is to have two samples per RTP packet (so you have a 20ms packetization period), but you can have three or more in one RTP. The most common packetization periods for G729 are 20ms, 40ms, 60ms or 80ms. Of course when you add more G729 samples in one RTP packet, you save bandwidth because there is less IP/UDP/RTP header involved.

Regards
Alejandro

Gabriel M. wrote:


I came across this article (http://www.cisco.com/warp/public/788/pkt-voice-general/bwidth_consume.html"]http://www.cisco.com/warp/public/788/pkt-voice-general/bwidth_consume.html) that states there is a non-default version of g.729 which uses 30ms packetization period, thus the RTP payload is 30bytes (I have just noticed that now, I was under the impression that the payload was 20bytes).

Any idea what to do in this case?




From: ethereal-dev-bounces@ethereal.com [mailto:ethereal-dev-bounces@ethereal.com] On Behalf Of Alejandro Vaquero
Sent: Tuesday, July 25, 2006 4:41 AM
To: Ethereal development
Subject: Re: [Ethereal-dev] Decoding G.729 using Ethereal, rtpdump and VoiceAgedecoder




Looks you are close because you get some voice patterns. If the RTP packetization period is 20ms, then there are two 10byte samples of G729 encoded data per RTP packet, so make sure when you run the "rtpdump" the samples are in the correct order when generating the bitstream.

Gabriel M. wrote:


Hi,



I am trying to decode a VoIP conversation using G.729 encoding. I have read older messages on this list (and others) but I am still not able to dump a listenable .au file.



The steps that I made so far:

capture the traffic using Ethereal and dumping the RTP data (Statistics -> RTP -> Show all streams -> SaveAs).

Use rtpdump (http://www.cs.columbia.edu/IRT/software/rtptools/"]http://www.cs.columbia.edu/IRT/software/rtptools/) to dump only the audio payload (&#8220;rtpdump -F payload -f in.rtp -o out.rtp&#8221;)

Use self-made code (see the code at the end of the e-mail) to convert the rtpdump into the bitstream expected by the decoder

Decode the bitstream using the VoiceAge decoder (decoder out.rtp test2.au)

Play the test2.au using GoldWave, (with all possible combinations between 16bit signed/unsigned 8000Hz)



Unfortunately all I can hear is some weird sound ( I can see voice patterns in GoldWave, but the sound is metalic, almost alien-like). Am I doing something wrong ?



References:

http://www.ethereal.com/lists/ethereal-dev/200505/msg00399.html"]http://www.ethereal.com/lists/ethereal-dev/200505/msg00399.html

http://www.dsprelated.com/groups/speechcoding/show/666.php"]http://www.dsprelated.com/groups/speechcoding/show/666.php



//rtp_bitstream.c




Code
  

#include <stdio.h>



int main(int argc, char **argv)

{

char c;

FILE *f=fopen("in.rtp", "r");

FILE *fileout = fopen("out3.rtp","w");



long lSize;

char * buffer, * out;

char qbyte, q;



int i, j =0, k;



fseek (f , 0 , SEEK_END);

lSize = ftell (f);

rewind (f);



buffer = (char*) malloc (lSize);

out = (char*) malloc (lSize * 16);



fread (buffer,1,lSize,f);



for (i = 0; i<lSize; i++)

{



qbyte = buffer;

for (k=0;k<8;k++)

{



q = qbyte & 1;

out[j] = 0x00;

j++;



if (q == 0)

out[j] = 0x71;

else

out[j] = 0x81;

j++;



qbyte >>= 1;



}

}



fwrite (out , 1 , lSize * 16, fileout);





return 0;

}






Best regards,

Gabriel.
_______________________________________________ Ethereal-dev mailing list Ethereal-dev@ethereal.com http://www.ethereal.com/mailman/listinfo/ethereal-dev"]http://www.ethereal.com/mailman/listinfo/ethereal-dev
_______________________________________________ Ethereal-dev mailing list Ethereal-dev@ethereal.com http://www.ethereal.com/mailman/listinfo/ethereal-dev"]http://www.ethereal.com/mailman/listinfo/ethereal-dev
RE: Decoding G.729 using Ethereal, rtpdump and VoiceAgedecoder [ In reply to ]
-------------------
The Ethereal project is being continued at a new site. Please go to
http://www.wireshark.org and subscribe to wireshark-dev@wireshark.org.
Don't forget to unsubscribe from this list at
http://www.ethereal.com/mailman/listinfo/ethereal-dev
-------------------
Re: Decoding G.729 using Ethereal, rtpdump and VoiceAgedecoder [ In reply to ]
-------------------
The Ethereal project is being continued at a new site. Please go to
http://www.wireshark.org and subscribe to wireshark-dev@wireshark.org.
Don't forget to unsubscribe from this list at
http://www.ethereal.com/mailman/listinfo/ethereal-dev
-------------------

Gabriel,
if you send me the trace, I can try to "listen" it with my
implementation. Please don't send the attachment to the list.

Regards
Alejandro



Gabriel M. wrote:
> -------------------
> The Ethereal project is being continued at a new site. Please go to
> http://www.wireshark.org and subscribe to wireshark-dev@wireshark.org.
> Don't forget to unsubscribe from this list at
> http://www.ethereal.com/mailman/listinfo/ethereal-dev
> -------------------
>
>
>
> ------------------------------------------------------------------------
>
> Well, after trying all the possible combinations of
> bitstream/nonbistream, payload and decoder options, I have decided to
> ask for a trial of the commercial version of JMStudio’s g729 codec.
>
> So I took another ~1min recording, dump it from ethereal, tcpdump it
> (checked with a hexeditor and the dump matches the payload from
> ethereal), tcpplay it to JMStudio and it’s still not working. All I
> can hear is some voice-like, fast forward mumble.
>
> I’m beginning to think that maybe cisco is using a different
> implementation, or a slightly changed g729 codec. Has anyone tried to
> record conversations on a linksys PAP2 ?
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Ethereal-dev mailing list
> Ethereal-dev@ethereal.com
> http://www.ethereal.com/mailman/listinfo/ethereal-dev
>
_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@ethereal.com
http://www.ethereal.com/mailman/listinfo/ethereal-dev