Skip to main content

Python RTSP client built on libcurl (pycurl)

Project description

rtsp-curl

PyPI version Python License CI

Python RTSP client built on libcurl via pycurl. Supports OPTIONS / DESCRIBE / SETUP / PLAY / TEARDOWN over UDP (default) or TCP.


Requirements

  • Python 3.9+
  • libcurl with RTSP support (curl --version | grep rtsp)
  • pycurl >= 7.45.0

Installation

pip install rtsp-curl-mad

macOS (custom OpenSSL required by pycurl):

PYCURL_SSL_LIBRARY=openssl \
  LDFLAGS="-L/usr/local/opt/openssl/lib" \
  CPPFLAGS="-I/usr/local/opt/openssl/include" \
  pip install --no-cache-dir pycurl

pip install rtsp-curl-mad

Quick start

import time
from madyel import RtspCurl

URL = "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"

client = RtspCurl()
client.init(URL, "user:password")

client.rtsp_options()
client.auth()
client.rtsp_describe()

control = client.get_media_control_attribute()
client.rtsp_setup(control)
client.rtsp_play(URL)

time.sleep(10)          # stream for 10 seconds

client.rtsp_teardown()
client.rtsp_curl_close()

API reference

RtspCurl(*, debug=False, tcp=False)

Parameter Type Default Description
debug bool False Enable verbose curl logging
tcp bool False Use TCP transport instead of UDP

Methods

Method Description
init(url, user_pwd) Initialise the curl handle. Must be called first. user_pwd format: "user:password"
rtsp_options() Send RTSP OPTIONS
auth() Perform DIGEST authentication
rtsp_describe() Send RTSP DESCRIBE and save the SDP response to disk
get_media_control_attribute() Parse the SDP and return the first media-level a=control value
rtsp_setup(control) Send RTSP SETUP for the given track control URI
rtsp_play(url) Send RTSP PLAY
rtsp_teardown() Send RTSP TEARDOWN
rtsp_curl_close() Close the underlying curl handle

Storage

Helper that accumulates pycurl callback data line by line.

from madyel import Storage

buf = Storage()
# pass buf.store as pycurl WRITEFUNCTION / HEADERFUNCTION
print(buf)   # all accumulated lines

Options

Debug mode — enables pycurl.VERBOSE (full headers and timing on stderr):

client = RtspCurl(debug=True)

TCP transport — by default the client negotiates RTP over UDP:

client = RtspCurl(tcp=True)

Publishing a new release

Tag the commit — GitHub Actions builds and uploads to PyPI automatically:

git tag v0.9.1
git push origin v0.9.1

One-time setup: configure the PyPI Trusted Publisher at https://pypi.org/manage/project/rtsp-curl-mad/settings/publishing/


License

MIT

Project details


Download files

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

Source Distribution

rtsp_curl_mad-0.9.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

rtsp_curl_mad-0.9.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file rtsp_curl_mad-0.9.0.tar.gz.

File metadata

  • Download URL: rtsp_curl_mad-0.9.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rtsp_curl_mad-0.9.0.tar.gz
Algorithm Hash digest
SHA256 d67804af22a19f326106f2a787d1715ace09d6f4f8633bd7aabb9dd0f8859bc9
MD5 b4de0dd8410e2efd7661c5fee0d0bb39
BLAKE2b-256 22996fd2d1a828009f88e6a59b82d87a30dd005b91ad4f72b0af76e49de342ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for rtsp_curl_mad-0.9.0.tar.gz:

Publisher: publish.yml on madyel/rtsp-curl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rtsp_curl_mad-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: rtsp_curl_mad-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rtsp_curl_mad-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 572dcea278ea14d9a6737dc4f6c84b13d95246aca6cf66b4b127f9f8f8f171f4
MD5 fcf49cf2993aa55d0aab641502002d7e
BLAKE2b-256 f753b1a6bb82c34b3e8d79954b179b7bd6434aefe134d42476deed885f96e8db

See more details on using hashes here.

Provenance

The following attestation bundles were made for rtsp_curl_mad-0.9.0-py3-none-any.whl:

Publisher: publish.yml on madyel/rtsp-curl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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