[mac, uvc-ctrl] uvcc: uvc-controller app, alpha version out

new version out.


uvcc icon stolen from the internetcodename “ugly-code” is out!
with it you can kill auto-focus/-exposure/-white balance and set the absolute value of these manually on a uvc camera. the gui is really just thrown together and may not recognize your cam if it returns any error in the get-all request of uvcc.app/Contents/Resources/uvc-ctrl. it does however work nicely with the logitech c910 (on both x86_64 and i386 snowy leopards). a screenshot is available in the earlier post about it.
oh, and i stole the icon from somewhere on the internet.. can’t even remember where!

note: requires python 2.6, shipped with os x 10.6 – snowy leopard. so if you are running os x 10.5 you can update your python installation, or just wait.. ill get a new, python >= 2.5 version up in a while.

note 2: found a bug, the auto exposure slide should go from 1 to 8. selecting 0 will cause an error that goes unnoticed by (well, not that unnoticed.. you’ll notice the setting wasn’t saved)!

note 3: got some reports it isn’t working.. it seems alotta progs that use a webcam resets all settings (and thus turns on auto-whatever) when opened. This may very well be an apple driver “feat” but most people i’ve spoken with says it works well if they turn off the auto-whatever after starting said program.
btw, beer is good.

 uvcc.zip (116.5 KiB, 1,526 downloads)

