-
released this
2026-09-15 09:22:31 +00:00 | 1 commits to main since this releaseFirst release.
Captures frames from a V4L2 camera and publishes them as
std/media/v1/Image: an Arrow
struct ofwidth: UInt32,height: UInt32,encoding: Utf8anddata: LargeBinary.
The payload describes itself, so nothing about the frame's shape has to be agreed
through message metadata. For a compressed encoding the recorded dimensions are the
image's, not the length ofdata, so a receiver can size a buffer without decoding
first.Wiring it
nodes: - id: camera git: ssh://git@gitea.liria.cl:5001/liria/dora-webcam.git tag: v0.1.0 build: uv pip install . path: dora-webcam env: CAMERA_ID: usb-Acme_Webcam ENCODING: jpeg inputs: tick: dora/timer/millis/33 outputs: - imageRun with
--uv: the build command isuv pip install ., so the node gets its own
managed environment and never installs into an ambient one.What it does
- Encodings:
bgr8,rgb8,yuv420,jpeg/jpg/jpe,png,bmp,webp. - Camera discovery: with neither
CAMERA_IDnorCAPTURE_PATHset, the first
/dev/video*that actually delivers a frame is used. Opening is not evidence — a UVC
camera also exposes a metadata node that opens happily and never captures, so the
lowest device number is wrong about as often as it is right. - Stable selection:
CAMERA_IDmatches an entry in/dev/v4l/by-id/, which
survives a reboot and a change of USB port. Neither an index nor discovery order does. - Local preview:
PREVIEW=trueopens a window of the frames as they are published,
after the flip and the resize, so a camera, an encoding or a flip can be checked
without wiring a consumer. Pressqto stop. - Runs without hardware:
CI=truesubstitutes a labelled black frame for a failed
read instead of raising, which is what lets the dataflow run on a machine with no
camera. - Configuration in the dataflow: settings can be a node's
env:map rather than the
environment of whatever starts the run. A node'senv:wins over the shell; variables
it does not set still pass through.
Notes
Based on
opencv-video-capture
from dora-hub, with three deliberate differences: the typed image struct instead of a
flat buffer plus metadata, Linux-only camera selection (the upstream macOS and Windows
enumeration is not carried), andCAPTURE_FRAMESto bound a run in place of upstream's
ten-second CI cutoff.This repository names no consumer of its output. It is a source; documenting itself
through a specific downstream node would be a cycle, since that node depends on this one
for frames. Wireimageinto anything that takesstd/media/v1/Image.Requirements: dora 1.0+ (verified with
dora-cli 1.0.1), Python 3.11+,uv, and a
V4L2 camera.PREVIEWalso needs a display. On a bare Linux imageopencv-pythonneeds
libgl1andlibglib2.0-0, which it links at import time.Downloads
- Encodings: