commandcam

Capture webcam from the command line with CommandCam

  • 2 min

CommandCam is an open-source tool for Windows that allows you to easily capture still images from a webcam from the terminal, developed by Ted Burke.

CommandCam is a very simple tool but it can sometimes be a great help in a project. We simply have to run a command, and we have our webcam capture.

For example, imagine you connect via SSH to a computer remotely, or you want to schedule the capture of an image, or even react to a motion sensor to take a photo, as if it were an “alarm”.

In these and many other cases, integrating CommandCam is very easy. We only have to launch a command prompt. And there are a thousand ways and options to launch a command.

CommandCam uses the Microsoft DirectShow API to access the images. Therefore, it should be compatible with most USB cameras.

How to use CommandCam?

As I said, one of the main features of CommandCam is its simplicity. We only have to execute this command,

CommandCam /filename output.bmp

Where output.bmp is the name of the file with which we want to save the capture.

It is also possible to specify a delay between receiving the command and performing the capture, with the parameter /delay [milliseconds]. For example like this,

CommandCam /filename output.bmp /delay 10000

On the other hand, in case of having multiple devices connected, it is possible to choose which one we want to use by using the parameter /devnum [device_number] like this

CommandCam /filename output.bmp /devnum 2

Or with the device name using /devname [device_name]

CommandCam /devname “USB Video Device”

We can also get a list of compatible devices with /devlist

CommandCam /devlist

Or the list with more details with the parameter /devlistdetail

CommandCam /devlist

Finally, we can make CommandCam not show any text in the console with the /quiet parameter

CommandCam /filename output.bmp /quiet

CommandCam is written in C++, and the entire application is barely 550 lines. It is Open Source and all the code and information are available on GitHub - tedburke/CommandCam and on the author’s blog.