Sei sulla pagina 1di 4

Decode and Play G729 on Windows

Pgina 1

My 1st Blog
Home Jun 03

Decode and Play G729 on Windows


the imax Uncategorized 2010-06-03 Decode and Play G729 on Windows Wireshark has a very nice feature that lets you play and listen to G711 streams present in a captured traffic dump file, unfortunately Wirehsark is not able to directly decode G729 However, you can still manage to play and listen to the G729 stream by using the following steps 1) Open the capture file using wireshark 2) Go to Telephony > RTP > Show all streams 3) That will open up a windows listing all detected RTP streams, click on any stream And select analyze 4) On the next windows click on Save Payload let the format be as raw, lets name the file as stream.raw So by now you have an output file named stream.raw , you will get an error if you try to play this file using any media player You , will need to first convert this saved stream to PCM format, a free decoder is available at http://www.voiceage.com /openinit_g729.php Download and unzip the decoder files on your PC in folder C:\g729de and than follow the below steps 1) 2) 3) Copy the saved stream file stream.raw to C:\g729de Open-up DOS command prompt and cd to C:\g729de Issue the following command in the command prompt window
stream.raw stream.pcm

va_g729_decoder.exe

So now you have the G729 converted to a PCM file named stream.pcm But the .pcm file contains 16-bit linear PCM samples at 8000 Hz. in Little -Endian format. To convert to .au format, you need to appened the 24 byte au header, and convert each PCM sample to network byte order (or Big-Endian). The following Perl Script as present on Wikeshak wiki page will be used to do the conversion
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

# # USAGE: perl pcm2au.pl inputFile outputFile $usage = "Usage: 'perl $0 <source PCM File > <destination AU File>' "; $srcFile = shift @ARGV || die $usage; $dstFile = shift @ARGV || die $usage; open(SRCFILE, "$srcFile") || die "Unable to open file : $!\n"; binmode SRCFILE; open(DSTFILE, "> $dstFile") || die "Unable to open file: $!\n"; binmode DSTFILE; ################################### # Write the AU header ################################### print DSTFILE ".snd";

$foo = pack ("CCCC", 0,0,0,24); print DSTFILE $foo; $foo = pack ("CCCC", 0xff,0xff,0xff,0xff); print DSTFILE $foo; $foo = pack ("CCCC", 0,0,0,3); print DSTFILE $foo; $foo = pack ("CCCC", 0,0,0x1f,0x40);

http://www.wapopia.com/blog/2010/06/03/decode-and-play-g729-on-windows/

30/05/2011 16:19:27

Decode and Play G729 on Windows


32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

Pgina 2

print DSTFILE

$foo;

############################# # swap the PCM samples ############################# while (read (SRCFILE, $inWord, 2) == 2) { @bytes = unpack('CC ', $inWord); $outWord = pack('CC', $bytes[1], $bytes[0]); print DSTFILE $outWord; } close(DSTFILE); close(SRCFILE);

Copy and save the above script in a text file named pcm 2au.pl in C:\g729de Google for Strawberry Perl and install in on your PC Now again fire -up the command prompt cd to C:\g729de And issue the following command
perl pcm2au.pl stream.pcm steream.au

And thats it , now you have successfully decoded the G729 on your Windows Computer and can play the stream.au file using any player like Windows Media Player or VLC player Related posts: 1. 2. 3. 4. 5. 6. How to run a FTP script in Windows? Not only Windows has a built-in command line FTP utility... Play mp3 in Linux If you want to play MP3s in Linux than a. .. Creating Tar.gz files in Windows You can open and extract the content from gzipped in... Windows Standby / Hibernation & Network Connections Disappear I had been having this problems for many months, whenever... Windows reboots during booting Once again Windows Troubles, last week I turned off the... How to Show arp entries in Windows arp a Displays the ARP entries in Windows by checking...

Address: http://www.wapopia .com/blog/2010/06/03/decode-and-play-g729-on-windows/ Unlimited Long Distance Calling Tip : Detecting RTP Streams in Wireshark Trackback

5 comments untill now


1. Anderson @ 2010-06-09 21:10

I cant decode with the perl command, it just open a window Windows Cannot Execute the Program .. 2. Pat @ 2010-06-09 22:51

There is a problem with line 12 of the script. It should read open(DSTFILE, > $dstFile) Looks like HTML has screwed this up 3. the imax @ 2010-06-10 05:57

@Anderson Have you installed Strawberry Perl ? @Pat Thanks for the tip , I have fixed that up

http://www.wapopia.com/blog/2010/06/03/decode-and-play-g729-on-windows/

30/05/2011 16:19:27

Decode and Play G729 on Windows 4. Charles @ 2010-06-20 15:16

Pgina 3

Hi, Ran the command, and got the following error message >perl pcm2au.pl stream.pcm stream.au Search pattern no terminated at pcm2au.pl line 49. 5. the imax @ 2010-06-20 16:04

@Charles Sorry, WYSIWYG had messed up the code, please again copy the perl code from above and save it to the pcm 2au.pl file. conversion will work now

Add your comment now


Name (required) Email (Will NOT be published ) (required) URL

Submit

Notify me of followup comments via e-mail

Recent Comments
Mohamed on How to Copy Text from Nokia Symbian Browser ? Pam on Download USBSTOR.SYS Gamal3434 on Nokia E72 VoIP Settings Sameer on Nokia E72 VoIP Settings Jordan Enriquez on SIM Card Rejected Nokia

Recent Posts
Pure-Ftpd Unix Authentication Search and replace text in all files in Sub directories Manage Music in Linux cellular Mobile Phone Technologies used in US Turn off & Disable Google Search Preview Recover iPad, iPod, iPhone Backup password How to save iPhone Battery Nokia 1800 Features, Review & Price iPhone 4 vs Samsung Captivate How to reset Samsung t239

Blogroll
OpenSolaris Tech FAQs

Archives
December 2010 November 2010

http://www.wapopia.com/blog/2010/06/03/decode-and-play-g729-on-windows/

30/05/2011 16:19:27

Decode and Play G729 on Windows October 2010 September 2010 August 2010 July 2010 June 2010 May 2010 February 2010 January 2010 December 2009 November 2009 October 2009 September 2009 August 2009 July 2009 June 2009 May 2009 April 2009 March 2009 February 2009 January 2009 December 2008 November 2008 September 2008 August 2008 June 2008 May 2008 April 2008 March 2008 February 2008 January 2008 December 2007 September 2007 August 2007 July 2007 June 2007 May 2007 December 2006 October 2006 September 2006 August 2006 May 2006 April 2006 March 2006 January 2006 December 2005 November 2005 October 2005 September 2005 My 1st Blog coogee theme 2008 RSS Feed WordPress TOP

Pgina 4

http://www.wapopia.com/blog/2010/06/03/decode-and-play-g729-on-windows/

30/05/2011 16:19:27

Potrebbero piacerti anche