pyst2110
SMPTE ST 2110 protocol for Python: RTP and RFC 4175 headers read and written, frame boundaries, sequence-loss accounting, pgroup geometry, and SDP.
REQUIREMENTS.md — the problem. SPEC.md — the design and its rationale. ROADMAP.md — what is not built yet.
| Layer | Owns |
|---|---|
| A transport binding (a NIC binding, a socket, a capture file) | Moving bytes |
| pyst2110 | RTP + RFC 4175 headers, geometry, SDP, ST 2110-21 timing |
| The consuming runtime | Pixels — packing, unpacking, colour |
The layer between a transport and a raster: it says what packet headers mean and where their payloads belong, and never moves a pixel itself. numpy is the only runtime dependency — no vendor SDK, no transport binding, no NIC and no licence, so it runs anywhere CI does.
Install
From PyPI:
uv add pyst2110
Usage
from pyst2110 import parse_sdp, parse_video_format
offer = open("flow.sdp").read()
flow = parse_sdp(offer) # destination address, port, source filter
video = parse_video_format(offer) # width, height, rate, sampling, depth
Parsing is vectorized over whole chunks: every function takes a
two-dimensional uint8 array, one row per packet, and returns one array
per field — the shape a header-data-split receiver already hands out.
Header fields are reported as the wire declared them, this being a parse
and not a filter. A packet is free to name a row outside the image, so
fits_raster masks the descriptors that name a place inside the flow's
raster and a consumer places only those:
fits = fits_raster(video, payload.line, payload.offset_samples)
starts = raster_offset(video, payload.line[fits], payload.offset_samples[fits])
Sending is the same shape in reverse. A frame's headers are built once for a format and payload size, then stamped per frame with the only two fields that move — the sequence numbers and the media timestamp:
from pyst2110 import FrameHeaders, choose_payload_size, format_sdp, max_payload_size
payload_size = choose_payload_size(video, max_payload_size(video))
frame = FrameHeaders(video, payload_size, ssrc=0x1234ABCD)
for index in range(frames):
headers = frame.stamp(index) # (packets, 20) uint8, one row per packet
... # send each header with frame.frame_offset_octets
offer = format_sdp(flow, video, session_name="my sender") # what was sent
The offer carries the media type parameters ST 2110-20 section 7.2 and
ST 2110-21 section 8.1 require of a sender. TP describes the pacing,
which is the transport's and not this library's, so sender_type= is
the caller's to set — it defaults to 2110TPN. A multicast flow names
its sender or passes any_source=True; see §spec:sdp for why that is a
choice rather than a default.
An ST 2022-7 redundant pair is one offer and not two. format_dup_sdp
writes RFC 7104's grouping — a session-level a=group:DUP over two
m=video blocks, each with its own address and sender — and
parse_dup_sdp reads both legs back, in the order the group names them:
from pyst2110 import format_dup_sdp, parse_dup_sdp
offer = format_dup_sdp(red, blue, video, session_name="my sender")
first, second = parse_dup_sdp(offer)
A document whose DUP tags and media blocks disagree is refused rather
than read as a single-leg offer, and parse_sdp refuses a grouped offer
for the same reason: a sender that emitted one leg where two were meant
sends unprotected essence and reports success.
One essence over several flows is one offer too. SMPTE RP 2110-23 carries
a picture as four or sixteen ST 2110-20 flows, each a sub-image, grouped
by a=group:MULTI-2SI (two-sample interleave) or a=group:MULTI-SD
(square division). format_group_sdp writes the group from the
constituent flows and their shared sub-image format, and
parse_group_sdp reads it back:
from pyst2110 import format_group_sdp, parse_group_sdp, to_essence
offer = format_group_sdp(flows, sub_image, session_name="my sender")
group = parse_group_sdp(offer) # division, flows in order, sub-image format
raster = {
"width": group.essence_width,
"height": group.essence_height,
"division": group.division,
"count": len(group.flows),
}
x, y = to_essence(2, columns, row, **raster) # where constituent 2's pixels sit
parse_sdp and parse_video_format refuse a group document and name
parse_group_sdp, because a constituent read alone is a quarter of the
picture. pyst2110.division maps essence pixels to constituent pixels
and back, closed form over coordinate arrays, and its split and
reassemble are the reference move an accelerated gather is checked
against. The temporal PHASED division and ST 2022-7 over a group are
refused by name.
session_name defaults to the single space RFC 4566 section 5.3 prescribes
for a session with no meaningful name — and at least one transmit SDK refuses
it, so name the session where a sender will read the offer back. NVIDIA
Rivermax reports 'x=<token>' format not found and fails stream creation,
accepting the same document once it is named.
frame_offset_octets says which octets of the frame buffer each packet
carries. Moving them is the consumer's, as on the receive side.
stamp hands back the same array every time, restamped in place — that
is what keeps the loop above from allocating a frame of headers per
frame. So headers is only valid until the next stamp: a caller
queueing two frames at once copies the first.
API
Everything is re-exported from the top-level package, and the
docstrings there are the authority; help(pyst2110) is the index.
Both paths are built: SDP parsing and emit — the single-leg offer, the ST 2022-7 pair and the RP 2110-23 group — the RP 2110-23 division mapping, the RFC 3550 header parse, format geometry, sequence and frame tracking, RFC 4175 payload descriptors, the transmit header block, the ST 2022-7 reconstruction of one flow from two legs, and the ST 2110-21 timing model — read schedules, sender limits, and the two leaky buckets that judge a capture's emission instants. What is not built is listed in ROADMAP.md.
Development
uv sync
bash tools/ci.sh
tools/ci.sh is the gate CI runs — ruff, mypy, pytest.
License
MIT — see LICENSE. The standards this implements are public and an implementation of them should be too.
Metadata
Release files for pyst2110 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyst2110-0.10.0.tar.gz | 164.9 kB | With provenance | Details for pyst2110-0.10.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyst2110-0.10.0-py3-none-any.whl | Python 3 | none | any | Details for pyst2110-0.10.0-py3-none-any.whl |
Total release size: 237.4 kB
Release files / pyst2110-0.10.0.tar.gz
| Download URL | pyst2110-0.10.0.tar.gz |
|---|---|
| Size | 164.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d449a07125789fdfdbccb43c3b14363b2c2963394c8488910c7ae4ebfbfd490c
|
|
BLAKE2b-256 checksum How to use checksums |
4eb550621dcd9d21d09dc8cc6855a5462969f8559bfa8c2ff2dc39c54b299154
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 14, 2026.
Transparency logRelease files / pyst2110-0.10.0-py3-none-any.whl
| Download URL | pyst2110-0.10.0-py3-none-any.whl |
|---|---|
| Size | 72.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28c84423dd24a558f47f431723f91c3d5009d2514600ac6d834bb1e30905b68e
|
|
BLAKE2b-256 checksum How to use checksums |
a04bf304e090cba557ba6a79a1dc0e840e80e31ff6a134ec23a3b36cfd646580
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 14, 2026.
Transparency logSecurity for pyst2110 0.10.0
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.
Attestation for pyst2110-0.10.0.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 14, 2026.
Transparency logA 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.