This project presents how to build a C# application that can be used to find/discover ONVIF IP cameras on your local network (LAN). It is called ’device discovery’ that can be implemented – inter alia – by using WS-Discovery. After studying this tutorial, you will be able to find out the IP address and the port number of all the available cameras that is connected to your network by using your own C# application.

Table of Contents

HOME TAB - Background
  • Introduction to ONVIF IP camera discovery
  • How to connect an IP camera to the local network (LAN)
  • What is ONVIF
  • Introduction to WS-Discovery
  • More on Webcam / IP / ONVIF IP camera developments
DOCUMENTATION TAB - Code example (Go to the code explanation)
  • Prerequisites
  • Code explanation in C#
    • Source code analysis
    • Implementing the ONVIF IP camera discovery feature
    • Implementing the GUI for the camera discovery application
  • Example for field of use
  • Summary
  • Useful links for more information on this topic
  • Reviewed literature

Introduction to ONVIF IP camera discovery

For better understanding, first of all I would like to introduce briefly the technical and theoretical backgroud of this solution. So let’s see what does it mean ’camera or device discovery’.

Device discovery is a network setting that affects whether your computer can see/find other devices on the network and whether other devices on the network can see your computer. In case of ’camera discovery’ these devices are cameras. So if we talk about ’camera discovery’, we mean the process where the computer is looking for cameras connected to the network. As a result of the process, your computer (more specifically a device discovery application installed on your computer) automatically scans and discovers all of your network cameras and dynamically maps logical connections.

The following figure illustrates how the camera discovery works. The central horizontal line symbolizes your IP network. At the bottom of image you can see a computer that is connected to your network. A camera discovery application has been installed on this PC. You can also see four IP cameras. Three of them are connected to your IP network, but one of them is not. After launching the camera discovery application, the program lists those cameras (including their IP address and port number) that are connected to – thereby can be found within – the network.

how_camera_discovery_works.jpg
Figure 1: How the camera discovery works

How to connect an IP camera to the local network (LAN)

If you need any network video solution, an IP camera is essentially needed. After you have obtained the most appropriate device, some simple configurations are required to be able to use that:
  1. Install the camera by connecting the device to a power source and the switch. Make sure that the viewer PC (on which you would like to view the camera image) has been also connected to the same switch. Some additional configurations may be needed, so follow the user manual of your camera for the successful installation.
  2. Now you need to assign an IP address for your network camera in order to reach it by using your webbrowser on your local computer. You can select automatic or static IP address. (As it will prevent the IP address from changing, it is recommended to use static IP address.)
  3. After you have assigned an IP address, open a webbrowser or lauch a camera video viewer application on your local computer to display the camera image. For this purpose you need to provide your camera's assigned IP address, the proper user name and password. After this the camera image will be loaded.
But what if you do not know the IP address of your IP camera when you want to connect it to the LAN? You can check your local network settings or – which is much easier – you can use a camera discovery application that recognizes the camera connected to the switch and displays its IP address.

What is ONVIF

ONVIF is the abbreviation for Open Network Video Interface Forum that is an organization started in 2008 by Axis Communications, Bosch Security Systems and Sony. ONVIF is a global and open industry forum with the goal to facilitate the development and use of a global open standard for the interface of physical IP-based security products.

onvif_logo.jpg
Figure 2: ONVIF – The IP-based Security Standard (official logo)

The cornerstones of ONVIF are the followings:
  • Standardization of communication between network video devices
  • Interoperability between network video products regardless of manufacturer
  • Open to all companies and organizations

The ONVIF specification defines a common protocol for the exchange of information between network video devices including automatic device discovery, video streaming and intelligence metadata.

In this tutorial an ONVIF-compliant camera SDK has been used (www.camera-sdk.com) for implementing the device discovery functionality for your camera.

Introduction to WS-Discovery

As it was mentioned above, device discovery that can be implemented by using WS-Discovery. WS-Discovery – that is Web Services Dynamic Discovery – is a technical specification that defines a multicast discovery protocol to locate services on a local network. The communication between nodes is done by using Web Services standards, notably SOAP-over-UDP.

The WS-Discovery standard introduces a specific discovery behaviour suitable for e.g. video surveillance purposes. For instance, a fully interoperable discovery requires a well defined service definition and a service searching criteria. The specification covers device type and scopes definitions in order to achieve this.

A successful discovery provides the device service address. Once a client has the device service address it can receive detailed device information through the device service.

In addition to the standard web services discovery protocol the ONVIF specification supports remote discovery proxies to find registered devices through the remote discovery proxy even if the client and the device reside in different administrative network domains.

More on Webcam / IP / ONVIF IP camera developments

Camera SDK: www.camera-sdk.com
IP Camera Manager: http://www.camera-sdk.com/p_105-exe-demo-for-onvif-ip-camera-manager-onvif.html
ONVIF Specification: http://www.onvif.org/specs/core/ONVIF-Core-Spec-v210.pdf

Last edited Oct 10, 2014 at 8:43 AM by simonrobert, version 22