(grabber-create v4l2-device)

(grabber-create v4l2-device width height)


  • v4l2-device: the device name, e.g. “/dev/video0”
  • width
  • height


(grabber-create v4l2-device width height ) creates a grabber object connected to a specific V4L2 camera as identified by the v4l2 device name. The width and height parameters are a proposal, the effective dimensions may differ but are automatically as close as possible and reasonable.

If the width and height parameters are omitted, a resolution of 1920x1080 (aka FullHD) is requested. Calling grabber-create with no arguments requests 1920x1080 from the V4L2-device /dev/video0.

This procedure is available on Linux with V4L2 support only and results in an error when executed on macOS, for example.

Supported camera formats are MJPG and YUYV, exactly one grabber object per camera may be created.

There’s no deconstructor for grabber objects, they are automatically closed when GC can prove that there’s no further reference. When it’s needed for some reason to recreate a grabber object with different parameters, all references need to be released first and a garbage collection needs to be executed by calling (gc).

Side Effects

The v4l2 device cannot be opened by another application at the same time.

Return Value

The grabber object is returned.


> (define grabber (grabber-create "/dev/video2" 640 480))
> grabber
#<grabber device:/dev/video2 width:640 height:480 format:MJPG fd:3>