Stream Live Color Video
SUMMARY
Stream Live Color Video acquires continuous color frames in a loop, returning each frame as a NumPy array ready to log, encode, or process. The camera stays in continuous acquisition mode between calls, so frame rate is bounded only by the device and any optional encoding step.
Available on: IDS, Webcam, Intel RealSense.
The Skill
image = camera.capture_video_color_frame()Call repeatedly inside a loop. The first call switches the camera to continuous acquisition; subsequent calls return the next frame.
Example
IDS
Webcam
Intel RealSense
The Code
"""
Stream live color video from an IDS camera, with parameter tuning and JPEG
encoding to reduce bandwidth before logging to Rerun.
Run from a terminal to avoid issues with Rerun's spawn mode.
"""
import time
from loguru import logger
import cv2
import rerun as rr
from telekinesis.medulla.cameras import ids
def main():
camera = ids.IDS(
name="my_ids_camera",
serial_number="4108909352",
load_factory_defaults=False,
)
try:
rr.init("IDS_Example", spawn=True)
camera.connect()
camera.set_parameter('ExposureTime', 35000.0)
camera.set_parameter('AcquisitionFrameRate', 14.0)
end_time = time.time() + 10
while time.time() < end_time:
image = camera.capture_video_color_frame()
if image is not None:
_, encoded = cv2.imencode('.jpg', image, [cv2.IMWRITE_JPEG_QUALITY, 80])
rr.log(
"Continuous_Image_Capture",
rr.EncodedImage(contents=encoded, media_type="image/jpeg"),
)
except Exception as e:
logger.error(f"Unable to run video capture. {type(e).__name__}: {e}")
finally:
camera.disconnect()
if __name__ == "__main__":
main()"""
Stream live color video from a webcam, logging each frame to Rerun.
Run from a terminal to avoid issues with Rerun's spawn mode.
"""
import time
from loguru import logger
import rerun as rr
from telekinesis.medulla.cameras import webcam
def main():
camera = webcam.Webcam(name="my_webcam", camera_id=0)
try:
rr.init("Webcam_Example", spawn=True)
camera.connect()
end_time = time.time() + 10
while time.time() < end_time:
image = camera.capture_video_color_frame()
rr.log("Continuous_Image_Capture", rr.Image(image))
except Exception as e:
logger.error(f"Unable to stream video. {type(e).__name__}: {e}")
finally:
camera.disconnect()
if __name__ == "__main__":
main()"""
Stream live color video from a RealSense camera, logging each frame to Rerun.
Run from a terminal to avoid issues with Rerun's spawn mode.
"""
import time
from loguru import logger
import rerun as rr
from telekinesis.medulla.cameras import realsense
def main():
camera = realsense.RealSense(name="my_realsense")
try:
rr.init("RealSense_Video_Example", spawn=True)
camera.connect()
end_time = time.time() + 10
while time.time() < end_time:
image = camera.capture_video_color_frame()
if image is None:
logger.warning("Image is none")
continue
rr.log("Continuous_Image_Capture", rr.Image(image))
except Exception as e:
logger.error(f"Unable to stream video. {type(e).__name__}: {e}")
finally:
camera.disconnect()
if __name__ == "__main__":
main()The Explanation of the Code
The streaming loop runs for 10 seconds using a wall-clock deadline rather than a fixed frame counter, so the actual number of frames captured depends on the camera's effective frame rate.
end_time = time.time() + 10
while time.time() < end_time:
image = camera.capture_video_color_frame()
...Each call to capture_video_color_frame returns one frame as a NumPy array and keeps the camera in continuous acquisition mode between calls — the sensor is not stopped and re-armed per frame, which is what makes streaming efficient.
Per-camera behavior:
- IDS — the first call switches the camera to
Continuousacquisition mode. Parameters such asAcquisitionFrameRateandExposureTimeshould be tuned withset_parameterbefore the loop starts. JPEG-encoding each frame withcv2.imencodeat quality 80 dramatically reduces the data volume before logging, and Rerun'sEncodedImageaccepts the compressed bytes directly without an intermediate decode step. - Webcam — reads each frame from the OpenCV
VideoCapturedevice in BGR order and converts to RGB before returning. - RealSense — keeps the colour stream running continuously and returns one frame per call, or
Noneif no frame is ready yet. TheNoneguard skips logging until a valid frame arrives rather than passing invalid data to Rerun.
The disconnect call lives in a finally block so the device is released regardless of how the loop exits.
Running the Example
python capture_video_example.pyA Rerun viewer opens automatically. Frames stream under Continuous_Image_Capture for 10 seconds, then the camera disconnects cleanly.
Where to Use the Skill
- Live monitoring — display continuous video for inspection, calibration, or robot teleoperation.
- Vision pipelines that consume video — feed downstream modules such as Cornea with a live feed.
- Local debugging — when remote streaming over BabyROS isn't needed; for that, see Publish Video with BabyROS.

