2 minute read

About a month ago, I blogged about an update to a webcam hack that I did called FocusUF. There wasn’t much to the code and I put it all up on GitHub. Someone came along and submitted a pull request that added some cool functionality.  

My version was hardcoded to a single webcam. Because that’s all I need it for. At the time, I was using a Microsoft LifeCam HD-5000. Someone else created an issue on my GitHub repo asking if I could add support for the HD-6000, which apparently suffers from the same annoyances with focus.

I was going to add a command-line parameter to FocusUF to allow you to specify all or part of the webcam name, but someone else beat me to it. Cain Hopwood updated my code to add that and a bunch of other useful command-line switches. And somehow, I had missed his PR when it was submitted a month ago.

So I tossed my changes out the window and accept the pull request. It was pretty good. After merging the changes, I added a couple of things. Cain added code to list all of the webcams. That would fail if you have any webcams that didn’t support the IAMCameraControl interface from the DirectShowLib. If you have software that runs as a virtual webcam, it probably doesn’t support IAMCameraControl.  Now when you run it without any parameters, you get the following usage help:

FocusUF 1.2.0.0
Get the source at https://github.com/anotherlab/FocusUF

Usage: FocusUF [--help | -?] [--list-cameras | -l]
[--focus-mode-manual | -fm] [--focus-mode-auto | -fa]
[--set-focus | -f ]
[--exposure-mode-manual | -em] [--exposure-mode-auto | -ea]
[--set-exposure | -e ]
[--camera-name | -n ]

 

Now when you ask it to list the cameras, you get the following output:

.\FocusUF.exe -l
FocusUF 1.2.0.0
Get the source at https://github.com/anotherlab/FocusUF
Camera: c922 Pro Stream Webcam
    Focus Capability: Auto, Manual
    Focus Range: 0 - 250
    Focus Setting: Auto, 0
    Exposure Capability: Auto, Manual
    Exposure Range: -11 - -2
    Exposure Setting: Auto, -5
Camera: XSplit VCam
    Camera does not expose settings through DirectShowLib

I also made the search by name case insensitive. That was low hanging fruit. I also updated the compiled version of the code at focusuf.zip. While I don’t support this as a product, it’s useful for people who don’t have the compiler installed. And I updated the readme file to document the new changes.

And to go off on a tangent, I’ve been using a tool (Windows only) named Markdown Monster to edit the readme files. Markdown Monster is written and supported by Rick Strahl. You can try it for free and then buy a cheap license for it. Working in Markdown is fairly easy, but it has its own syntax to learn. Markdown Monster gives you a nice editor with full preview and it makes updating the readme file one less thing to think about.

And that’s one of the great things about open-source software. Other people can jump in and contribute. I wrote a little tool to fix something that was bugging me. It sparked joy with someone and he added some additional joy to fix something that he needed.

Comments