User Tools

Site Tools


Sidebar

Launch of Linino.org

wiki:lininowebcamstream

How to setup a webcam streaming server

The USB video device class (also USB video class or UVC) is a USB device class that describes devices capable of streaming video like webcams, digital camcorders, transcoders, analog video converters and still-image cameras. In this HOW-to will configure a Linino board in order to detect the video device obtained connecting a webcam to the usb port, and generate a video streaming over the network using mjpg-streamer.

Installation

opkg update
opkg install kmod-video-uvc mjpg-streamer v4l-utils
root@linino:/tmp# opkg update
Downloading http://download.linino.org/linino_distro/master/latest/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/attitude_adjustment.
Downloading http://download.linino.org/linino_distro/master/latest/packages/Packages.sig.
Signature check passed.
 
root@linino:/tmp# opkg install kmod-video-uvc mjpg-streamer
Installing kmod-video-uvc (3.3.8-1) to root...
Downloading http://download.linino.org/linino_distro/master/latest/packages/kmod-video-uvc_3.3.8-1_ar71xx.ipk.
Installing kmod-video-videobuf2 (3.3.8-1) to root...
Downloading http://download.linino.org/linino_distro/master/latest/packages/kmod-video-videobuf2_3.3.8-1_ar71xx.ipk.
Installing mjpg-streamer (r148-4) to root...
Downloading http://download.linino.org/linino_distro/master/latest/packages/mjpg-streamer_r148-4_ar71xx.ipk.
Configuring kmod-video-videobuf2.
Configuring kmod-video-uvc.
[ 1830.570000] usbcore: registered new interface driver uvcvideo
[ 1830.570000] USB Video Class driver (1.1.1)
Configuring mjpg-streamer.

To check the webcam features you an use command: v4l2-ctl –all

root@linino:/# v4l2-ctl --all
Driver Info (not using libv4l2):
        Driver name   : uvcvideo
        Card type     : USB 2.0 Camera
        Bus info      : usb-ehci-platform-1.1.4
        Driver version: 3.3.8
        Capabilities  : 0x04000001
                Video Capture
                Streaming
Format Video Capture:
        Width/Height  : 640/480
        Pixel Format  : 'YUYV'
        Field         : None
        Bytes per Line: 1280
        Size Image    : 614400
        Colorspace    : SRGB
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 640, Height 480
        Default     : Left 0, Top 0, Width 640, Height 480
        Pixel Aspect: 1/1
Video input : 0 (Camera 1: ok)
Streaming Parameters Video Capture:
        Capabilities     : timeperframe
        Frames per second: 10.000 (10/1)
        Read buffers     : 0

Configuration

/etc/config/mjpg-streamer
config mjpg-streamer core
        option enabled          "0"
        option device           "/dev/video0"
        option resolution       "640x480"
        option fps              "5"
        option www              "/www/webcam"
        option port             "8080"

To have more information about the input parameters:

root@linino:~# mjpg_streamer -i "input_uvc.so --help"
MJPG Streamer Version: svn rev: exported
 ---------------------------------------------------------------
 Help for input plugin..: UVC webcam grabber
 ---------------------------------------------------------------
 The following parameters can be passed to this plugin:
 
 [-d | --device ].......: video device to open (your camera)
 [-r | --resolution ]...: the resolution of the video device, can be one of the following strings: QSIF QCIF CGA QVGA CIF VGA SVGA XGA SXGA or a custom value like the following example: 640x480
 [-f | --fps ]..........: frames per second
 [-y | --yuv ]..........: enable YUYV format and disable MJPEG mode
 [-q | --quality ]......: JPEG compression quality in percent (activates YUYV format, disables MJPEG)
 [-m | --minimum_size ].: drop frames smaller then this limit, useful if the webcam produces small-sized garbage frames may happen under low light conditions
 [-n | --no_dynctrl ]...: do not initalize dynctrls of Linux-UVC driver
 [-l | --led ]..........: switch the LED "on", "off", let it "blink" or leave it up to the driver using the value "auto"
 ---------------------------------------------------------------
 
 ---------------------------------------------------------------
 Help for output plugin..: HTTP output plugin
 ---------------------------------------------------------------
 The following parameters can be passed to this plugin:
 
 [-w | --www ]...........: folder that contains webpages in flat hierarchy (no subfolders)
 [-p | --port ]..........: TCP port for this HTTP server
 [-c | --credentials ]...: ask for "username:password" on connect
 [-n | --nocommands ]....: disable execution of commands
 ---------------------------------------------------------------

Plugin the webcam on the Linino board and verify that the /dev/video0 has been created. Launch the following command to have a webcam streaming:

 mjpg_streamer -i "./input_uvc.so -y -n -d /dev/video0 -q 50 -r QVGA -f 6" -o "./output_http.so -p 8080 -n -w /var/www/webcam"

Open the browser and go to: http://linino.local:8080/?action=stream

/var/www/wiki.linino.org/data/pages/wiki/lininowebcamstream.txt · Last modified: 2015/03/22 04:59 by administrator

2014 © dog hunter llc and the Linino Community. Linino.org is a dog hunter sponsored community project. Credits