Skip to main content

Python bindings for the RTSP server library — publish live encoded video over RTSP from Python.

Project description

rtsp-rs

Lint Test Release

A Rust library for publishing live encoded video over RTSP. Push frames and play the stream with any standard client (VLC, ffplay, GStreamer).

Usable from Rust, Python, or GStreamer.


⚠️ Please read before using

This is a personal, hobby project I built to learn about RTP, RTSP, and streaming. I’m actively evolving it and use it only for my own projects. I have no plans to use or support it in production right now, though I might rely on it there someday if the need arises — so treat it as use at your own risk.

Some of the tests, examples, and documentation in this repo were generated or assisted by AI tools. Treat them as reference material rather than guarantees of correctness.


Status: Pre-release (v0.x). API may change between versions.

Project structure

crates/
├── core/        # rtsp-rs (crates.io) — core library, use rtsp:: in Rust
├── python/      # rtsp-python  — PyO3 bindings → PyPI package rtsp-rs
└── gst/         # gst-rtsp-sink — GStreamer sink plugin

examples/
└── python/      # Python demo (numpy + PyAV)

Quick start

Rust

Add to Cargo.toml: rtsp = { package = "rtsp-rs", version = "0.1" } (the crate is published as rtsp-rs on crates.io; the library is still rtsp in code).

use rtsp::Server;

let mut server = Server::new("0.0.0.0:8554");
server.start().unwrap();

// Push H.264 Annex B frames — packetization and delivery are handled internally.
// Timestamp increment = 90000 / fps (e.g. 3000 for 30 fps).
// server.send_frame(&h264_data, 3000).unwrap();

Python

pip install maturin
maturin develop -m crates/python/Cargo.toml
import rtsp

server = rtsp.Server("0.0.0.0:8554")
server.start()

# Push encoded H.264 frames directly — no manual packetization needed.
server.send_frame(h264_bytes, 3000)

See examples/python/test.py for a full demo that encodes a test pattern with PyAV.

GStreamer

Build and install the plugin:

cargo build -p gst-rtsp-sink --release

# Point GStreamer at the built library
export GST_PLUGIN_PATH=$PWD/target/release

Stream a test pattern:

gst-launch-1.0 videotestsrc \
  ! video/x-raw,width=640,height=480,framerate=30/1 \
  ! x264enc tune=zerolatency bitrate=2000 key-int-max=30 \
  ! video/x-h264,stream-format=byte-stream \
  ! rtspserversink port=8554

Stream from a webcam (macOS):

gst-launch-1.0 avfvideosrc \
  ! videoconvert \
  ! x264enc tune=zerolatency bitrate=2000 \
  ! video/x-h264,stream-format=byte-stream \
  ! rtspserversink port=8554

Stream from a webcam (Linux):

gst-launch-1.0 v4l2src device=/dev/video0 \
  ! videoconvert \
  ! x264enc tune=zerolatency bitrate=2000 \
  ! video/x-h264,stream-format=byte-stream \
  ! rtspserversink port=8554

Stream from a file:

gst-launch-1.0 filesrc location=video.mp4 \
  ! qtdemux ! h264parse \
  ! video/x-h264,stream-format=byte-stream \
  ! rtspserversink port=8554

Then connect with any RTSP client:

ffplay rtsp://localhost:8554/stream
vlc rtsp://localhost:8554/stream

Building

Requires Rust 1.92+ (latest stable). The GStreamer plugin requires libunwind-dev and libgstreamer1.0-dev (Ubuntu/Debian: sudo apt install libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev).

cargo build -p rtsp-rs             # Core library
cargo build -p gst-rtsp-sink       # GStreamer plugin
cargo build -p rtsp-python         # Python bindings (needs maturin)
cargo test  --workspace            # All tests
cargo clippy --workspace           # Lint

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rtsp_rs-0.1.5-cp314-cp314-win_amd64.whl (232.8 kB view details)

Uploaded CPython 3.14Windows x86-64

