world leader in high performance signal processing
Trace: » usb_video_device_class

USB video device class

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, analog video converters, television tuners, and still-image cameras.

The latest revision of the USB video class specification carries the version number 1.1 and was defined by the USB Implementers Forum in a set of documents describing both the basic protocol and the different payload formats. (From Wikipedia, the free encyclopedia)

UVC Linux screenshot

For more details and a list of supported Cameras please visit the page here:

The driver and tools are part of the Blackfin uClinux-dist: trunk/user/blkfin-apps/uvc-video

Kernel and User Space Configuration

----------- Multimedia devices -----------
 <*> Video For Linux
 [ ]   Enable Video For Linux API 1 (DEPRECATED)
 [*]   Enable Video For Linux API 1 compatible Layer
 [*]   Video capture adapters  --->
 [ ]   Radio Adapters  --->
 < > DVB for Linux
 [ ] DAB adapters

Linux 2.6.28 or later: use the USB Video Class (UVC) driver from the V4L USB devices selection.

  <*> Multimedia support  --->
      [*]   Cameras/video grabbers support
      [*]   Media USB Adapters  --->
          <*>   USB Video Class (UVC)
          [*]     UVC input events device support

----------- USB support -----------

 --- USB support
 <*>   Support for Host-side USB
 <*>   Inventra Highspeed Dual Role Controller (TI, ADI, ...)
 <*>     Platform Glue Layer (Blackfin)  --->
         MUSB DMA mode (Inventra)  --->
 [*]   USB Physical Layer drivers  --->
       <*>   NOP USB Transceiver Driver
 <*>   USB Gadget Support  --->
       <*>   USB Gadget Drivers (Gadget Zero (DEVELOPMENT))  --->

Some USB cameras may also have a Microphone and Buttons built-in so you want to also enable USB Audio/MIDI driver and the USB HID driver.

----------- Blackfin app programs -----------
 [*] USB Video Class Driver and Test Application

Driver Testing

Platform: BF548-EZkit
USB Cam : Logitech QuickCam PRO 9000

root:/> modprobe uvcvideo
uvcvideo: Found UVC 1.00 device <unnamed> (046d:0990)
input: UVC Camera (046d:0990) as /class/input/input1
usbcore: registered new interface driver uvcvideo
USB Video Class driver (SVN r6838)

root:/> modprobe ad7877
ad7877 spi0.2: touchscreen, irq 258
input: AD7877 Touchscreen as /class/input/input2

root:/> modprobe evdev

root:/> export TSLIB_FBDEVICE=/dev/fb0
root:/> export TSLIB_CONSOLEDEVICE=none
root:/> export TSLIB_CONFFILE=/etc/ts.conf
root:/> export TSLIB_CALIBFILE=/etc/pointercal
root:/> export TSLIB_TSDEVICE=/dev/input/event2
root:/> export SDL_MOUSEDRV=TSLIB

root:/> ts_calibrate
xres = 480, yres = 272
Took 5 samples...
Top left : X = 3576 Y = 3192
Took 7 samples...
Top right : X =  542 Y = 3174
Took 4 samples...
Bot right : X =  539 Y =  859
Took 5 samples...
Bot left : X = 3581 Y =  887
Took 4 samples...
Center : X = 2079 Y = 2014
498.204468 -0.125078 -0.000059
285.628967 0.000562 -0.074456
Calibration constants: 32650328 -8197 -3 18718980 36 -4879 65536
root:/>

Using luvcview

root:/> luvcview -f yuv -s 320×240 -i 30

luvcview 0.2.4

SDL information:
  Video driver: fbcon
  Hardware surfaces are available (382k video memory)
Device information:
  Device path:  /dev/video0
Stream settings:
  Frame format: YUYV
  Frame size:   320x240
  Frame rate:   30 fps

Using MPlayer

root:/> mplayer -quiet -nosound -tv driver=v4l2:width=320:height=240:device=/dev/video0:fps=15:outfmt=yuy2 tv:
MPlayer dev-SVN-r6838-4.1.2 (C) 2000-2007 MPlayer Team
Creating config file: .mplayer/config
117 audio & 238 video codecs

Playing tv:.
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski olschewski@zpr.uni-koeln.de
 comment: first try, more to come ;-)
v4l2: ioctl get standard failed: Invalid argument
Selected device: UVC Camera (046d:0990)
 Capabilites:  video capture  streaming
 supported norms:
 inputs: 0 = Camera 1;
 Current input: 0
 Current format: MJPEG
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
v4l2: ioctl enum norm failed: Invalid argument
Error: Cannot set norm!
Selected input hasn't got a tuner!
v4l2: ioctl set mute failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
VDec: vo config request - 320 x 240 (preferred colorspace: Packed YUY2)
Could not find matching colorspace - retrying with -vf scale…
Opening video filter: [scale]
VDec: using Packed YUY2 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
SwScaler: reducing / aligning filtersize 1 → 1
SwScaler: reducing / aligning filtersize 1 → 1
SwScaler: reducing / aligning filtersize 1 → 1
SwScaler: reducing / aligning filtersize 1 → 1
[swscaler @ 0x441bd4]SwScaler: BICUBIC scaler, from yuyv422 to bgr24 using C
[swscaler @ 0x441bd4]SwScaler: using C scaler for horizontal scaling
[swscaler @ 0x441bd4]SwScaler: using n-tap C scaler for vertical scaling (BGR)
[swscaler @ 0x441bd4]SwScaler: using C YV12→BGR24 Converter
[swscaler @ 0x441bd4]SwScaler: 320×240 → 320×240
VO: [fbdev] 320×240 ⇒ 320×240 BGR 24-bit
</xterm>

===== Using ffmpeg =====

More ffmpeg info here:  ffmpeg

=== Network Stream example ===

root:/> modprobe uvcvideo
uvcvideo: Found UVC 1.00 device <unnamed> (046d:0990)
uvcvideo: Failed to query (135) UVC control 1 (unit 0) : 0 (exp. 26).
input: UVC Camera (046d:0990) as /class/input/input1
usbcore: registered new interface driver uvcvideo
USB Video Class driver (SVN r6987)


root:/> ffmpeg -y -f video4linux2 -vcodec mjpeg -r 15 -s 352×288 -qscale 5 -i /dev/video0 -f mjpeg udp:10.44.2.88:1234
FFmpeg version SVN-r6987, Copyright (c) 2000-2007 Fabrice Bellard, et al.
  configuration: --prefix=/usr --source-path=....../uclinux-dist-trunk/lib/ffmpeg/build/../ffmpeg-svn-11114 --target-os=Linux --cpu=bfin --arch=bfin --ext-
  libavutil version: 49.5.0
  libavcodec version: 51.48.0
  libavformat version: 52.1.0
  built on Aug 13 2008 16:27:54, gcc: 4.1.2 (ADI svn)
[video4linux2 @ 0x35e0d0c][3]Capabilities: 4000001
Input #0, video4linux2, from '/dev/video0':
  Duration: N/A, start: 9487.384000, bitrate: 48660 kb/s
    Stream #0.0: Video: rawvideo, yuyv422, 352x288 [PAR 0:1 DAR 0:1], 48660 kb/s, 30.00 tb(r)
Output #0, mjpeg, to 'udp:10.44.2.88:1234':
    Stream #0.0: Video: mjpeg, yuvj420p, 352x288 [PAR 0:1 DAR 0:1], q=2-31, 200 kb/s, 30.00 tb(c)
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 3097 fps= 27 q=5.0 size=   32410kB time=103.2 bitrate=2571.9kbits/s