Tutorial 4 – AVI Export Status
In the previous tutorial, we learned how to check the status of an AVI Export.
In this tutorial, we’ll learn how to Export an AVI with audio.
First, we need to give AxAuga access to a microphone on our camera:
//Force a connection to this camera's NVR and wait until it's valid.
while ((videoCam as OCAdapter.OCCamera).GetDynamicLiveURL() == null)
//Grab the camera's microphone.
Ocularis.IMicrophone videoCamMic = videoCam.Mics().ElementAt(0);
//Give auga direct access to the camera for privileges to stream.
//Give auga direct access to the camera's microphone for privileges to stream.
We use AxAuga’s SetCameraIDispatch to give AxAuga access to the camera’s microphone for privileges to stream audio.
Now that AxAuga has audio streaming access from the camera’s microphone, let’s setup the Export with audio:
string videoURL = videoCam.GetLiveUrl(); //Export video URL for the source including its protocol.
string metaData = ""; //Export Meta data. Not used with AVI Exports.
string audioURL = videoCamMic.GetLiveUrl(); //Export audio URL for the source including its protocol.
int codecFourCC = CODEC_XVID; //Export codec. Possible codecs are cinepak, ffdshow, and xvid.
string preamble = ""; //Export preamble. This string will be inserted into the Export video frames.
int showTimestamp = 1; //Export with timestamp embedded in frames.
int showCameraName = 1; //Export with camera name embedded in frames.
string filename = "C:/Users/Public/avis/export.avi"; //Path to put the export.
short startYear = (short)start.Year; //Export start year in UTC.
short startMonth = (short)start.Month; //Export start month in UTC.
short startDay = (short)start.Day; //Export start day in UTC.
short startHour = (short)start.Hour; //Export start hour in UTC.
short startMinute = (short)start.Minute; //Export start minute in UTC.
short startSecond = (short)start.Second; //Export start second in UTC.
short startMillisecond = (short)start.Millisecond; //Export start millisecond in UTC.
short stopYear = (short)stop.Year; //Export stop year in UTC.
short stopMonth = (short)stop.Month; //Export stop month in UTC.
short stopDay = (short)stop.Day; //Export stop day in UTC.
short stopHour = (short)stop.Hour; //Export stop hour in UTC.
short stopMinute = (short)stop.Minute; //Export stop minute in UTC.
short stopSecond = (short)stop.Second; //Export stop second in UTC.
short stopMillisecond = (short)stop.Millisecond; //Export stop millisecond in UTC.
int x = 0; //Left cropping point.
int y = 0; //Top cropping point.
int x2 = 0; //Right cropping point.
int y2 = 0; //Bottom cropping point.
int quality = 10000; //Export video compression quality indicator. 0 lowest - 10000 highest.
//Start the AVI export using auga.
auga.StartAVIExport(videoURL, metaData, audioURL, codecFourCC, preamble, showTimestamp, showCameraName, filename,
startYear, startMonth, startDay, startHour, startMinute, startSecond, startMillisecond,
stopYear, stopMonth, stopDay, stopHour, stopMinute, stopSecond, stopMillisecond,
x, y, x2, y2, quality);
If you look closely, you’ll see that the only change above from what we already have is the audioURL setting. We use IMicrophone’s GetLiveUrl to get the streaming URL for the microphone as our audioURL during AxAuga’s StartAVIExport.
That’s it. You can now Export AVIs with audio.