I'm trying to capture an audio stream from Axis IP camera. The audio data encoded as g.711 should be captured from the camera. I'm using the following http request:

Stream roughStream = null;
string URLaudio = "";

request = (HttpWebRequest)HttpWebRequest.Create(URLaudio);
request.Credentials = new NetworkCredential("admin", "password");

request.Method = "GET";
audioResponse = (HttpWebResponse)request.GetResponse();

roughStream = audioResponse.GetResponseStream();

However, I am getting that audioResponse has ContentLength equal to -1, (meaning that either I'm not getting the data at all, or it cannot read the stream beacuse of something (stream too long?!?).

I am guessing that camera is sending a continuous stream of packets (at least this is what is said in Axis manual). However, I don't know how to capture and read (I mean decode and play) data stream from the camera.

Is there a way to read stream of g.711 encoded audio with some built in Windows api?

Any suggestions how to do this?

Many thanks!


I've already looked into this example, but it seems that it explains how to capture images from the camera (which I already do) and not how to capture AUDIO.

It seems that once I send the Http request to the camera, the camera starts to send the data packets (i hope these are the audio packets) but I don't now how to play them.

I guess that I need to have decoder in order to decode data..
What would be the best option for playing g.711 encoded data?

I'm using Windows XP.


Take a look at CodeProject article - http://www.codeproject.com/KB/audio-video/cameraviewer.aspx

This article has been dead for over six months. Start a new discussion instead.