uvccapture FTW

A commandline solution
Added by Matt Platte over 1 year ago

The Logitech gang provide/link to uvccapture. It's kind of old, so I'm attaching the source files.
  • tar xv --bzip2 -f uvccapture-0.5.tar.bz2
  • cd uvccapture-0.5
  • make
  • sudo make install
    ...should be sufficient.

Comments

Added by Matt Platte over 1 year ago

Aaaand, if yer using the Mac, iSightCapture seems prepared to offer similar capabilities. (see the Files section)

Added by Matt Platte about 1 year ago

Requires libjpeg-dev, apparently.

matt@carlton:~/Downloads/uvccapture-0.5$ sudo make install
install uvccapture /usr/local/bin

Added by Matt Platte about 1 year ago

http://grumbel.blogspot.com/2010/04/some-notes-on-ubuntu-1004.html

uvccapture fails to capture at 1280x1024, lower resolutions still work:

Unable to query buffer (22).
Init v4L2 failed !! exit fatal

In dmesg it gives:

vmap allocation for size 36704256 failed: use vmalloc= to increase size

Adding vmalloc=268435456 to the Kernel Boot Parameter works as a workaround

Added by Matt Platte about 1 year ago

Using Grub2, here's how to add that Kernel Boot Parameter

http://ubuntuforums.org/showthread.php?t=1366354

Added by Matt Platte about 1 year ago

usage

uvccapture -o#{cheese_path} -x1600 -y904

Added by Matt Platte about 1 year ago

The program 'v4l-info' is currently not installed. You can install it by typing:
sudo apt-get install v4l-conf

Added by Matt Platte about 1 year ago

...v4l-info produces the following

### v4l2 device info [/dev/video0] ###
general info
    VIDIOC_QUERYCAP
        driver                  : "uvcvideo" 
        card                    : "UVC Camera (046d:0809)" 
        bus_info                : "usb-0000:00:1d.7-3" 
        version                 : 0.1.0
        capabilities            : 0x4000001 [VIDEO_CAPTURE,STREAMING]
...
        maxwidth                : 1600
        maxheight               : 1200
        minwidth                : 48
        minheight               : 32
...

The values I have from using this same Logitech webcam on BlackPearl indicate a command line like this
uvccapture -o#{cheese_path} -x1600 -y904

...which doesn't work here on Carlton. Hmmm. Still digging...

Added by Matt Platte about 1 year ago


### v4l2 device info [/dev/video0] ###
general info
    VIDIOC_QUERYCAP
    driver                  : "uvcvideo" 
    card                    : "UVC Camera (046d:0809)" 
    bus_info                : "usb-0000:00:1d.7-3" 
    version                 : 0.1.0
    capabilities            : 0x4000001 [VIDEO_CAPTURE,STREAMING]

standards

inputs
    VIDIOC_ENUMINPUT(0)
    index                   : 0
    name                    : "Camera 1" 
    type                    : CAMERA
    audioset                : 0
    tuner                   : 0
    std                     : 0x0 []
    status                  : 0x0 []

video capture
    VIDIOC_ENUM_FMT(0,VIDEO_CAPTURE)
    index                   : 0
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "YUV 4:2:2 (YUYV)" 
    pixelformat             : 0x56595559 [YUYV]
    VIDIOC_ENUM_FMT(1,VIDEO_CAPTURE)
    index                   : 1
    type                    : VIDEO_CAPTURE
    flags                   : 1
    description             : "MJPEG" 
    pixelformat             : 0x47504a4d [MJPG]
    VIDIOC_G_FMT(VIDEO_CAPTURE)
    type                    : VIDEO_CAPTURE
    fmt.pix.width           : 800
    fmt.pix.height          : 600
    fmt.pix.pixelformat     : 0x47504a4d [MJPG]
    fmt.pix.field           : NONE
    fmt.pix.bytesperline    : 0
    fmt.pix.sizeimage       : 341333
    fmt.pix.colorspace      : SRGB
    fmt.pix.priv            : 0

