Netcam Application

From RidgeRun Developer Connection
Jump to: navigation, search

RR Eval SDK download button.png RR Pre built demo image download.png RR Contact Us.png


This article discusses Netcam, RidgeRun's easy-to-integrate software solution for GStreamer-oriented IP Camera system.

Introduction

The world of video surveillance is moving toward the IP network. An IP Network Camera or, also known as an IP camera or network camera, or Netcam for short, can be defined as an embedded system with networking and video processing combined into one unit. A Netcam captures and transmits live images over the network, enabling remote viewing and user control from anywhere, anytime. Digital video transmission is fast becoming a standard feature in many classes of devices, from surveillance systems, to high end doorbells, and much more.

RidgeRun has extensive experience with embedded multimedia processing and providing full Linux solutions for embedded systems. After many years of develop custom solution, this expertise made it possible for RidgeRun to develop our own IP Camera solution known as Netcam. The main Netcam goal is being a platform independent application for embedded systems that use SoCs with hardware accelerated video and audio processing capabilities, such as Freescale iMX6 and TI Davinci.

With this application, highly specific but yet commonly expected capabilities such as video recording, video streaming and others can be accessed without having to worry about the inner technical details of the GStreamer API, working through HTTP requests that links camera control operations with the client's web browser or other network server. Along with the GStreamer control application, a FastCGI-based web-server is used to support speed-critical environments while remaining standards-compliant, secure and flexible.

Available Functionality

From the web browser, it's possible to get access to different functions that may control camera behavior and properties. Some of these and their expected behavior are documented below:

  • Starting and stopping the camera:
Through the very simple and pretty much auto-explanatory camera_start and stop buttons, the camera can be either started or stopped.
  • Taking Snapshots:
Taking a snapshot is straightforward with the GStreamer properties for its pipelines.
  • Streaming Video:
Similarly, video recording can be done by using the respective start and stop buttons.
  • Recording Video:
Similarly, video recording can be done by using the respective start and stop buttons.
  • Pan & Tilt:
Is the ability of remote directional and zoom control of the captured image.
  • Dynamic camera configuration:
It's possible to set different properties related to the camera even while the pipelines are running:
  • Streaming Bitrate: Sets the bitrate for the streaming pipeline.
  • Streaming Framerate: Sets the framerate for the streaming pipeline.
  • Recording Bitrate: Sets the bitrate for the recording pipeline.
  • Camera Brightness: Sets the brightness of the camera.
  • Camera Exposure Time: Sets the exposure time of the camera.
  • Camera Contrast: Sets the contrast of the camera.
  • Camera Framerate: Sets the frame-rate of the camera.
  • Camera Red Gain: Sets the red-gain of the camera.
  • Camera Green Gain: Sets the green-gain of the camera.
  • Camera Blue Gain: Sets the blue-gain of the camera.
  • Static camera configuration:
Due to some limitations, some properties must be set while pipelines are not running:
  • Camera Resolution: Sets the output resolution of the camera.

Currently supported platforms

RidgeRun is making an effort to add SDK support on new hardware platforms, which eventually will become supported by the Netcam application.

Processor Board
Capture Interface
Static configuration
Dynamic configuration
Pan_&_Tilt
Video Streaming
Video Recording
Snapshots
Documentation
DM36x
Parallel Port
Yes
Yes
Yes
Yes
Yes
Not yet
Getting Started Guide for DM368 DM365 LeopardBoard
DM385
MIPI/CSI2
Not yet
Not yet
Not yet
Yes
Yes
Not yet
Getting Started Guide for DM385 FossilShale
DM814x
Parallel Port
Not yet
Not yet
Not yet
Yes
Yes
Not yet
Getting Started Guide for DM8148 EVM
DM816x
Parallel Port
Not yet
Not yet
Not yet
Yes
Yes
Not yet
Getting Started Guide for DM8168 EVM

Technical Details

Implementation details are discussed here. Also libraries and software dependencies are listed.

