VideoCapture¶
source extra: video-capture
Read video from a file or from a V4L2 webcam, and transmit one RGB frame per message.
- Node type:
VideoCapture- Input:
–
- Output:
ImagePayload- Extra:
video-capture
$ pip install "juturna-nodes[video-capture]"
The node README describes how files and webcams are read, the output message, and the limits of the node.
When a webcam is unplugged, busy or stops delivering frames, the read fails:
the node closes the device, logs the error, counts it in
health['source_failures'] (with the error in health['last_failure']),
and opens the device again after a wait that starts at 0.1 s and doubles at
every consecutive failure, up to JUTURNA_SOURCE_MAX_BACKOFF (5 s by
default). The wait goes back to 0.1 s after the first frame read. RTSP and
other network streams are not supported today: for RTP video use
VideoRtp.
How it works¶
A source made of digits ("0") or starting with /dev/video is a webcam,
opened with the v4l2 format; anything else is a video file.
File. The frames are transmitted in real time, following their timestamps. At the end of the file the node logs
end of file, stopping the sourceand stops producing frames, or starts again from the beginning whenloopis true. A missing file makes the warmup fail.Webcam. The device sets the pace. If the device cannot be opened or read (unplugged, busy, missing), the error is logged by the node, counted in
health['source_failures'], and the node tries again after a backoff that starts at 0.1 s and doubles at every failure, up toJUTURNA_SOURCE_MAX_BACKOFF(5 s by default). The backoff resets at the first frame read.
Corrupt packets are skipped, with a warning in the log. Looping on a file without video frames is reported as a source failure instead of spinning.
With fps greater than 0, frames closer than 1 / fps seconds to the last
transmitted one are dropped. Use it when a slower node follows, such as a
detector on CPU, so that its queue does not grow.
Arguments¶
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Path of a video file, or a webcam as |
|
|
|
Files only: start again at the end of the file instead of stopping |
|
|
|
Maximum frames per second; |
Input message¶
The node has no input: it reads the file or the device.
Output message¶
Field |
Content |
|---|---|
|
The frame, |
|
Frame size, depth |
|
|
|
Wall-clock time the frame was read, as |
|
Frame time in seconds: from the start of the file (growing across loops), or the device clock for a webcam |
|
Number of frames transmitted by the node, from |
Limits¶
The end of a file is not propagated downstream: the node only stops transmitting.
Webcams work on Linux only (V4L2). The resolution and the pixel format are the device defaults.
RTSP and other network streams are not supported today: for RTP video use
VideoRtp.
License¶
Code: this node is part of juturna-nodes, MIT (its
LICENSEfile).PyAV: BSD-3-Clause (the
License-Expressionof av on PyPI).FFmpeg: effectively GPL. The PyAV wheels on PyPI bundle their own FFmpeg: av 19.0.2 ships FFmpeg 9.0.2 from the pyav-ffmpeg 9.0.2-4 build, which links x264 and x265 (GPL-2.0-or-later). The FFmpeg legal page says that when its GPL parts are used, “the GPL applies to all of FFmpeg”. The libraries still report “LGPL version 3 or later” only because a pyav-ffmpeg patch to FFmpeg’s
configuremoves x264 and x265 out of the libraries that need--enable-gpl. A PyAV built from source against an LGPL build of FFmpeg (without x264, x265 or other GPL parts) avoids the GPL. (Checked on 2026-11-18 on av 19.0.2.)
Configuration¶
Default node arguments, as defined in the node config.toml file. Any of
them can be overridden in the node configuration of a pipeline.
[arguments]
source = ""
loop = false
fps = 0.0
[meta]
Pipeline usage¶
{
"name": "camera",
"type": "VideoCapture",
"configuration": { "source": "/dev/video0", "fps": 5 }
}
Reference¶
- class VideoCapture(source: str, loop: bool, fps: float, **kwargs)
Transmit the frames of a video file or of a webcam