// sluggo

  1. paulo barcelos Says:

    Hey Sluggo, I’ve seen your post on http://www.phoboslab.org/log/2009/07/uvc-camera-control-for-mac-os-x, and I was wondering if you could point me out if there is a way to find out dynamically the interface id of the video-control of a uvc camera…

    In your comment you’ve mentioned that, for example, the control ID for the C910 is not the usual 0 (it’s 2 actually)… how exactly did you find out the correct interface id? Was it empirically?

    I am writing an openFrameworks wrapper for the UVCCameraControl, and it would be great if I didn’t need to manually input the video-control interface id for each different camera…

    Well, anyway thanks in advance for point out the whole control interface id thing! It was really helpful!

    ----------

  2. sluggo Says:

    Hello Paulo!
    It’s actually just a matter of finding the interface with base-class 0x0e, CC_VIDEO and subclass 0×01, SC_VIDEOCONTROL (for all subclass codes you can check out appendix A of the standard, http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1_090711.zip).
    Sent you an email with some more info..

    // sluggo

    ----------

  3. Neuro Says:

    Hey Sluggo, this looks to be exactly what I have been scouring the net for, for days! I am trying to use uvcc with a Creative Labs Live Cam Socialize HD 1080p WebCam on a Macbook Pro with osx Lion. I am totally new to OSX and probably should not even be messing with things such as this, but the Auto Focus on this Cam is killing me and with no way to turn it off, the Cam is almost worthless.

    When I fire up uvcc it seems to find two Cams, I am assuming 1 is the normal iSight and the other is the Creative Labs Cam. However when I try to select either one, it gives me an error “Cam 1 could not be read!”

    I am sure it is something I am doing incorrectly or not doing at all .. If you can please help me out, Thanks for your time!

    – Neuro

    ----------

  4. sluggo Says:

    Hello Neuro!

    This might very well be a bug in the program, this version was truly an alpha. I am very sorry i haven’t had the time to release a new version yet (work and school has been hogging pretty much all of my time the past weeks).
    What you can try is to place the uvcc app in your home folder, open up a terminal (Applications >> Utilities >> Terminal) and write
    ./uvcc.app/Contents/Resources/uvc-ctrl -l
    and then press enter. this should list your connected cameras. the one whichs second column starts with 05ac is the iSight, ignore that one and get the index (the number in the first column, far left) of your Creative Labs cam. To turn off the auto-focus you enter
    ./uvcc.app/Contents/Resources/uvc-ctrl -s5 -v0 N
    (where N is the index of the cam) into the terminal and press enter.
    to make sure it was updated you enter
    ./uvcc.app/Contents/Resources/uvc-ctrl -d -g0 N
    (where N again is the index of the cam) and press enter.
    hope this helps, i will release a new version as soon as i get the time though!

    // sluggo

    ----------

  5. Alessandro Previti Says:

    **repost – i posted in the wrong page before. Sorry.

    Hi!
    My name is Alessandro, I’m a student of art and I’m developing a small a.r. app for my master thesis in 1 month.
    C910 lack of controls was driving me crazy and your program gave me hope back!
    THANK YOU!
    Till now it looks that just auto-focus off is working on c910.
    Do you plan to add a contrast control?
    Where to make a donation?

    ----------

  6. sluggo Says:

    Hello Alessandro!
    i’m glad you found the soft useful and sorry i haven’t had the time to release the new version.. the new back-end is pretty much working but i’m still having some troubles getting the updated gui to work as i want it to.
    the settings that are available (and working, at least on the c910 which is the only one i have at my disposal) in the new version are (“name”, “value to set”)
    auto-focus, off/on
    absolute focus, distance to target in mm
    relative focus, lens group movement, -1: near, 0: stop, 1: far
    auto-exposure, Manual/Auto/Manual exposure/Manual iris
    absolute exposure, shutter speed, value * 100 microseconds
    relative exposure, shutter speed, -1: decrease, 0: default, 1: increase
    absolute iris, aperture setting, f-stop * 100 * value
    relative iris, aperture f-number, -1: decrese, 0: default, 1: increase
    auto-white balance temp, off/on
    white balance temp, white balance temperature

    if you want to donate i would be really happy if you’d donate to either one of these organizations:
    doctors without borders
    greenpeace
    they do exceptional work and sure need it more than i do =)

    // sluggo

    ----------

  7. Arvid Says:

    Hi – awesome – I was just looking for something like this to use webcams in an animation class for kids. Webcams are great because you can do onion-skinning on a computer, but the white balance jumps around every other frame with consumer webcams.

    I get the same error on the GUI “Cam X could not be read!”, so i’ve been using the command line version from in the package. It lists my cameras correctly, but it can’t get or set any white balance values of either my facetime HD camera (in macbook pro) or my HP Deluxe Webcam KQ246AA. I can turn off auto exposure and set a manual exposure (which is a start, certianly), but does this mean that camera’s White bal is just not controllable?

    For example on with the HP:
    ./uvc-ctrl -g 4 4
    request failed: pipe error
    error

    and with the apple camera
    ./uvc-ctrl -g 4 2
    request failed: error -99
    error

    my device listing is
    2 05ac:8509 250:03 0 - not avaliable -
    - not avaliable -
    - not avaliable -

    4 04f2:a13c 250:06 0 HP Deluxe Webcam KQ246AA
    HP Deluxe Webcam KQ246AA
    ?

    I’m on 10.6.8. also tested on another mac running 10.7 – same. Thanks!

    ----------

  8. sluggo Says:

    Hello – thank you!
    im sorry i can’t say for sure yet because i’ve gotten the -99 error on both malformatted and unsupported commands. also, white-balance-commands are sent to another endpoint than the rest, so it is one of the main things i’ve yet to test in the new version. if you were to find out whether or not your camera supports manually controlled white balance i would love to here about it (since if it does, it is indeed another bug in the first version).

    btw, do the (command line version) work in 10.7 as is does 10.6.8? i actually haven’t tried lion out yet!

    // sluggo

    ----------

  9. Arvid Says:

    Hi,
    - yes seems to work on 10.7 as well as it does on 10.6
    - On A Logitech C310 I am able to lock white balance (turn auto off), but not able to set it to anything but neutral (which it defaults to on setting it to manual). It does not give me an error when i try, just does nothing. The value returned from the set is always 1. If i try to set the white balance, then get its value, it is always either 0 or 1, despite the fact that WB span is returned as 1-16 for that cam.

    - In addition, i wanted to note that turning off auto exposure (on all my cameras that it works for – which are Logitech C310 and HP KQ246AA-HP) requires writing 1 rather than 0 and turning it back on requires writing 8 rather than 1.

    - On a Creative Socialize HD webcam i can’t manage get any manual control with the current version. That camera is weird anyway because the auto WB starts totally wrong and does not correct itself until you drastically change the image by moving it around or putting your hand over the lens and then removing it :)

    - I’d be happy to do some testing on the new version if you could compile what you have for the new command line program and send it to me – I’m teaching a kids animation class on March 8th and it would be great to see if I’m able to get some more manual control on the webcams before then. Also, I have to make a decision which webcams to buy a few more copies of in the upcoming days…

    Thanks a bunch, Arvid

    ----------

  10. Arvid Says:

    Oh – and wanted to mention that if you DO want me to do testing, before March 8th is best because after that, most of these different UVC webcams i’m testing will either be in the possession of the art school or returned to their respective sellers if they prove to be useless.

    ----------

  11. sluggo Says:

    Thank you so much for your info Arvid!
    i sent you an email regarding the testing..

    // sluggo

    ----------

  12. mathijs Says:

    thanks man! you solved one of my long lasting problems!

    ----------

  13. Matthew Says:

    I have a retired microsoft lifecam that has had auto exposure/gain problems since upgrading to OSX Lion. I would be happy to donate it and some financial funds to help further the development of this application! I’m currently trying to run a lifecam hd 5000 and it is experiencing the same exposure issues – I tried the app, it sees the cameras, but will not load them.

    Again, if there is anything I can do to help with the testing, including mailing you one of my cameras, I’d be happy to do it!

    ~Matthew

    ----------

  14. Eric Cheng Says:

    Arvid – you are a genius! Works perfectly on Logitech C910 on Mac OS X 10.7.3

    ----------

  15. Eric Cheng Says:

    Oops. You are not Arvid. The message should be directed at sluggo.

    ----------

  16. sluggo Says:

    Thank you, glad you liked it!

    ----------

  17. sluggo Says:

    Hello Matthew!
    a new version is very much in the making, hopefully it’ll be out in not too long and it would be a great help in the development if you’d like to try it and report back what works/don’t work. the only thing holding it back is my lack of time, so if you would like to donate i’d be really happy if you were to consider either of these organizations, doctors without borders and/or greenpeace.. it may not aid the development in a direct way but they do exceptional work and sure need it more than i do =)

    ----------

  18. urbeller Says:

    hi,

    Your soft works like a charm ! I tried the the UVCControl posted on ‘http://www.phoboslab.org/log/2009/07/uvc-camera-control-for-mac-os-x’. I receive the images from the camera but somehow, the sliders don’t have any effect on the controls. Is it possible to access your source code ? If no, any idea how to make the aforemtionned class work ?

    ThX,

    ----------

  19. sluggo Says:

    hi urbeller!
    just published a new version of it, including the source.
    To fix phoboslabs class you just have to make it look for the right interface-id (thats the one with base class 0x0e and subclass 0×01) and add that to the low byte of the wIndex field in the request.
    you can check out my source (line 210-233 of uvc-controller.c especially) on how to find the the right interface-id.

    ----------

  20. urbeller Says:

    hello ! thank you very much for the QUICK answer ! I am going to try it right the way !

    ----------

  21. urbeller Says:

    Works !!! works very well. Somehow, the exposure setting is broken, it gives:
    request failed: pipe error
    request failed

    …aside from this, the whole thing is a joy !

    ----------

  22. sluggo Says:

    Great to hear!
    do you know if the official driver is able to set the exposure time on your cam?

    ----------

  23. urbeller Says:

    actually your previous binary python gui was (and still) able to set the exposure !

    ----------

  24. sluggo Says:

    oh.. i don’t even remember changing that request! well i’ll have another look on it tomorrow, it’s getting a bit late here..

    ----------

  25. urbeller Says:

    hehe ! you deserve good night of sleep ! ThX for everything !

    ----------

  26. Niki Says:

    Sluggo,
    Thanks for your brillant expertise.

    I need to test your UVCC controller app with the Microsoft Lifecam Cinema (from my project) with a Mac.
    Problem is, I do not have a Mac at the moment. I intend to buy one when/if I am able to control the exposure and the white balance.
    Can you help me? I am willing to pay a flat fee to get the help I need.
    Hope to hear from you.
    Thanks,

    ----------

  27. sluggo Says:

    Hello Niki!
    From what i’ve read the lifecam cinema seems to be uvc-compliant (http://www.ideasonboard.org/uvc/), which means you can control it with uvc-ctrl (remember to use the most up to date version though).
    To be sure i’d recommend you get a hold of a mac to try it out on. If you have a hard time finding one onto which you can install libusb i’ll be releasing a new, all osx native version during august, with it you’ll be able to just walk into an apple store, download it and try it out with your cam (if they start whining explain that your purchase is based on whether it works or not, that should cool them of).

    // sluggo

    ----------

Comment