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

  1. The capture itself.

  2. Wireshark (https://www.wireshark.org/ )

  3. 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

  4. Microsoft Visual C++ x86 redistributable is required: http://www.microsoft.com/en-US/download/details.aspx?id=30679 

  5. An audio editor such as Audacity (http://www.audacityteam.org/ )or WavePad or Switch audio converter from NCH software . For our case we will use Audacity.

Decode packets as RTP packets 

 

  1. Open the capture in Wireshark. 

  2. 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

 

  1. Go to “Telephony -> RTP -> Show All Streams”.

  2. Select the desired stream and click on “Analyze”.

     

  3. Select “Save Payload…” 

     

  4. 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

  1. Download the Open G.729 Decoder.

  2. Unzip the file content on a local folder  

     

  3. Copy the .raw files to the G729 decoder folder.

     

     

  4.  Open the command prompt by running the CMD command.

     

     

     

  5. Command prompt window will open.

  6. Browse to the folder where the decoder was saved.

  7. Enter the following on the command prompt: cp_g729_decoder.exe sample.raw sample.pcm.raw.

     

  8. The .pcm file will be available for analysis.

 

Using Audacity 

  1. Open Audacity and select the following “File -> Import -> Raw Data”.

  2. Select the sample.pcm.raw file and open it.

     

  3. 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: 8000

     

  4. Click on the play button to listen the audio capture.

Return to Documentation Home I Return to Sangoma Support