lucky shot.jpg

Exploring the built-in webcam on the Asus EEE 900HA netbook.

Device and driver information

This 0.3M pixel camera works 'out-of-box' with the latest install of Slackware Linux. To gather further information about the device and driver... enter the command:

cat /var/log/messages | grep usb

[...snip...]
Sep  5 07:36:28 kikuchiyo kernel: usb 1-2: new high speed USB device using ehci_hcd and address 2
Sep  5 07:36:28 kikuchiyo kernel: usb 1-2: New USB device found, idVendor=093a, idProduct=2700
Sep  5 07:36:28 kikuchiyo kernel: usb 1-2: New USB device strings: Mfr=16, Product=96, SerialNumber=0
Sep  5 07:36:28 kikuchiyo kernel: usb 1-2: Product: Digital_Camera
Sep  5 07:36:28 kikuchiyo kernel: usb 1-2: Manufacturer: PixArt Imaging Inc.
Sep  5 07:36:28 kikuchiyo kernel: usb 1-2: configuration #1 chosen from 1 choice
Sep  5 07:36:28 kikuchiyo kernel: input: Digital_Camera as /devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0/input/input8
Sep  5 07:36:28 kikuchiyo kernel: usbcore: registered new interface driver uvcvideo
Sep  5 07:36:28 kikuchiyo kernel: USB Video Class driver (v0.1.0)
[...snip...]

Output reveals the camera [vendor]:[product] code is 093a:2700, device is manufactured by Pixart Imaging, and it uses the uvcvideo kernel driver. Exploring/troubleshooting using the vendor:product code can dig up further details on this commodity device used under different branding and form.

This command reveals (much) further detail:

lsusb -v -d 093a:2700 | less

Bus 001 Device 002: ID 093a:2700 Pixart Imaging, Inc. 
Device Descriptor:
bLength                18
bDescriptorType         1
bcdUSB               2.00
bDeviceClass          239 Miscellaneous Device
bDeviceSubClass         2 ?
bDeviceProtocol         1 Interface Association
bMaxPacketSize0        64
idVendor           0x093a Pixart Imaging, Inc.
idProduct          0x2700 
bcdDevice            6.19
iManufacturer          16 PixArt Imaging Inc.
iProduct               96 Digital_Camera
iSerial                 0 
bNumConfigurations      1
[...snip...]

The built-in camera is the only video device attached to the netbook:

ls /dev/video* 
crw-rw---- 1 root video 81, 0 2009-09-06 13:06 /dev/video0

Luvcview is a small video capture application useful for querying and testing webcams. I downloaded the source and created a Slackware package using src2pkg.

After installing... check out the options available:

luvcview -h
luvcview version 0.2.1
usage: uvcview [-h -d -g -f -s -i -c -o -C -S -L -l -r]
-h      print this message
-d      /dev/videoX       use videoX device
-g      use read method for grab instead mmap
-w      disable SDL hardware accel.
-f      video format  default jpg  others options are yuv jpg
-i      fps           use specified frame interval
-s      widthxheight      use specified input size
-c      enable raw frame capturing for the first frame
-C      enable raw frame stream capturing from the start
-S      enable raw stream capturing from the start
-o      avifile  create avifile, default video.avi
-L      query valid video formats
-l      query valid controls and settings
-r      read and set control settings from luvcview.cfg

Valid video formats for this camera:

luvcview -L
luvcview version 0.2.1 
Video driver: x11
A window manager is available
video /dev/video0 
/dev/video0 does not support read i/o
{ pixelformat = 'YUYV', description = 'YUV 4:2:2 (YUYV)' }
{ discrete: width = 640, height = 480 }
        Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5, 1/1, 
{ discrete: width = 320, height = 240 }
        Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1589/15625, 1/1, 
{ discrete: width = 160, height = 120 }
        Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1589/15625, 1/1, 
{ discrete: width = 176, height = 144 }
        Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1589/15625, 1/1, 
{ discrete: width = 352, height = 288 }
        Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1589/15625, 1/1,

Streaming and recording video

To stream video with luvcview (plenty of options to experiment with):

luvcview -f yuv -s 320x240 -d /dev/video0

Open up the camera's video stream in MPlayer:

mplayer -tv driver=v4l2:device=/dev/video0 tv://

Open in VLC:

vlc v4l2:///dev/video0

To make a recording I use ffmpeg... a 'swiss army knife' of video hackery on Linux:

ffmpeg -f oss -i /dev/dsp -f video4linux2 -s 640x480 -i /dev/video0 output.mpg

*Note: the netbook's internal microphone is '/dev/dsp'

Save and open output.mpg in MPlayer or VLC. The quality of the video is rather low. When ffmpeg is running it displays the quality of the capture as q=[value] with value being a scale between 1 (best) to 31 (worst).

Some options that can quickly be modified to improve video capture are:

The -qscale option is useful. It allows setting a constant quality value with a variable bitrate. Running the previous command with a few modifications produces a decent output:

ffmpeg -f oss -i /dev/dsp -f video4linux2 -qscale 1 -r 24 -s 320x240 -i /dev/video0 output2.mpg

Now that the camera is up and working it is ready and well-suited for tasks such as video chatting and VOIP using Pidgin, Ekiga, Skype, etc.

>>> Comments welcome @dwa on identi.ca ...