rtsp_rs-0.1.5-cp314-cp314-manylinux_2_34_x86_64.whl (403.8 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

rtsp_rs-0.1.5-cp314-cp314-macosx_11_0_arm64.whl (354.7 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

rtsp_rs-0.1.5-cp313-cp313-win_amd64.whl (232.5 kB view details)

Uploaded CPython 3.13Windows x86-64

rtsp_rs-0.1.5-cp313-cp313-manylinux_2_34_x86_64.whl (403.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

rtsp_rs-0.1.5-cp313-cp313-macosx_11_0_arm64.whl (354.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rtsp_rs-0.1.5-cp312-cp312-win_amd64.whl (232.4 kB view details)

Uploaded CPython 3.12Windows x86-64

rtsp_rs-0.1.5-cp312-cp312-manylinux_2_34_x86_64.whl (403.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

rtsp_rs-0.1.5-cp312-cp312-macosx_11_0_arm64.whl (354.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rtsp_rs-0.1.5-cp311-cp311-win_amd64.whl (234.3 kB view details)

Uploaded CPython 3.11Windows x86-64

rtsp_rs-0.1.5-cp311-cp311-manylinux_2_34_x86_64.whl (406.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

rtsp_rs-0.1.5-cp311-cp311-macosx_11_0_arm64.whl (356.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rtsp_rs-0.1.5-cp310-cp310-win_amd64.whl (234.3 kB view details)

Uploaded CPython 3.10Windows x86-64

rtsp_rs-0.1.5-cp310-cp310-manylinux_2_34_x86_64.whl (407.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

rtsp_rs-0.1.5-cp310-cp310-macosx_11_0_arm64.whl (356.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file rtsp_rs-0.1.5-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: rtsp_rs-0.1.5-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 232.8 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for rtsp_rs-0.1.5-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 1a9a7d1c566c6bb596104592c52efb1fea5f6bd7216b1a99b92f5f2760376361
MD5 df63ffbd77386d87350fece5deae8b35
BLAKE2b-256 dbd5bbd0a6fb65940d01f8c3e6d0910cc9ac9dd00bb983ab09b6c4fd939e8cfc

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rtsp_rs-0.1.5-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 478ea28e36474417ae7712cffe06c6d047a90b445e2409b935a914a6436a3fea
MD5 e4958a7c62af474044031369212fa444
BLAKE2b-256 a5c4e0d45fc959df1b4205491c7a7c69dd5faae4fa299fcbbeeade26f08fa1ce

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rtsp_rs-0.1.5-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4f73abc19fd9000961b3c6d1fcdd5591c0339cde6751cf5f0df470df3adfd654
MD5 6fb6ebd7c3590cddc7231da4a60b50fc
BLAKE2b-256 40df622d954452a0801434d99854b6d03dedebf4097c878cb2c107d534af263e

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rtsp_rs-0.1.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 232.5 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for rtsp_rs-0.1.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6bd6beafb7df6a1797f77ed924117c411344f718956d1961862833f686b8b827
MD5 06ecbf5833d4ea8f0b6843409866ea05
BLAKE2b-256 852a2a232872a71f3701a357a72a2dc5ff28983a462227d9b707d3e8af0e9b9f

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rtsp_rs-0.1.5-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 62ea1a42a23e7b20cd7313ecc5f978984ce4f9cf91870e97c13112f51415ea78
MD5 91ca601f8d78c6c06c267cc3daf4fea0
BLAKE2b-256 6f2b02ea3cc6699ab4543ea48beaa46048b2dcfd4c9ff962c0d4c8fca1dee9a5

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rtsp_rs-0.1.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 745997799582f5f111b8c4180f15c28929cdaf1ab597db4b953f756765a91eb2
MD5 a2defbb512187d48863e6234f6a4c6cb
BLAKE2b-256 90d4967319b2d6dc3cc7168f0ca5304f46145d7385a408c503c54b865ad8ca67

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: rtsp_rs-0.1.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 232.4 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for rtsp_rs-0.1.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bca28ca9b3c053b9e524c46b6814288dbce49b28cc34575d433f5ef6163fae33
MD5 21ec04490014d01a03bdff25da54595d
BLAKE2b-256 3d9c3beb7e1d357fc1ecc96d645cbac25fef7019f241e9aad13b47852512e167

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rtsp_rs-0.1.5-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 beed64f9ee2c9744596108efbfae2dd1be86dbeddf0eaded2c3692ac1f6c2594
MD5 8f1858fcdc96d0cfcd7ff6b52dfec982
BLAKE2b-256 1e265e9efba71f32d19c95a295bc899e2950db2177d336c2252af883ebcfc867

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rtsp_rs-0.1.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b106ec96692c6a1981ed4b10c91a257d3ec4b9089f127f6f8f693c429c791000
MD5 dfcc14772c3465fa51bb32b62527781d
BLAKE2b-256 701336efc38b116a40575f496a8393b31a28ba31b7939f9a13f82d8b15982f81

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: rtsp_rs-0.1.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 234.3 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for rtsp_rs-0.1.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 40e55731e84c84b1ad53f48aca053a4b14832797561a2abdf69272411362b362
MD5 b4c2e906bf0b0db60504667f5a0ea2b8
BLAKE2b-256 3644e71c590b79f1226b5574f60b448601b5198ef4f06f9cb50de574ccbe5bd3

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rtsp_rs-0.1.5-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3fde8c8476875aba1e84334d15609e65a09fc61a618b98800a1d6a1140b403ac
MD5 b611d2d739a7e9ee54895a1ff2cc8991
BLAKE2b-256 a2aab5e640d2794530719e91f57c616b1ac2abc0f4e52936a26d173ecc4f2a67

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rtsp_rs-0.1.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5dd8bc77abd45dc4a1128cd3bedc88a1f9751a712e9817e4d0c413c95aae8954
MD5 9496ebcb3042b6562887a6fac8238473
BLAKE2b-256 f0c1f53c2ff12f8086e92ca1d25c8bb074b9e1dc96e4d42b2e4fd238e186447a

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: rtsp_rs-0.1.5-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 234.3 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for rtsp_rs-0.1.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7e305ac76e3f9480cb066bc270876e857336fb986c008ea671d5cd6a606b983c
MD5 1588c7e49f898f81435ef15fc46e994c
BLAKE2b-256 b682f53d6201103fef0e0ce6e4d2aa3d82207accf3699d99bb25804abb46cb66

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rtsp_rs-0.1.5-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4797bcdc30b91ca29e5e50c2e5b0e4403bdaedb9717dd11087bd9fff4d5cbde3
MD5 ef99a05946d0d8a05f8a26a5f8b5722e
BLAKE2b-256 2c649058ff5726e3563876e6a2145fb6bb8d13ca65a8359cc4f4549540d251cc

See more details on using hashes here.

File details

Details for the file rtsp_rs-0.1.5-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rtsp_rs-0.1.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5b330147125523c8242f31f765beddc4eda5aad455039e6b014fb7b3e9bcc3aa
MD5 7c49010fe400d76631666e02a78d1a3e
BLAKE2b-256 6316dccf5681ee3008415391167990ee055013db780e23c9b4cfbe53f8e76978

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page