Python Developed

With the straightforward Python syntax, the application is easily extensible, keeping in mind the ability to add new features in the near future. A modulated approach enables fast platform adaptability when new hardware support is needed, everything is working in an API-like communication in between software modules.

Python required libraries

  • PyGobject:
PyGObject is a Python extension module that gives clean and consistent access to the entire GNOME software platform through the use of GObject Introspection. PyGObject provides full support of GObject Introspection and all of its features (callbacks, GVariant support, closures, sub-classing, etc.).
  • Python-flup:
Flup is a pure-python wsgi gateway/server that works with fastcgi, simple cgi aka scgi, and apache jserv protocol aka ajp. Used as a fastcgi-to-wsgi server adapter, it's used to create wsgi applications in python that can be called via the fastcgi protocol; when fastcgi starts such an application, the flup wsgi server starts up and waits for a fastcgi connection over a socket.
  • Python-flask:
Flask is a micro web application framework written in Python and based on the Werkzeug toolkit and Jinja2 template engine. It is BSD licensed.
It is called a microframework because it does not presume or force a developer to use a particular tool or library. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. However, Flask supports extensions, that can add application features as if they were implemented in Flask itself.
  • Python-wekzeug:
Werkzeug is a lightweight library for interfacing with WSGI. It features request and response objects, an interactive debugging system and a powerful URI dispatcher. Combine with your choice of third party libraries and middleware to easily create a custom application framework.
  • Python-jinja2:
Jinja2 is one of the most used template engines for Python. It is inspired by Django's templating system but extends it with an expressive language that gives template authors a more powerful set of tools. On top of that it adds sandboxed execution and optional automatic escaping for applications where security is important.

FastCGI based

CGI is a protocol for interfacing external applications to web servers. CGI applications run in separate processes, which are created at the start of each request and torn down at the end. This "one new process per request" model makes CGI programs very simple to implement, but limits efficiency and scalability. At high loads, the operating system process creation and destruction overhead becomes significant. In addition, the CGI process model limits resource reuse techniques (such as reusing database connections, in-memory caching, etc.).

To address the scalability shortcomings of CGI, Open Market developed FastCGI and first introduced it in their webserver product in the mid-1990s. Open Market originally developed FastCGI in part as a competitive response to Netscape's proprietary, in-process API (NSAPI) for developing Web applications.

Lighttpd

Lighttpd is an open-source web server optimized for speed-critical environments. It supports the FastCGI, SCGI and CGI interfaces to external programs, permitting web applications written in any programming language to be used with the server.

Netcam uses Lighttpd interface to enable the communication between the web server, running in the embedded system and the web client, that controls the multimedia functionality exposed by the server.

External dependencies

  • GStreamer Daemon:
GStreamer Daemon is a technology developed by RidgeRun as a generic framework for creating audio/video server usable through DBUS.
Gstd servers several proposes:
  • Simple creation and manipulation of GStreamer pipelines from other applications, like graphic applications (media players, etc), website, or command line tools.
  • Automated testing of GStreamer components.
RidgeRun has created a series of training and demo videos on GStd. Please try one of those here RidgeRun GStreamer Daemon In Action
  • GStreamer Interpipe Plugin:
GStreamer Interpipe elements are technology developed by RidgeRun as a replacement for selector and tee elements. It consists of both Interpipesrc and Interpipesink to enable communication between two or more independent pipelines. The advantage is that you can more easily control complex pipelines (by breaking them down into simple pipelines). A typical device would have one or two video capture sensors, where the device can stream over the network, save to file, and take high resolution pictures. There are many embedded device solutions that can be solved using GStreamer Daemon and Interpipe elements, without the app developer ever having to use a single GStreamer API.

Install and configure Netcam Application

You can follow the Netcam Getting Started wiki-page for an step-by-step guide on how to install, compile and setup your Netcam Application: http://developer.ridgerun.com/wiki/index.php/Netcam_Getting_Started