Live streams
Cameras
A camera is a channel of a live data stream: publish it from Python, the collector or a browser and watch it next to your data.
A camera is a channel of a live data stream, like a column of data. It belongs to the stream, so it uses the stream’s project, visibility and relay, and anyone who can watch the stream can watch its cameras. It is encrypted like the data: the relay forwards ciphertext and cannot see the picture. To line it up with a chart, see Camera sync.
Add a camera from Python
Call add_camera on a LiveStream. It needs ffmpeg on PATH. Use the same API key for the camera as for its stream.
from kymoscope import LiveStream
hd = dict(mode="live", quality="720p", fps=30)
with LiveStream(API_KEY, "Rig A", mode="live", hz=60, channels=1, state_path="kymoscope-state.json") as stream:
stream.add_camera("Front", "video=Integrated Camera", input_format="dshow", **hd) # a webcam on Windows
stream.add_camera("Bay", "/dev/video0", input_format="v4l2", **hd) # a webcam on Linux
stream.add_camera("Door", "rtsp://user:pass@10.0.0.7/stream1", copy=True, **hd) # an H.264 IP camera, as is
stream.add_camera("Test", "testsrc=size=1280x720:rate=30", input_format="lavfi", **hd) # a test pattern
while True:
stream.send(...) # keep sending (or call stream.tick()): the cameras heartbeat with the stream| Argument | Meaning |
|---|---|
name | The camera’s name in the stream browser. |
ffmpeg_input | What ffmpeg opens: a device name, a path, or a URL. |
input_format | ffmpeg’s -f: dshow (Windows), v4l2 (Linux), avfoundation (macOS), gdigrab / x11grab (screen capture), lavfi (generated test sources). Not needed for most URLs. |
input_options | Extra ffmpeg input arguments before -i, as a list or one string: "-video_size 1920x1080 -framerate 30". |
mode | Required. "live" or "record" (recorded in files cut with its stream’s; see Recordings below). |
quality | Required. "360p", "480p", "720p" or "1080p": the height, the aspect kept. |
fps | Required. Frames per second, 1 to 60. |
copy | True forwards an H.264 camera’s stream without re-encoding. It is checked with ffprobe first: any other codec (H.265, MJPEG) is re-encoded, said in one status line. Default False. |
clock | An RTSP camera’s frame times: "auto" (default), "camera" or "arrival". See Camera clocks below. |
ffmpeg | Path to the ffmpeg executable. Default "ffmpeg". |
Every input type (RTSP H.264 or H.265, MJPEG, SRT, RTMP, screen capture, webcams and capture cards) is in Camera inputs, step by step, below.
- ffmpeg re-encodes to H.264 at that quality and frame rate, at the bitrate Kymoscope sets for them (see Bandwidth), with a keyframe every 2 seconds. With
copy=Truethe camera’s own stream goes as is: set the camera’s resolution, frame rate and bitrate to what you declared.sizeandkbpsare gone since kymoscope 1.0. - A camera your plan can’t take is refused at start with the reason. When this month’s video hours run out, the camera stops and says why; the data stream goes on.
- Frames are stamped with
time.time(). If your data uses Unix times too, the sync is Exact. - Video goes out only while someone watches the camera. A new viewer starts at the next keyframe.
- The camera registers and heartbeats with its stream, and closing the stream stops it. Keep calling
sendortick. - Credentials in a camera URL (
rtsp://user:pass@host/…) are on ffmpeg’s command line, so other users of the same machine can read them in the process list. Kymoscope hides them (rtsp://***@host) in everything it prints. Use a camera account that can only view the stream, on a machine nobody else uses.
Cameras from the collector
The site collector publishes cameras from collector.yaml, with no code: list them under a stream as cameras:. Each camera is a channel of that stream and uses its mode (live or record).
- Install ffmpeg on the collector's machine (it brings ffprobe):
winget install Gyan.FFmpegon Windows,sudo apt install ffmpegon Debian or Ubuntu,brew install ffmpegon macOS. The Docker image already has it. - Add the cameras to a stream of
collector.yaml(example below). - Check each camera before you start:
kymoscope-collector check --config collector.yaml --source Door(see Check a camera, below). - Restart the collector. The log says
camera 'Door' publishingfor each camera. - In Kymoscope, open the stream and add a Camera panel (see Camera sync).
api_key: env:KYMOSCOPE_API_KEY
streams:
- name: Line 3
mode: live
sources:
- {name: PLC, type: opcua, url: "opc.tcp://10.0.0.5:4840", tags: tags.csv}
cameras:
- name: Door
input: rtsp://viewer:password@10.0.0.7/stream1
copy: true # an H.264 camera goes as is; any other codec is re-encoded
quality: 720p
fps: 25
- name: Press
input: rtsp://viewer:password@10.0.0.8/h265
quality: 720p
fps: 25| Key | Meaning and default |
|---|---|
name | Required. The camera’s name, unique in its stream. |
input | Required. What ffmpeg opens: a URL (rtsp://, srt://, rtmp://, http://), a device or a display. A password in it never reaches the logs. |
quality | Required. 360p, 480p, 720p or 1080p: the height, the aspect kept. |
fps | Required. Frames per second, 1 to 60. |
format | Optional. ffmpeg’s input format (-f): dshow, v4l2, avfoundation, gdigrab, x11grab, mpjpeg. Not needed for most URLs. |
input_options | Optional. Extra ffmpeg input arguments, as one line or a list: -video_size 1920x1080 -framerate 30. |
copy | Optional. true forwards an H.264 camera’s stream without re-encoding (checked with ffprobe first; any other codec is re-encoded). Default false. |
low | Optional. true also publishes the 360p low-quality copy (see Low-quality copy). Default false. |
clock | Optional. An RTSP camera’s frame times: auto (default), camera or arrival. See Camera clocks. |
- A camera that can’t start (unreachable, wrong password, refused by your plan) is logged and tried again every 10 seconds; the data never stops for it. So is a camera whose ffmpeg stops, for example while an IP camera reboots.
- ffmpeg’s errors and Kymoscope’s notices for a camera go to
collector.log, prefixed with the stream and camera names. The health stream has<source>.cameras, the cameras publishing now, andstatusshowscamerasper stream. - The collector holds the camera URL, password included, on ffmpeg’s command line. Use a camera account that can only view the stream.
Camera inputs, step by step
Every camera goes through ffmpeg and reaches Kymoscope as H.264, whatever it sends. Pick your camera’s type below. Each example gives the Python call and the same camera in collector.yaml; both take the same settings (input_format in Python is format in the collector). Before you write the configuration, try the input on that machine with ffplay <input> (it comes with ffmpeg): what plays there works here.
IP camera, RTSP, H.264
Most IP cameras. Find the stream URL in the camera’s manual or web page (often rtsp://host:554/stream1 or /Streaming/Channels/101). With copy the camera’s own H.264 goes as is, with no encoding on your machine: set the camera’s resolution, frame rate and bitrate to what you declare, and a keyframe every 1 to 2 seconds.
stream.add_camera("Door", "rtsp://viewer:password@10.0.0.7/stream1", copy=True, mode="live", quality="720p", fps=25) - {name: Door, input: "rtsp://viewer:password@10.0.0.7/stream1", copy: true, quality: 720p, fps: 25}IP camera, RTSP, H.265 (HEVC)
Many newer cameras send H.265. Set it up as above: with copy, the sender finds the codec with ffprobe, says the input is hevc, not H.264: re-encoding it to H.264 once, and re-encodes it. If the camera can send H.264 too (often a second stream), choose that one to save the encoding.
- {name: Press, input: "rtsp://viewer:password@10.0.0.8/h265", copy: true, quality: 720p, fps: 25}MJPEG over HTTP
Older and low-cost cameras serve a picture stream at an address such as http://host/mjpg or /video.cgi. It is always re-encoded, and each picture is stamped with its arrival time (MJPEG carries none). If ffmpeg can’t tell the format, add format: mpjpeg.
stream.add_camera("Gate", "http://10.0.0.9/mjpg", mode="live", quality="480p", fps=10) - {name: Gate, input: "http://10.0.0.9/mjpg", quality: 480p, fps: 10}SRT
Encoders and media servers that send SRT (MPEG-TS over SRT). Use the listener’s address and, when it asks for one, its stream id. For an encrypted SRT link add &passphrase=… to the URL.
- {name: Encoder, input: "srt://10.0.0.20:8890?streamid=read:line3", quality: 720p, fps: 25}RTMP
Encoders and media servers that serve RTMP: use the play URL.
- {name: Encoder, input: "rtmp://10.0.0.20:1935/live/line3", quality: 720p, fps: 25}Screen capture
An HMI or SCADA screen on the sending machine. The input depends on the operating system; size and frame rate go in input_options.
stream.add_camera("HMI", "desktop", input_format="gdigrab", input_options="-framerate 10", mode="live", quality="720p", fps=10) # Windows
stream.add_camera("HMI", ":0.0", input_format="x11grab", input_options="-video_size 1920x1080 -framerate 10", mode="live", quality="720p", fps=10) # Linux (X11)
stream.add_camera("HMI", "1:none", input_format="avfoundation", input_options="-framerate 10", mode="live", quality="720p", fps=10) # macOS: screen 1 - name: HMI
input: desktop
format: gdigrab
input_options: -framerate 10
quality: 720p
fps: 10- Windows:
title=Window namein place ofdesktopcaptures one window. A Windows service can’t see the desktop: run the collector in the signed-in user’s session for this. - Linux: the display (
:0.0) must be the sender’s own; setDISPLAYaccess for the sender’s user. Wayland desktops need an X11 session. - macOS: list the screens with
ffmpeg -f avfoundation -list_devices true -i ""and allow Screen Recording for the program in System Settings.
USB webcams and HDMI or SDI capture cards
USB (UVC) cameras and capture cards (HDMI or SDI to USB, PCIe cards) show up as video devices. List them, then use the name: on Windows ffmpeg -list_devices true -f dshow -i dummy, on Linux v4l2-ctl --list-devices, on macOS ffmpeg -f avfoundation -list_devices true -i "". Ask the device for its size and frame rate in input_options; a card that offers MJPEG at full size needs -input_format mjpeg on Linux (-vcodec mjpeg on Windows).
stream.add_camera("Bench", "video=USB Video", input_format="dshow", input_options="-video_size 1280x720 -framerate 30", mode="live", quality="720p", fps=30) # Windows
stream.add_camera("Bench", "/dev/video0", input_format="v4l2", input_options="-input_format mjpeg -video_size 1920x1080 -framerate 30", mode="live", quality="1080p", fps=30) # Linux - name: Bench
input: /dev/video0
format: v4l2
input_options: -input_format mjpeg -video_size 1920x1080 -framerate 30
quality: 1080p
fps: 30- In Docker, pass the device in:
--device /dev/video0. - A device opens once: on Windows,
lowcan’t be used with a dshow device (the sender says so).
Machine-vision cameras (GigE Vision, USB3 Vision, CoaXPress, Camera Link)
Industrial cameras that speak GenICam publish like any other camera, from Python and from the collector: GigE Vision and USB3 Vision cameras, and CoaXPress or Camera Link cameras through their frame grabber. Kymoscope reads them through the camera vendor’s GenTL producer (a .cti file), takes each raw frame with its capture time, and encodes it to H.264.
- Install the extra on the sending machine:
pip install "kymoscope[genicam]"(for the collector:pip install "kymoscope-collector[genicam]"; the Docker image has it). It needs ffmpeg too. - Install your camera vendor’s SDK, which brings its GenTL producer: a
.ctifile, such asmvGenTLProducer.cti(Balluff / Matrix Vision),ProducerGEV.cti(Basler pylon),VimbaGigETL.cti(Allied Vision) or your frame grabber’s. Note its path. Some producers (Balluff’s mvGenTL among them) also open other vendors’ GigE Vision cameras. - GigE Vision: put the camera on the same subnet as the sending machine’s network port, and use jumbo frames on that port if the camera does. USB3 Vision: plug it into a USB 3 port.
- See the cameras the producer finds and check one (below), then add it to Python or
collector.yaml.
from kymoscope.genicam import GenICamSource, list_devices
CTI = "/opt/mvIMPACT_Acquire/lib/x86_64/mvGenTLProducer.cti"
print(list_devices(CTI)) # [{'vendor': ..., 'model': ..., 'serial_number': 'SN1234', ...}]
cam = GenICamSource(CTI, device="SN1234",
settings={"PixelFormat": "Mono8", "ExposureTime": 5000, "AcquisitionFrameRate": 25})
stream.add_camera("Line", source=cam, mode="live", quality="720p", fps=25) cameras:
- name: Line
type: genicam
cti: /opt/mvIMPACT_Acquire/lib/x86_64/mvGenTLProducer.cti
device: SN1234 # serial number, user-defined name or model; leave out for the first camera
settings: {PixelFormat: Mono8, ExposureTime: 5000, AcquisitionFrameRate: 25}
quality: 720p
fps: 25| Key | Meaning and default |
|---|---|
type | genicam. Without it, a camera is an ffmpeg input. |
cti | Required. The path of the GenTL producer (.cti). |
device | Optional. The camera’s serial number, user-defined name or model. Default: the first camera the producer finds. |
settings | Optional. GenICam features set, in the order given, when the camera opens: PixelFormat, Width, Height, ExposureTime, Gain, AcquisitionFrameRate… The names are the camera’s (some need AcquisitionFrameRateEnable: true first). Put PixelFormat, Width and Height first. |
quality, fps, low | As for any camera. Set the camera’s own frame rate to fps. |
- Pixel formats:
Mono8,Mono10,Mono12,Mono16(scaled to 8 bits for the video),BayerRG8,BayerGR8,BayerGB8,BayerBG8(turned into colour),RGB8andBGR8. Packed formats (Mono12p…) are not taken: set one of these insettings. - Times: each frame keeps the camera’s own timestamp, mapped to the sending machine’s clock (it is stamped with the moment it was taken, not when it arrived). If the camera has PTP (IEEE 1588) on, the sender says so; it isn’t needed.
- A camera that stops sending for 10 seconds (cable pulled, rebooting) stops. The collector starts it again every 10 seconds; in Python,
camera.runningturns False, so a script can add it again. - A GigE Vision camera takes one controlling program at a time: stop any viewer (the vendor’s tool) before the sender opens it.
- In Docker, mount the producer read-only (
-v /opt/mvIMPACT_Acquire:/opt/mvIMPACT_Acquire:ro) and, for GigE Vision, run with--network hostso the camera is found by broadcast. USB3 Vision needs the USB device passed in.
Check a machine-vision camera before you start it: the collector lists the cameras the producer sees and opens yours.
kymoscope-collector check --config collector.yaml --source Line{"checks": [{"name": "load", "ok": true}, {"name": "genicam", "ok": true}, {"name": "devices", "ok": true}, {"name": "open", "ok": true}],
"summary": {"camera": "Line", "devices": ["Acme M2 serial SN1234"], "frame": "1920x1200 Mono8", "sent": "re-encoded to H.264"}}genicamfails: install the extra.devicesfails: the producer path is wrong, or it sees no camera (power, cable, subnet), or none matchesdevice(the problem lists those it sees).openfails: a setting the camera refuses (named in the problem), or another program holds the camera, the collector itself included: check before you start it.
Your own frames work the same way: source= takes any iterable of kymoscope.camera.Frame(image, t, pixel_format) (a numpy picture, its capture time in Unix seconds, its pixel format), and on_frame= sees each frame before it is encoded.
Thermal cameras
A radiometric thermal camera sends a temperature for every pixel. Kymoscope publishes it as a colour video (a palette such as ironbow) and turns the temperatures of the regions you name into data channels of the stream: Kiln Burner max, Kiln Door mean… They plot, record and raise alerts like any other channel.
- Radiometric over GenICam (FLIR A-series such as A50 / A70 and A400 / A700, Ax5, and other GigE Vision thermal cameras that send 16-bit temperatures): video plus region channels, from Python and from the collector. Read on.
- Only RTSP (most thermal IP cameras’ video stream): the picture is already coloured by the camera and holds no temperatures. Add it as an ordinary IP camera: video only, no region channels.
- Set the camera up as a machine-vision camera (its GenTL producer, the network,
check). - Put it in TemperatureLinear mode with
PixelFormat: Mono16, so each pixel is the temperature in kelvin times 100 (0.01 K resolution) or times 10 (0.1 K). The feature names depend on the model: for exampleIRFormat: TemperatureLinear10mK, orTemperatureLinearMode: OnwithTemperatureLinearResolution: High. Find yours in the vendor’s tool and put them insettings. - Add a
thermal:block, and the regions you want as channels inrois:. - Run
check: it shows the temperatures of one frame and of each region. If they look about 270 °C off or ten times too big, fixscaleto match the camera’s resolution.
cameras:
- name: Kiln
type: genicam
cti: /opt/spinnaker/lib/flir-gentl/FLIR_GenTL.cti
device: "71234567"
settings: {PixelFormat: Mono16, IRFormat: TemperatureLinear10mK, AcquisitionFrameRate: 30}
thermal: {scale: 0.01, palette: ironbow, range: auto}
rois:
Burner: [120, 80, 60, 40] # x, y, width, height in pixels from the top left
Door: [0.5, 0.0, 0.5, 1.0] # or fractions of the frame (write the decimal point)
Frame: all # the whole picture
stats: [max, mean]
quality: 480p
fps: 30| Key | Meaning and default |
|---|---|
thermal.scale | Kelvin per count. Default 0.01 (TemperatureLinear at 0.01 K); 0.1 at 0.1 K. |
thermal.offset | Kelvin added after the scale: kelvin = raw × scale + offset. Default 0. |
thermal.unit | C (default), K or F: the unit of the channels and of range. |
thermal.palette | ironbow (default), grey or rainbow. |
thermal.range | auto (default: the picture’s coldest to hottest, eased so it doesn’t flicker) or [low, high] in unit, which keeps colours comparable between frames and cameras. |
thermal.smoothing | With range: auto, how far the range moves towards each new frame’s, from 0.1 (default, slow) to 1 (each frame its own). |
rois | Optional. Named regions, each [x, y, w, h] in pixels, in fractions of the frame, or all. A region partly outside the picture is cut to it. |
stats | What each region gives: max (default), min, mean, median. One channel per region and stat, named <camera> <region> <stat>, in °C (or your unit). |
roi_hz | Optional. Region values a second at most. Default: one per frame. |
The region channels belong to the stream: they are declared with it, appear in the channel list next to the stream’s sources, are recorded in the same files, and are stamped with the time the frame was taken, so they line up with the video. An alert rule such as Kiln Burner max > 450 runs on the collector like a rule on any channel.
From Python, wrap the camera in a ThermalSource and declare the region channels with the stream (pip install "kymoscope[genicam]"):
import time
from kymoscope import LiveStream
from kymoscope.genicam import GenICamSource
from kymoscope.roi import RoiMeter
from kymoscope.thermal import ThermalSource
meter = RoiMeter("Kiln", {"Burner": (120, 80, 60, 40), "Frame": None}, stats=("max", "mean"), unit="°C")
cam = ThermalSource(GenICamSource(CTI, device="71234567",
settings={"PixelFormat": "Mono16", "IRFormat": "TemperatureLinear10mK"}),
scale=0.01, palette="ironbow", range="auto", meter=meter)
with LiveStream(API_KEY, "Kiln", mode="live", hz=30, channels=len(meter.names),
names=meter.names, units=meter.units) as stream:
stream.add_camera("Kiln", source=cam, mode="live", quality="480p", fps=30)
while True:
t, columns = meter.take() # the regions measured since the last call
if t:
stream.send_columns(t, columns, units=meter.units)
else:
stream.tick()
time.sleep(0.05)meter.namesare the channel names (Kiln Burner max…): pass them when the stream is created, with your other channels if it has some.ThermalSourcewraps any frame source of one value per pixel, not only GenICam: your own 16-bit frames work too.to_temperature,colorizeandpaletteinkymoscope.thermalare there for your own processing.- A pixel with no reading (NaN) is left out of a region; a region with none gives NaN.
3D and depth cameras
A depth camera measures a distance for every pixel. Kymoscope publishes the distances as a colour video (near in blue, far in red with the turbo palette) and turns the distance of each region you name into a data channel of the stream, in millimetres: Bin depth Tote median… They plot, record and raise alerts like any other channel: a fill level, a pallet that is missing, a part that sits too high.
- Intel RealSense (D415, D435, D435i, D455, D405, L515…): its colour picture and its depth as two cameras, from Python and from the collector. A RealSense recording (
.bagor.db3) plays the same way. - GenICam 3D cameras (Basler blaze, LMI Gocator, Photoneo, and other GigE Vision or USB3 Vision 3D cameras that send their range as 16-bit pixels,
Coord3D_C16orMono16): the depth video plus region channels, through the camera’s GenTL producer.
Intel RealSense
- Plug the camera into a USB 3 port. On Linux in Docker, give the container the device:
--privileged -v /dev:/dev. - Add a camera with
type: realsense.deviceis the serial number printed on the camera (leave it out for the first one found). - Run
check --source "Bin depth": it lists the RealSense devices, opens yours and shows the distances of one frame and of each region.
cameras:
- name: Bin
type: realsense
device: "123456789012" # or bag: /data/capture.bag to play a recording
width: 640 # a mode of the camera; fps 6, 15, 30 or 60
height: 480
depth: {palette: turbo, range: [300, 2000]}
rois:
Tote: [0.4, 0.3, 0.2, 0.2] # x, y, width, height: pixels, or fractions of the frame
Floor: [0, 400, 640, 80]
stats: [median, min]
quality: 480p
fps: 30This publishes two cameras: Bin (colour) and Bin depth (the distances in colour), and the channels Bin depth Tote median, Bin depth Tote min… Both cameras come from one pipeline. Depth is aligned to the colour picture, so a region drawn on the colour picture measures the same spot. Each frame is stamped with its RealSense timestamp, mapped to the machine’s clock, so the video and the channels line up with the stream’s other data.
| Key | Meaning and default |
|---|---|
device | Serial number. Default: the first RealSense found. |
bag | Instead of a device: a RealSense recording (.bag, or .db3 from librealsense 2.57 and later) played in real time, from the start again when it ends. |
streams | [color, depth] (default), color or depth. |
width | height: a mode of the camera, default 640 × 480. A recording plays its own. |
align | true (default): depth aligned to colour when both are published. |
depth.palette | turbo (default), grey, rainbow or ironbow. Near is the palette’s first colour; no reading is black. |
depth.range | auto (default: the picture’s nearest to farthest, eased) or [near, far] in mm, which keeps colours comparable. |
depth.scale | Millimetres per raw unit. Default: the device’s own depth scale (1 mm on most models, 0.1 mm on a D405). |
rois | stats and roi_hz as for thermal cameras; stats defaults to median, the steadiest distance of a region. |
From Python (pip install "kymoscope[realsense]"; wheels for Windows and Linux x86_64 and arm64):
import time
from kymoscope import LiveStream
from kymoscope.depth import DepthSource
from kymoscope.realsense import RealSense, list_devices
from kymoscope.roi import RoiMeter
print(list_devices())
rs = RealSense("123456789012") # or RealSense(bag="capture.bag")
meter = RoiMeter("Bin depth", {"Tote": (0.4, 0.3, 0.2, 0.2)}, stats=("median", "min"), unit="mm")
with LiveStream(API_KEY, "Bin", mode="live", hz=30, channels=len(meter.names),
names=meter.names, units=meter.units) as stream:
stream.add_camera("Bin", source=rs.color, mode="live", quality="480p", fps=30)
stream.add_camera("Bin depth", source=DepthSource(rs.depth, range=(300, 2000), meter=meter),
mode="live", quality="480p", fps=30)
while True:
t, columns = meter.take()
if t:
stream.send_columns(t, columns, units=meter.units)
else:
stream.tick()
time.sleep(0.05)Replay a RealSense recording
A recording made with the RealSense Viewer (or rs.recorder) plays like a camera: give its path as bag: in the collector, or RealSense(bag="capture.bag") in Python. It plays in real time with its recorded frame spacing, from the start again when it ends, and publishes its colour and depth with region channels exactly as the live camera would. Use it to set up regions and alert rules before the camera is installed, or to share a capture.
GenICam 3D cameras
- Set the camera up as a machine-vision camera (its GenTL producer, the network,
check). - Make it send its range (depth) component as one 16-bit value per pixel:
PixelFormat: Coord3D_C16(orMono16), with the range component selected (for exampleComponentSelector: RangeandComponentEnable: true, and the others disabled). Find the names in the vendor’s tool and put them insettings. - Set
depth.scaleto the camera’sScan3dCoordinateScalein millimetres (millimetres per unit). - Run
check: it shows the distances of one frame and of each region. If they look ten or a thousand times off, fixscale.
cameras:
- name: Bin
type: genicam
cti: /opt/pylon/lib/gentlproducer/gtl/ProducerGEV.cti
device: "40123456"
settings: {ComponentSelector: Range, ComponentEnable: true, PixelFormat: Coord3D_C16}
depth: {scale: 0.15, palette: turbo, range: [300, 3000]}
rois:
Tote: [200, 150, 120, 100]
stats: [median]
quality: 480p
fps: 15From Python, wrap the camera in a DepthSource as above: DepthSource(GenICamSource(CTI, device="40123456", settings=...), scale=0.15, meter=meter). A raw 0 is no reading (a hole, out of range): it is left out of every region and black in the video; a region with no reading at all gives NaN. DepthSource wraps any frame source of 16-bit distances, and to_depth in kymoscope.depth converts them for your own processing.
Region distances as alerts
The region channels belong to the stream: declared with it, recorded in the same files and stamped with the time the frame was taken. An alert rule such as Bin depth Tote median > 1800 (the tote is nearly empty: the camera sees its bottom) runs on the collector like a rule on any channel.
High-speed cameras and video files
A high-speed camera (Photron FASTCAM, Phantom) records into its own memory and you download the shot afterwards. An action camera, a phone or any other recorder does the same. Import the file and it becomes a camera of a data recording: the Camera panel shows each frame at the moment it was captured, so 10 000 fps footage plays frame by frame against your data when you move the cursor. Phantom .cine, Photron .mraw (with its .cihx or .cih), and any file ffmpeg reads (.mp4, .mov, .avi, .mkv…) work. The file is re-encoded to H.264 (at most 720p by default, never enlarged) and uploaded encrypted, like a recorded camera.
Import from Python
- Record the data with a
recordstream as usual (or send a logger file’s rows with their own times,historical=True). - Open the same stream (same name, same
state_path) and callimport_videowith the file. It finds the data recording that covers the video’s time. - Open the recording in the app, add a Camera panel and pick the camera (
Phantom (recorded)). Move the cursor: the picture follows.
from kymoscope import LiveStream
with LiveStream(API_KEY, "Rig A", mode="record", hz=1000, channels=8, state_path="kymoscope-state.json") as stream:
stream.import_video("shot_042.cine", "Phantom") # the recording covering its trigger time
stream.import_video("crash.mraw", "Photron", # crash.cihx next to it
recording="Rig A — 2026-11-19 10:00 UTC") # or a recording by name (or id)
stream.import_video("phone.mp4", "Phone", capture_fps=240, # 240 fps slow motion saved at 30 fps
start="2026-11-19T10:15:02.250+01:00")
stream.import_video("GX010042.MP4", "GoPro", telemetry=True) # its accelerometer, gyro and GPS too| Argument | Meaning |
|---|---|
path | The video file. A .mraw needs its .cihx or .cih beside it. A 12-bit .mraw needs numpy: pip install "kymoscope[video]". |
camera | The camera it plays as. Default: the file’s name. One video per camera per recording: use one camera name per shot to keep several shots in one recording. |
recording | A data recording of this stream, by id or by name as the Cloud window shows it. Default: the file the stream is writing now when it covers the video, else the stream’s recording that overlaps the video most. |
start | The time of the trigger (.cine, .mraw) or of the first frame (other files): Unix seconds or ISO 8601. A time with no zone is this machine’s local time. |
trigger_frame | The frame (counted from 0 in the file) taken at start, when that isn’t the first one. |
capture_fps | The rate the camera really captured at, when the file’s rate is a playback rate (slow motion). |
offset | Seconds added to every frame time: a camera clock that is off. |
quality | 360p to 1080p: the largest height kept. Default 720p. |
telemetry | A GoPro file’s telemetry as data: see below. Needs a record stream. |
It blocks until the video is uploaded and returns what it did: the camera, the number of frames, the first and last frame time and the ids of both recordings. With no recording that covers the video it raises an error naming the times it looked for.
How the frame times are decided
- Phantom
.cine: the trigger time in the file header (UTC, to a fraction of a microsecond) and each frame’s own time when the file has them, else trigger time + frame number ÷ frame rate. Frames before the trigger come first, at times before it. - Photron
.mraw: the date and time in the.cihx/.cih(the recording PC’s local time, whole seconds), the record rate and the start frame (negative for frames before the trigger). Passstart=for better than a second. - Any other file: its
creation_time(whole seconds in an.mp4) plus each frame’s own time in the file. Phones and cameras write it from their own clock, and some (GoPro) write local time as if it were UTC: check the timescheckshows, and correct them withstartoroffset. - Slow motion: a phone’s 240 fps clip is usually saved to play at 30 fps. Pass
capture_fps=240and the frames are 1/240 s apart again, so the clip covers the real 0.5 s, not 4 s.
The fastest way to line up a shot is an event both see: the trigger signal recorded as a data channel, a flash, an impact. Put the cursor on it in the data, note how far the frame is, and import again with offset. See Camera sync for the panel’s fine offset.
GoPro telemetry
A GoPro records its accelerometer, gyroscope and GPS in the video file, on the same clock as the picture. With telemetry=True they become a data recording of the stream with these channels, and the video is attached to it: ACCL 1 to ACCL 3 (m/s²), GYRO 1 to GYRO 3 (rad/s), MAGN when present, and GPS latitude, GPS longitude, GPS altitude, GPS speed 2D, GPS speed 3D (HERO5 to HERO12; a HERO13 records GPS in a newer format that isn’t read yet). The axis order of ACCL and GYRO is the camera’s, which differs between models.
A folder in the collector
Add videos: to a stream and drop the files into the folder, for example from the PC that downloads the camera. Each file that has stopped changing is imported into the stream’s recording covering its time, then moved to done/ (or failed/ with a .error.txt saying why). A file whose data hasn’t arrived yet (the logger file is still being imported) waits up to wait_s; so does a .mraw without its header.
streams:
- name: Rig A
mode: record
sources:
- {name: Logger, type: files, path: /data/logger}
videos:
- path: /data/high-speed # .cine, .mraw + .cihx, .mp4, .mov, .avi, .mkv...
camera: High-speed # optional: default each file's name| Key | Meaning and default |
|---|---|
path | The folder. Required. |
name | What check --source calls it. Default Videos. |
pattern | A glob or a list, such as '*.cine'. Default: every video extension. |
camera | recording, capture_fps, offset, quality, telemetry: as in Python, for every file of the folder. |
done_dir | failed_dir: default done/ and failed/ inside the folder. |
min_age_s | Seconds a file must stay unchanged before it is read. Default 10. |
wait_s | Seconds a file waits for its data recording. Default 600. |
Check the folder before the collector runs: check reads every file and shows the times it would use, and uploads nothing.
kymoscope-collector check --config collector.yaml --source Videos{"checks": [{"name": "load", "ok": true}, {"name": "ffmpeg", "ok": true}, {"name": "files", "ok": true}],
"summary": {"videos": "Videos", "path": "/data/high-speed", "files": [
{"file": "shot_042.cine", "format": "cine", "frames": 1000, "fps": 5000.0,
"first": "2026-11-19T10:15:02.000Z", "last": "2026-11-19T10:15:02.200Z"}]}}Check a camera
The collector checks one camera without publishing anything: that ffmpeg and ffprobe are on PATH, that the input opens, and its codec.
kymoscope-collector check --config collector.yaml --source Door{"checks": [{"name": "load", "ok": true}, {"name": "ffmpeg", "ok": true}, {"name": "open", "ok": true}],
"summary": {"camera": "Door", "codec": "h264", "sent": "forwarded as is"}}ffmpegfails: install ffmpeg (with ffprobe) and make sure it is on PATH.openfails: the problem quotes ffmpeg (401 Unauthorized,Connection refused,404 Not Found, or no answer in 15 s). Check the URL, the user and password, and that this machine reaches the camera. The password never shows in the report.sentsays what the camera costs this machine:forwarded as is(H.264 withcopy) orre-encoded to H.264.
From Python, copy=True runs the same check when the camera starts: an input that doesn’t open raises RuntimeError before the camera registers. camera.running turns False once ffmpeg stops, so a script can start it again.
Camera clocks
An IP camera’s picture reaches your machine 0.2 to over 1 second after it was taken (the camera’s encoder, the network, decoding), and that delay jitters. An RTSP camera also says when it took each frame: every frame carries a timestamp from the camera’s own clock, and most cameras send reports that tie that clock to the time of day. clock chooses what each frame is stamped with:
| clock | Each frame is stamped with |
|---|---|
auto | Default. The camera’s own frame timestamps, set against your machine’s clock by the shortest delay seen in the last minute: the network jitter is gone and the spacing is the camera’s. The constant delay that remains is the camera’s latency (Camera sync corrects it). When the camera’s clock agrees with yours within 50 ms, its clock is used as is. |
camera | The camera’s clock: when the frame was taken. Use it when the camera’s clock is synchronised (NTP or PTP). A camera clock more than 2 seconds from yours is not used: the frames are stamped on arrival and the log says why. |
arrival | When the frame reaches your machine, delay and jitter included. |
stream.add_camera("Door", "rtsp://viewer:password@10.0.0.7/stream1", clock="camera", mode="live", quality="720p", fps=25) - {name: Door, input: "rtsp://viewer:password@10.0.0.7/stream1", clock: camera, quality: 720p, fps: 25}- For
camera, turn on NTP in the camera’s settings (Date and time, or System, in its web page) with the same time server as the machine that sends your data, or PTP where the camera supports it. A camera set by hand drifts by seconds a week. - To check, look at the camera’s status line in the log or the Python status:
timing: the camera's clock (RTCP sender reports),timing: RTP timestamps anchored to arrival, ortiming: arrivalwith the reason (no reports from the camera, or its clock too far off). Kymoscope keeps the timing in use with the camera. - The constant delay that remains is measured by itself when the camera sees something your data also records (a lamp that follows a signal, a moving part); otherwise calibrate it once with a flash (see Camera sync).
- The sender opens the camera through a local relay of the RTSP connection to read the camera’s reports; nothing in the stream changes. A camera that refuses it can use
arrival.rtsps://cameras getautowithout the camera’s clock. Other inputs (webcams, MJPEG, SRT, RTMP) are stamped on arrival.
Add a camera from a browser
A browser that can encode H.264 with WebCodecs is needed. Chrome and Edge can. The page tells you when your browser can’t.
- Open
/camerain the Kymoscope app on the machine with the camera. - Choose one of your live data streams, the camera device and a name.
- Choose the mode (Live only or Record), the quality and the frames per second. 720p at 30 fps is the default (4 Mbit/s).
- Paste the API key that publishes that stream. The page shows what your plan has left for it (video hours, bandwidth, storage) before you start.
- Start. The browser keeps the key only if you tick “Remember this key on this device”.
With Record, the page shows where the files go (Recording files: every 1h → Kymoscope) and the Buffer on this device (2 GB): the camera’s files are cut with its data stream’s, kept in the browser until they are stored, and uploaded. There is nothing to set: the period is the data stream’s. In a project that records to a folder, the page asks you to Choose folder once (Chrome and Edge) and remembers it. See Recording.
Watch a camera
Open a stream and its cameras open with it, with nothing extra to type. They use the same key material as the stream: the project key, the same password or API key, or your own browsers. In the stream browser and the Datasets drawer, cameras are listed under their stream. A camera has no checkbox because it plots no data. Its “Add Camera panel” button puts it in the worksheet.
A camera downloads video only while a Camera panel shows it. Until then it shows as ready and uses no bandwidth. Video never slows down the data.
Game video from the Assetto Corsa and Le Mans Ultimate plugins
The native Assetto Corsa and Le Mans Ultimate plugins can send the game window as a camera of their telemetry stream. They need Windows 10 1903 or later (or Windows 11) and a plan with cameras. See Publishing for the plugins themselves.
- Install the plugin: in Assetto Corsa,
KymoscopeACTelemetry.dll=1inplugins\plugins.ini; in Le Mans Ultimate,KymoscopeLiveTelemetry.dllinPlugins\, enabled inCustomPluginVariables.JSON. - In
KymoscopeLiveTelemetry.ini, next to the DLL, add under[Kymoscope]:Camera=1,CameraMode=live(orrecord, withMode=recordtoo: the video then records in files cut with its stream’s, only while the car is driven; see Recording),CameraQuality=720pandCameraFps=30. - Start the game and drive. The stream appears in Kymoscope.
- Open the stream, then add a Camera panel (Add chart) and pick “Game”.
The plugin captures and encodes only while someone watches. CameraMode, CameraQuality (360p to 1080p, never above the window's size) and CameraFps (1 to 60) are required with Camera=1; without them the telemetry runs without the camera and the log says why. Optional keys are CameraName (default Game) and CameraLow (1, the 360p copy for small panels). CameraKbps and CameraHeight are no longer read. If the picture is black, run the game borderless or windowed. When the game stops drawing (frozen or closed), the plugin stops sending after 2 s and the panel says No signal.
Access and encryption
The camera has its own key. Outside projects it is derived from the same password or API key secret as the stream’s, with its own salt. In an end-to-end encrypted project it is a random key per epoch, sealed under the project key.
In an end-to-end encrypted project a Python camera needs no second approval: it is published by the same sender device as its stream.
Use a dedicated API key for cameras, ideally a project key, and only let a device remember it on a machine you control.
Bandwidth
A camera's bitrate follows from its quality and frame rate: between 15, 30 and 60 fps it is interpolated, and below 15 fps it scales down in proportion. The 360p low copy adds 0.4 Mbit/s. It is uploaded from the camera machine only while the camera has viewers, and counts against your plan's live bandwidth while the camera runs.
| Quality | Mbit/s at 15 / 30 / 60 fps |
|---|---|
| 360p | 0.4 / 0.7 / 1.0 |
| 480p | 0.9 / 1.5 / 2.2 |
| 720p | 2.4 / 4.0 / 6.0 |
| 1080p | 3.6 / 6.0 / 9.0 |
See Limits and usage.
Plan limits
| Plan | Cameras |
|---|---|
| Enterprise | 4 cameras, up to 1080p at 60 fps, 200 video hours a month, 50 GB of recorded video |
| Every other plan | 0 |
Video hours count the time each camera is live, watched or not. Preferences → Usage shows what is left.
For cameras on another plan, contact us about a pilot.
Low-quality copy
A camera can also publish a low-quality copy (a low layer) next to its full-quality video. It is 360p at 15 fps and about 400 kbit/s, and it is not recorded. The copy is not counted as a camera of your plan.
- Browser: the
/camerapage has “Low-quality copy for camera walls”, on by default. - Python:
stream.add_camera(..., low=True). On Windows,low=Truewithinput_format="dshow"raises an error (a webcam can’t be opened twice); an IP camera works. - A Camera panel narrower than 640 px plays the low copy and shows an “LQ” tag. It goes back to full quality at 720 px. A camera without a low copy plays at full quality at any size.
- Like the full video, the copy is sent only while someone watches it.
Camera wall
One Camera panel can show up to 9 cameras. In the panel’s settings, tick the cameras in the order you want them. Two cameras sit side by side, 3 or 4 make a 2x2 grid, and 5 to 9 make a 3x3 grid. Each tile is labelled with its stream and camera name.
Tiles use the low copy when a camera has one. Click a tile to show that camera alone, at full quality when the panel is wide. “All cameras” or Escape goes back to the wall. In live mode every tile follows the live picture. When the panel is synced to the cursor or a recording, all tiles show the same instant.
Recordings
A camera declared record is recorded by its sender with its stream, which must be declared record too: its files are cut together with the data stream’s (each starts at a keyframe), buffered on the sender’s disk and uploaded like the data (see Recording). Only the full-quality video is recorded, not the low copy.
- The camera recordings belong to the stream’s recording. They are moved to the trash, restored and expired together with it.
- The recordings list shows “N cameras” on a recording that has video.
- Opening a recording brings its cameras. A Camera panel on a worksheet that shows the recording plays the recorded video at the chart cursor, or at the end of the X range, or at the start of the recording. The overlay says “Recording” instead of live, with the Exact or Approx. badge.
- The video is downloaded in pieces as you seek, not all at once.
- CSV and MF4 exports do not include video.
- Camera video counts toward your plan's video storage and days, apart from the data's. When it is full, the camera stops recording and stays live, unless its stream has When full, delete oldest on.
Usage
Preferences → Usage shows this month's video hours and the video stored, next to your other limits (see Limits and usage). Organization owners and admins also see a video report on the Billing tab (cameras, viewer-hours, recorded), updated hourly. When the month's video hours run out, Camera panels say “Video limit reached this month”.