Ozeki Camera Recorder Stat

Video tutorial on how to implement recording video function for your camera viewer application in C#

This video demonstrates how you can record video from USB and IP camera in C#. You will see how you can download the Ozeki Camera SDK from the official website. Then how you can integrate the SDK in a Visual Studio solution as a reference. After this video you will know how you can display the image of the USB and IP camera. Moreover you will able to record video and save it on your computer.

Download Video: TutorialVideo6.zip
Download source code: Basic_CameraViewer_6.zip

DISCLAIMER: Please note that the following features will only work if your IP camera supports the given functionality. So please check the user manual of your IP camera to make sure it supports the feature that you wish to implement in C#.



Welcome to the Ozeki Camera SDK video guide tutorial part six. In this chapter we will create a simple project to connect USB camera and IP camera and then we will learn how to record video with them.

This is the 6. video guide from our C# .NET camera tutorial series, in which we present how to use Ozeki Camera SDK to develop different kind of camera solutions.

This SDK is:

  • ONVIF compliant
  • Easy to use
  • Effective

Whether you're a beginner or an experienced C# developer you will certainly be able to implement the solutions presented in these tutorial videos, if you use this Camera SDK. This is gonna be a great video series. They contain short and practical code explanations.

This video will exciting and fun. I hope you will enjoy it.

In this video the main steps are the following

  • First step - Download the sdk from the website
  • Second step - Create WPF solution in Visual Studio
  • Third step - Implementing the camera viewer application
  • Fourth step - Extend the application with motion detection function.
  • and finally the Fifth step - Check the result and we try out our application

And lets start now with the step one.

First of all, let's download the necessary SDK from the www.camera-sdk.com. Click on the download then add a name, an email and a reason why you need this SDK. Click on the OK and you will see the downloading link. Click on it and install it. About the installation you can find more information in the Quick Start section.

After the installation let's create a new WPF solution project in the Visual Studio. Click on the new project and choose the WPF and give a name and select a folder, where you want to save. When the project is exist, then we add the SDK to the references. We can find it, where the installer put it. And you can see the in references list.

Next step is to create the graphical user interface. We can do in the XAML file. We will need two button for USB camera Connection and Disconnection. And then we also need the same for the IP camera, but here we have to add three textboxes where we can add the connection data, like address of the camera, username and password as well. And then the related buttons. Now we add the necessary eventhandler for the Connection and Disconnection buttons. And finally we set the windows property.

After that we can deal with the control. Firstly we add the essential namespaces, which are come from the Ozeki Camera SDK. Then we add the necessary object to display the image of the IP and USB camera. In the constructor we instantiate the above objects. Then we create a helpfunction, which create and set the videoviewer object and add it to the user interface. Now we establish the USB camera connection event handler. Here we create a webcamera object and connect it to the BitmapSourceprovider and then start the camera. Then we implement USB camera disconnection, where we stop the videoviewer and web camera. At IP camera for the connection we add the camera address, the username and the password, then we can start the camera. The Disconnection happens like at the USB camera.

Now we come back to extend the user interface with two buttons, which will start and stop capturing the video. In the xaml file, after we added the necessary elements, then for them we generate two eventhandler methods.

Next step is to declare two new field in order to record a video. These two objects are an IVideoSender object and an MPEG4Recorder object. We instantiate them at USB camera connection and IP camera connection.

Now we can deal with the starting button. In order to every capture have a uniq name, than the name will contain the current date and time. The save folder will be the place of the program. Now we instantiate the recorder and subscribe an eventhandler method for the MultiplexFinished event. Than connect the videosender and the recorder.

After this we create the eventhandler method our first thing is to unsubscribe from the event and dispose the recorder. At stop capturing we disconnect and call the Multiplex method, which create to us the video.

Now check the result. Let's try at IP camera. Add the necessary data: Ip address of the camera, username and password. Because this is the trial version it could happen this image will wait for us for a few moments. You can see the moving leafs. Now start the capture then stop it. Let's see what it did. It works. Now check the USB camera. Now start the capture then stop it. Let's see what it did. It works as well.

I hope you enjoyed the video.

If you liked this video and you want to learn more about further great solutions provided by Ozeki Camera SDK, then download the trial version from our website www.camera-sdk.com and follow our tutorial videos. For more information check out our website, and if you have any questions, send us an email to info@camera-sdk.com.

In the next chapter I will show you how to build a motion detection application. It is gonna be exciting. Thanks for the watching. See you in the next video. Bye.