AXIS IP Camera Control with C Sharp

In this article, we will write a program that we can control recording, snapshot, playback, etc. features for Network supported digital Axis brand IP Cameras.
Axis SDK Download and Installation
First of all, we need to download the Axis SDK File (https://www.axis.com/hk/en/support/developer-support/windows-development) from the AXIS Corp. site. After installing the sdk file, which is about 7 mb in size, let’s open the Microsoft Visual Studio program.
In our Visual Studio program, let’s open the Toolbox tab where our tools are located and right click anywhere on the tools with the mouse and click the Choose Items… tab.
It may take a few seconds for the window to open. Wait patiently. Yes, our window is open. Click on COM Componenets and check the box that says AxisMediaControl Class. If you have not installed the AXIS SDK software, this component will not be included.
After pressing the Ok button, you will see the AxisMediaControl object in Toolbax. Drag and drop this object onto your form. After giving the necessary sizing, let’s change the name of our Axis object to something easier to write. In my example I set it as “amc”.
Now let’s manage the controls;
There are two distinctions here. Is the AXIS brand IP camera you are using old generation or new generation? Models such as A210, A211, A212 are old models. So the recording and playback mode is provided by cgi. If it is a new model, that is, if it works with HD, H.264 codec, they have a video stream feature.
In Old Type Cameras:
amc.MediaURL = “http://192.168.2.10/axis-cgi/mjpeg/video.cgi”;
amc.MediaType = “mjpeg”;
[box type=”success” align=”” class=”” width=””]Yeni Tip Kameralarda:
amc.MediaURL = “axrtsphttp://192.168.2.10/axis-media/media.amp”;
amc.MediaType = “h264”;C#as “connection line”. After writing this connection line, the remaining checks are almost the same for all old and new versions of cameras.
Let’s take a look at a few of the controls. The IP camera I use is an older model A210, so I open my connection line accordingly.
amc.MediaURL = “http://192.168.2.10/axis-cgi/mjpeg/video.cgi”;//bağlantı yapılacak kamera IP si.
amc.MediaType = “mjpeg”; // playback modu, codec türü
amc.MediaUsername = “root”; //bağlanacağım kameranın kullanıcı adı. yoksa boş geçebilirsiniz.
amc.MediaPassword = ” 1234″ ; //bağlanacağım kameranın parolası. yoksa boş geçin.</pre>
amc.Play(); //bağlandığnız kameranın o anki canlı görüntüsünü başlatır.
amc.Stop(); //kameradan alınan video akışını durdurur.
amc.Refresh(); //kamerayı yeniler. bir butonun click eventine yazabilirsiniz tek başına
amc.FullScreen=true; // amc nesnesinin double clisk eventine yazabilirsiniz.
amc.SaveCurrentImage(1, @”C:\foto.jpg”); // o anki kareyi fotoğraf olarak kaydeder. </span>
amc.StartRecordMedia(@”C:\video.asf”,8,”0″); // kayıt butonuna basıldığında videoyu kaydetmeye başlar.
amc.StopRecordMedia(); // başlatılan bir video kaydını durdurmaya yarar.
amc.MediaFile = (@”C:\video.asf”); // bu ve alttaki satır ise kaydedilen bir video kaydını tekrar oynatmaya yarar.
amc.Play();C#There are many more features to explore with the Axis component. Finally, an important warning, you need to install the AXIS SDK software on the user computer where you will run this camera program. Otherwise it will give an error.




