Modified uvccapture

I’m using Microsoft LifeCam Cinema webcams, which support both YUYV and MJPEG capture modes. However, in YUYV mode, auto exposure correction doesn’t work correctly (or maybe at all). After resetting (or plugging out and in) a webcam, the exposure will be at max, and it won’t auto change if I use the YUYV mode. In MJPEG mode, it needs a few secs to compensate a light change.

So my changes in uvccapture-0.5:

  • I added a -D option to uvccapture for this. After opening the /dev/videoX device, it waits for the given predelay secs and then it captures the frame. This way when the camera is in MJPEG mode, it can auto change the exposure while uvccapture is predelaying.
  • Corrected JPEG header output, when saving MJPEG frames. The default routines in uvccapture saved an unreadable JPEG file, now it’s fixed.
  • It parses output filenames with strftime, so this will save the full date in the filename: -o%Y%m%d%H%M%S.jpg
  • Only saves JPEG when -o is set
  • No auto YUYV capture, by default it uses MJPEG, if you want it, use the -m switch
  • Resetting brightness/contrast/saturation/gain controls only when one of the regarding cmdline option is used

Merged the following modifications by Reece Arnott and John:

  • changed the include statements in uvccapture.c and v4l2uvc.c from linux/videodev.h to linux/videodev2.h
  • added the -i cmdline switch to have the ability to have an initializing script run before an image is captured (this means that -D option could be done with -w -i<script>
  • predelay sleep optionally keeps taking 1 image/sec (-W cmdline switch)
  • daemon feature with -b cmdline switch
  • additional post delay option

Current version: uvccapture-0.5-nonoo-r4

download (mirror2) (16 kb, 304 dls, today: 0)

Debian packages built by John:

download (mirror2) (50.4 kb, 222 dls, today: 0)

I’m using uvccapture this way (to allow my Microsoft LifeCam Cinemas to auto adjust exposure):

uvccapture -v -d/dev/video -x1280 -y720 -D4
uvccapture -v -d/dev/video -x1280 -y720 -D3 -o%Y%m%d%H%M%S.jpg

(Yes, two sequential calls to uvccapture, one with 7 secs predelay is no go, I need two calls. The first call won’t save anything, just opens the device and waits given secs).