Skip to content
Extremely Simple Capture API (ESCAPI) - simple webcam API for windows
Branch: master
Clone or download
Latest commit cfb0609 May 22, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
blitzmax initial Oct 27, 2015
common Some fixes after testing the raw option May 19, 2016
enum initial Oct 27, 2015
enumprops initial Oct 27, 2015
escapi_dll fixed memory leak in init/deinit capture cycle May 22, 2017
examples Refactor the Rust version and the build script May 11, 2017
multicap initial Oct 27, 2015
ogl initial Oct 27, 2015
propgui initial Oct 27, 2015
purebasic initial Oct 27, 2015
python Add python wrapper May 10, 2016
simplest initial Oct 27, 2015
src Lift the mutability restriction for capture func May 12, 2017
.gitignore add rust support Apr 21, 2016
Cargo.toml Bump the version for the Rust crate May 11, 2017 Update May 11, 2017
UNLICENSE initial Oct 27, 2015 Refactor the Rust version and the build script May 11, 2017
escapi.sln initial Oct 27, 2015


Extremely Simple Capture API

Copyright (c)2015 Jari Komppa


Binaries available at


Add escapi.cpp to your project. This file contains code to load the escapi.dll. See the samples ('simplest' recommended) for API usage.

Rust Bindings Usage

Just add the crate in your project and start using it. NOTE: make sure that Windows SDK and Media Foundation headers are accessible for your Rust toolchain, otherwise the library build will fail (i.e. it should work fine with MSVC toolchain and it might require some changes if you're using mingw toolchain).


ESCAPI is released under the unlicense. In short, use for any purpose as long as you don't hold me responsible for anything. It would be nice if you'd toss me a mail if you play with this thing.

Some examples use external libraries with different licenses.

What is ESCAPI?

A fairly easy to use webcam (or other video input device) capture API.

Version 2.0 adds support for multiple capture devices and requesting the capture device names, as well as new examples.

Version 2.1 updates the examples, including purebasic and blizmax examples, as well as an OpenGL based 'funny mirrors'-example, and fills out the top 8 "alpha" bits in the captured data with 0xff.

Version 3.0 is complete rewrite using windows media foundation instead of directshow. The version adds interface for playing with camera properties, new examples, automatic camera resolution selection, 64 bit builds, and source release. Version 3.0 onwards requires windows vista or later (7, 8, 8.1, 10..).


One of the last things that I added to 'textmedia' was webcam support. I got interested in webcams for a while, thinking I might whip up some kind of "eye toy"-ish game using a web cam.

One of the bad sides about webcams is that the programming API is so complicated - the only way to use them back then was through DirectShow. Simply getting data from the camera is a fairly complicated process, while not giving you much control.

So, to get rid of the directmedia SDK requirement, I split the required code into a separate DLL, and now I present to you the ESCAPI:

  • setupESCAPI - Initialize the whole library. (in escapi.cpp)
  • countCaptureDevices - Request number of capture devices available.
  • getCaptureDeviceName - Request the printable name of a capture device.
  • initCapture - Tries to open the video capture device. Returns 0 on failure, 1 on success.
  • doCapture - Requests a video frame to be captured.
  • isCaptureDone - Returns 1 when the requested frame has been captured.
  • deinitCapture - Closes the video capture device.

So basically, you call setup to initialize the library, call init to start the capture device, and call doCapture to start the capture process. When the capture is done, you can ask for another frame. Etc.

Unfortunately, "eye toy"-wise, the webcams on PCs are quite laggy, and this varies from a camera to the next. My logitech messenger camera has a lag or about one second, while my creative instant camera is has a more tolerable lag. Both cameras also perform some automatic contrast trickery and other stuff like that which won't be quite game-friendly.

Thus, I never ended up doing that "eye toy"-like game. Maybe one day =)


Some of the examples use external libraries:

You can’t perform that action at this time.