Skip to main content

kymoscope

Stream live, end-to-end encrypted telemetry to Kymoscope from Python.

Requires Python 3.9 or later.

pip install kymoscope

Example

import math, time
from kymoscope import LiveStream

API_KEY = "kymoscope_..."   # Account -> API & real-time streaming, or a project's API key
# state_path keeps this sender's identity, so a restart needs no new approval
with LiveStream(API_KEY, "Rig A", state_path="kymoscope-state.json") as stream:
    print("stream id:", stream.stream_id)
    while True:
        t = time.time()           # absolute (Unix seconds)
        stream.send([{"t": t, "signals": [
            {"name": "speed", "unit": "m/s", "value": 50 + 10 * math.sin(t)},
        ]}])
        time.sleep(1 / 60)

In an end-to-end encrypted project, the first run waits until a project member's browser approves the sender; after that it publishes on its own. LiveStream.project_key gives a collector the current project key so it can seal keys of its own (day history); never log or persist it.

Keep every sample when the connection drops

with LiveStream(API_KEY, "Rig A", state_path="kymoscope-state.json",
                buffer_path="kymoscope-buffer", buffer_max_mb=2048) as stream:
    ...

With buffer_path (a folder), a cloud recording keeps everything through an outage. Like any stream, it sends only while someone watches or a cloud recording is on (the recording counts as a viewer; stream.watched says so). When the relay becomes unreachable while it is watched or recording, it keeps the encrypted messages on disk, then sends them in order when the relay is back, with the bandwidth live data leaves spare, while someone watches or records (until then it waits on disk); with nobody watching when the relay becomes unreachable it keeps nothing. Viewers see that data in the recording, not in the live view. A crash can send a few messages twice. buffer_max_mb caps the disk used; when it is full, new samples are dropped and counted in stream.buffer_dropped. buffer_min_free_mb (default 0, off) also stops buffering when the disk has less free space than that. Since 0.3.0 the stream sends the compact format by default (4–8× less data); block_format=False sends the classic format for viewers on SDK versions before 0.2.0 or self-hosted relays before 0.2.0 (buffer_path always uses the compact one). With buffer_path, send absolute times (time.time()), so data sent after a restart lands in the right place in the recording.

Cameras

A camera is a channel of a stream: whoever opens the stream sees its cameras. It needs ffmpeg on PATH.

with LiveStream(API_KEY, "Rig A", state_path="kymoscope-state.json") as stream:
    stream.add_camera("Front", "video=Integrated Camera", input_format="dshow")   # a webcam on Windows
    stream.add_camera("Bay", "/dev/video0", input_format="v4l2", size="1280x720") # a webcam on Linux
    stream.add_camera("Door", "rtsp://user:pass@10.0.0.7/stream1", copy=True)     # an H.264 IP camera, as is
    stream.add_camera("Test", "testsrc=size=1280x720:rate=30", input_format="lavfi")  # a test pattern
    while True:
        stream.send(...)    # keep sending (or call stream.tick()): the cameras heartbeat with the stream

ffmpeg re-encodes to H.264 (fps 30, kbps 2000 by default, a keyframe every 2 s) unless copy=True. Video goes out only while someone watches the camera; a new viewer starts at the next keyframe. Use the same API key for the cameras as for their stream; in an encrypted project they need no extra approval.

low=True also publishes a 360p copy (640x360 for 16:9, 15 fps, 400 kbit/s, a keyframe every 2 s) as the camera's low layer. Viewers play it in small panels and camera walls, and switch to full quality when a camera is enlarged; it also suits viewers on slow links. It goes out only while someone watches it, isn't recorded, and doesn't count as a camera of your plan.

stream.add_camera("Bay", "/dev/video0", input_format="v4l2", low=True)
stream.add_camera("Door", "rtsp://user:pass@10.0.0.7/stream1", copy=True, low=True)

One ffmpeg writes both layers. With copy=True the full layer is still forwarded as is; only the low layer is decoded and encoded, which costs the CPU of one 360p libx264 encode (plus decoding the camera's stream). On Windows a second ffmpeg encodes the low layer and opens the input again: fine for an IP camera or a file, but a webcam (dshow) can't be opened twice, so low=True with input_format="dshow" raises an error; run that sender on Linux or macOS, or use an IP camera.

Credentials in a camera URL (rtsp://user:pass@host/...) are passed to ffmpeg on its 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, ffmpeg's own error lines included. Give the sender a camera account that can only view the stream, and run it on a machine (or under an account) nobody else uses.

The headless viewer (kymoscope.viewer) needs msgpack: pip install 'kymoscope[viewer]'.

Full documentation: https://kymoscope.com/docs/live

Metadata

Release files for kymoscope 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kymoscope 0.8.1
File Size Uploaded Provenance Actions
kymoscope-0.8.1.tar.gz 81.3 kB With provenance Details for kymoscope-0.8.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kymoscope 0.8.1
File Interpreter ABI Platform Actions
kymoscope-0.8.1-py3-none-any.whl Python 3 none any Details for kymoscope-0.8.1-py3-none-any.whl

Total release size: 132.0 kB

Release files / kymoscope-0.8.1.tar.gz

Download URL kymoscope-0.8.1.tar.gz
Size 81.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e10811631b296ba3a6a866a8e688f60e8fb8a9214d32e1445287fc93ed14adee
BLAKE2b-256 checksum
How to use checksums
a516c3fd4d6b9c207427dc4b3aac0e56d80a21791ac15f67ce56c6c4febfaac2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / kymoscope-0.8.1-py3-none-any.whl

Download URL kymoscope-0.8.1-py3-none-any.whl
Size 50.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7efedc741b00705989421ae2110f8455cc1250d071c9b546781877b89fa6cc77
BLAKE2b-256 checksum
How to use checksums
9c39fb8855f38b9c245fee4ea4627db9f680c9b1247d06e868ff1c043bdeed47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for kymoscope 0.8.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kymoscope-0.8.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.8.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page