Webcam streaming

This article illustrates how to do web video streaming using some very easy to found commercial webcams.

We've select three webcams that belong to different classes of cost and feature:

  • Logitech Webcam C250 1.3 megapixel webcam
  • Microsoft Lifecam Cinema 720p HD webcam
  • Logitech QuickCam© Sphere AF. Motorised 2-megapixel HD sensor webcam with Carl Zeiss® optics.

All the webcam tested are available on the Acme Systems eshop: Buy

All these cams are compatible with the USB Video device Class (UVC) that is a standard USB device class defined by the USB Implementers Forum.

The UVC driver for Linux are available here http://linux-uvc.berlios.de but since the Linux 2.6.26 is included in kernel source distribution. This driver and the Video for Linux (V4L2) support is already installed in the factory default Debian Linux available for the FOX Board G20. What we need more is mjpeg_streamer program that gets the mjpeg data from V4L2 and send it through a http session.

Mjpeg_streamer automatically generates a set of html pages that illustrates different methods to stream the video over your browser. The best result comes using Google Chrome on any OS but it works well also on Firefox, Opera and IE.

MJPG Streamer default web page

The stream works well but slower also on the iPhone.

Using the Logitech QuickCam Sphere AF it is possible to control also the camera tilt an pan with the default control panel.

MJPG Streamer control panel

To provide these pages MJPG Stream uses an internal webserver service on port 8080 and port 8081.

Image gallery

Following are shown the screenshow obnained fron each webcam at max resolution. Please note that some webcam can provide higher resolution but it are non managed by FOX die to the 12Mbits limit of the USB ports.

Logitech Webcam C250

Microsoft Lifecam Cinema

Logitech QuickCam Sphere AF

Video mode and frame rate

Please note that the video mode found by the uvcvideo driver are limited by the USB port interface baud rate at 12Mbps.

Logitech Webcam C250

uvcvideo: Probing generic UVC device 2
uvcvideo: Found format YUV 4:2:2 (YUYV).
uvcvideo: - 160x120 (15.0 fps)
uvcvideo: - 176x144 (15.0 fps)
uvcvideo: Found format MJPEG.
uvcvideo: - 640x480 (30.0 fps)
uvcvideo: - 160x120 (30.0 fps)
uvcvideo: - 176x144 (30.0 fps)
uvcvideo: - 320x240 (30.0 fps)
uvcvideo: - 352x288 (30.0 fps)
uvcvideo: - 640x360 (30.0 fps)
uvcvideo: - 640x400 (30.0 fps)

Microsoft Lifecam Cinema

uvcvideo: Probing generic UVC device 2
uvcvideo: Found format YUV 4:2:2 (YUYV).
uvcvideo: - 160x120 (15.0 fps)
uvcvideo: - 176x144 (10.0 fps)
uvcvideo: Found format MJPEG.
uvcvideo: - 640x480 (15.0 fps)
uvcvideo: - 640x360 (15.0 fps)
uvcvideo: - 416x240 (30.0 fps)
uvcvideo: - 352x288 (30.0 fps)
uvcvideo: - 176x144 (30.0 fps)
uvcvideo: - 320x240 (30.0 fps)
uvcvideo: - 160x120 (30.0 fps)

Logitech QuickCam® Sphere AF

uvcvideo: Probing generic UVC device 2
uvcvideo: Found format MJPEG.
uvcvideo: - 160x120 (30.0 fps)
uvcvideo: - 176x144 (30.0 fps)
uvcvideo: - 320x240 (15.0 fps)
uvcvideo: - 352x288 (15.0 fps)
uvcvideo: - 640x480 (15.0 fps)
uvcvideo: - 800x600 (15.0 fps)
uvcvideo: Found format YUV 4:2:2 (YUYV).
uvcvideo: - 160x120 (15.0 fps)
uvcvideo: - 176x144 (15.0 fps)

To have this list use these command:

debarm:~# modprobe -r uvcvideo
debarm:~# modprobe uvcvideo trace=15

Insert the webcam and type:

debarm:~# dmesg

How to install MJPG Streamer

From the source

It is possible to install MJPG streamer from the sources and compile it directly on the fox. To do that you have to install gcc, make, subversion and libjpeg library.

debarm:~# apt-get update
debarm:~# apt-get install gcc
debarm:~# apt-get install make
debarm:~# apt-get install subversion
debarm:~# apt-get install libjpeg-dev

Now move on working directory to download the MJPG sources and type:

debarm:~# svn co https://mjpg-streamer.svn.sourceforge.net/svnroot/mjpg-streamer
...
Checked out revision XX.
debarm:~# cd mjpg-streamer
debarm:~# ls 
mjpeg-client  mjpg-streamer  uvc-streamer

Move on mjpg_streamer forlder and run make to generate the executable files:

debarm:~# cd mjpg-streamer
debarm:~# make

After a while the mjpg-streamer executable will be ready.

How to use MJPG Streamer

A complete list of examples are available on the start.sh file in mjpg_streamer directory.

debarm:~# ./mjpg_streamer -i "./input_uvc.so -f 15 -r 640x480" -o "./output_http.so -w ./www"
MJPG Streamer Version.: 2.0
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 15
 i: Format............: MJPEG
 o: www-folder-path...: ./www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled

The video below shows a web video streaming using the tilt and pan controls:

Related links


Logitech Webcam C250
1.3MP USB Webcam.

Please note that the max resolution reachable with this webcam on the FOX Board G20 is 640x480 at 15Fps

Logitech Quickcam Sphere AF
USB Webcam with motorized tilt and pan and Carl Zeiss optics.

Please note that the max resolution reachable with this webcam on the FOX Board G20 is 800x600 at 15Fps

Microsoft LifeCam Cinema
720p HD Widescreen Video USB webcam fully compatible with UVC driver.

Please note that the max resolution reachable with this webcam on the FOX Board G20 is 640x480 at 15Fps

 
tutorial/webcam.txt · Last modified: 2010/04/05 15:58 by asquini
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki