How to decode and playback G.729 audio streams
This is a step-by-step guide to decode/ extract and playback audio streams encoded with G.729.
Requisites
This is the list of requisites for extracting G.729 audio stream from a pcap capture
The capture itself.
Wireshark (https://www.wireshark.org/ )
A G.729 decoder. In this how-to we will use Open G.729 decoder. it can be obtained for free from CodecPro: http://codecpro.com/openInitG729.html .
Microsoft Visual C++ x86 redistributable is required: http://www.microsoft.com/en-US/download/details.aspx?id=30679
An audio editor such as Audacity (http://www.audacityteam.org/ )or WavePad or Switch audio converter from NCH software http://www.nch.com.au/software/audio.html . For our case we will use Audacity.
Decode packets as RTP packets
Open the capture in Wireshark.
Decode packets as RTP packets (G729) by right clicking on a UDP packet and selecting "Decode As… -> RTP" (in the scrolling menu). The packets should now show up as a RTP packet with the payload type being G729.
Extract the RAW data
Go to “Telephony -> RTP -> Show All Streams”.
Select the desired stream and click on “Analyze”.
Select “Save Payload…”
Save options are Format = .raw and Channels = forward. Name the file as sample.raw. The file should now be saved on your PC in RAW format
Converting the .raw file to .pcm format
Download the Open G.729 Decoder.
Unzip the file content on a local folder
Copy the .raw files to the G729 decoder folder.
Open the command prompt by running the CMD command.
Command prompt window will open.
Browse to the folder where the decoder was saved.
Enter the following on the command prompt: cp_g729_decoder.exe sample.raw sample.pcm.raw.
The .pcm file will be available for analysis.
Using Audacity
Open Audacity and select the following “File -> Import -> Raw Data”.
Select the sample.pcm.raw file and open it.
In the “Import Raw Data” window enter the following information:
Signed 16-bit pc
No endianness
1 channel (mono)
Start offset: 0
Amount to import: 100%
Sample rate: 8000Click on the play button to listen the audio capture.