controls
    VIDIOC_QUERYCTRL(BASE+0)
    id                      : 9963776
    type                    : INTEGER
    name                    : "Brightness" 
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 128
    flags                   : 0
    VIDIOC_QUERYCTRL(BASE+1)
    id                      : 9963777
    type                    : INTEGER
    name                    : "Contrast" 
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 32
    flags                   : 0
    VIDIOC_QUERYCTRL(BASE+2)
    id                      : 9963778
    type                    : INTEGER
    name                    : "Saturation" 
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 28
    flags                   : 0

### video4linux device info [/dev/video0] ###
general info
    VIDIOCGCAP
    name                    : "UVC Camera (046d:0809)" 
    type                    : 0x1 [CAPTURE]
    channels                : 1
    audios                  : 0
    maxwidth                : 1600
    maxheight               : 1200
    minwidth                : 48
    minheight               : 32

channels
    VIDIOCGCHAN(0)
    channel                 : 0
    name                    : "Camera 1" 
    tuners                  : 0
    flags                   : 0x0 []
    type                    : CAMERA
    norm                    : 0

tuner

audio

picture
    VIDIOCGPICT
    brightness              : 32896
    hue                     : 0
    colour                  : 7196
    contrast                : 8224
    whiteness               : 0
    depth                   : 0
    palette                 : unknown

buffer

window
    VIDIOCGWIN
    x                       : 0
    y                       : 0
    width                   : 800
    height                  : 600
    chromakey               : 0
    flags                   : 0

Added by Matt Platte about 1 year ago

matt@carlton:~$ uvccapture -h
uvccapture version 0.4
Usage is: uvccapture [options]
Options:
-v        Verbose
-o<filename>    Output filename(default: snap.jpg)
-d<device>    V4L2 Device(default: /dev/video0)
-x<width>    Image Width(must be supported by device)(>960 activates YUYV capture)
-y<height>    Image Height(must be supported by device)(>720 activates YUYV capture)
-c<command>    Command to run after each image capture(executed as <command> <output_filename>)
-t<integer>    Take continuous shots with <integer> seconds between them (0 for single shot)
-q<percentage>    JPEG Quality Compression Level (activates YUYV capture)
-r        Use read instead of mmap for image capture
-w        Wait for capture command to finish before starting next capture
-m        Toggles capture mode to YUYV capture
Camera Settings:
-B<integer>    Brightness
-C<integer>    Contrast
-S<integer>    Saturation
-G<integer>    Gain

Added by Matt Platte about 1 year ago

In the semi-poor light in the R3 house at night, this value produces a passable photo

uvccapture -ojah.jpg -x800 -y600 -B184 -C64 -S64

The default values are

    name                    : "Brightness" 
    maximum                 : 255
    default_value           : 128

    name                    : "Contrast" 
    maximum                 : 255
    default_value           : 32

    name                    : "Saturation" 
    maximum                 : 255
    default_value           : 28

Added by Matt Platte about 1 year ago

More resolutions in a list format. Requires installation of luvcview on the Linux...

Please find attached the output of the: "luvcview -L"

SDL information:
Video driver: fbcon
Hardware surfaces are available (900k video memory)
Device information:
Device path: /dev/video0
/dev/video0 does not support read i/o { pixelformat = 'MJPG', description = 'MJPEG' } { discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { discrete: width = 800, height = 600 }
Time interval between frame: 1/15, 1/10, 1/5, { pixelformat = 'YUYV', description = 'YUV 4:2:2 (YUYV)' } { discrete: width = 160, height = 120 }
Time interval between frame: 1/15, 1/10, 1/5, { discrete: width = 176, height = 144 }
Time interval between frame: 1/15, 1/10, 1/5,

Added by Matt Platte 10 months ago

http://www.ideasonboard.org/uvc/

Welcome to the USB Video Class Linux device driver home.

The goal of this project is to provide all necessary software components to fully support UVC compliant devices in Linux. This include a V4L2 kernel device driver and patches for user-space tools.
UVC 1.0 descriptors     Yes     
UVC 1.1 descriptors     Yes     
Camera input terminal     Yes     
USB Streaming terminal     Yes     
Processing unit     Yes     
Selector unit     Yes     
Extension unit     Yes     

Extension units can be accessed directly or mapped to V4L2 controls. They require a user-space management tool.
Still image capture     No     
Video streaming     Yes

Added by Matt Platte 10 months ago

http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gst

Using Gstreamer with Ruby. A partially-incomplete tutorial