D-Link Forums

The Graveyard - Products No Longer Supported => IP Cameras => DCS-5222L => Topic started by: marco.moscatelli on October 11, 2016, 03:15:20 AM

Title: ACAS Audio Format Streaming
Post by: marco.moscatelli on October 11, 2016, 03:15:20 AM
Hi folks,
i have a DCS-5222L  camera and am developing software in C# to control it.
I'm using httpwebrequest to catch pan, tilt and zoom.
I also implemented through the recording of the camera and save the file system in avi format.
My problem comes when I have to save the audio: I saw that among the cgi there is a command to save the stream:
Code: [Select]
var command = "http: //" + ip + "/audio/ACAS.cgi?profileid=1";
The method is the following:
Code: [Select]
try
            {
                var total = 0;
                _stream = new MemoryStream();

                var ip = Resources.IPCAM;
                var command = "http://" + ip + "/audio/ACAS.cgi?profileid=1";

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(command);
                request.Credentials = new NetworkCredential(Resources.CAM_USER, Resources.CAM_PASSWORD);
                WebResponse response = request.GetResponse();

                Stream s = response.GetResponseStream();

                var audioFile = @"C:\picture\" + "WAV" + DateTime.Now.ToString("ddMMyyyy_hhmmss.fff") + ".wav";
                using (fs = File.Create(audioFile))
                {
                    byte[] buffer = new byte[4096];
                    while (s.CanRead)
                    {
                        Array.Clear(buffer, 0, buffer.Length);
                        total += s.Read(buffer, 0, buffer.Length);
                        fs.Write(buffer, 0, buffer.Length);

                        _stream.WriteTo(fs);
                        //fs.Close();
                        //_stream.Close();
                    }
                }

                //response.Close();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
I can't read the new wav file...it is generated but does not open...
have you ever tried to save streaming audio in a file?

kindly let me know.
Thank you and good day.

MM
Title: Re: ACAS Audio Format Streaming
Post by: FurryNutz on October 11, 2016, 07:39:53 AM
I haven't. Not sure if anyone else has. Not much activity mentioning this.

Users have embeded audio though:
http://forums.dlink.com/index.php?topic=65724.msg274430#msg274430 (http://forums.dlink.com/index.php?topic=65724.msg274430#msg274430)