Skip to main content

A Python library for streaming video over RTSP

Project description

Zephyr

Zephyr is a simple RTSP library to stream and receive video over RTSP.

Pre-requisites

  • Python 3.8 or higher
  • FFmpeg to encode and decode video
  • MediaMTX as RTSP server

Installation

The easiest way to install Zephyr is using pip:

$ pip install zephyr-rtsp

But you can also install Zephyr from source:

$ git clone https://github.com/bpradana/zephyr.git
$ cd zephyr
$ python setup.py install

Usage

Zephyr has 2 main classes, Stream and Client. Stream is used to stream video over RTSP, while Client is used to receive video from RTSP stream.

Stream

To stream video, you need to create a Stream object and call send with a frame. You can also call end to stop the stream.

import cv2
from zephyr import Stream

if __name__ == "__main__":
  stream = Stream(
    url="rtsp://localhost:8554/test",
    resolution=(1280, 720),
    fps=30,
    bitrate="2M"
  )

  cap = cv2.VideoCapture(0)
  while True:
    ret, frame = cap.read()
    stream.send(frame)

Client

To receive video, you need to create a Client object and call read to get the frame. You can also call release to stop receiving video.

import cv2
from zephyr import Client

if __name__ == "__main__":
  client = Client(url="rtsp://localhost:8554/test")

  while True:
    ret, frame = client.read()
    cv2.imshow('frame', frame)

    if cv2.waitKey(1) & 0xFF == ord("q"):
      client.release()
      break

License

Zephyr is licensed under the MIT License.

Credits

  • Zephyr uses FFmpeg to encode and decode video.
  • The name Zephyr is inspired by Zephyr a video streaming project by Octavia.

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

zephyr-rtsp-0.0.6.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

zephyr_rtsp-0.0.6-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file zephyr-rtsp-0.0.6.tar.gz.

File metadata

  • Download URL: zephyr-rtsp-0.0.6.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for zephyr-rtsp-0.0.6.tar.gz
Algorithm Hash digest
SHA256 82680696b608764f0d1a10830494c1b7d33ef8453602b27049bc19bc7ed26601
MD5 2dec1814a01747f45e94f4fce3fdef3f
BLAKE2b-256 122ae32605e5d869d2bc0a6d9333b942c6a39383f479f9d2fb902b22d71b3dc1

See more details on using hashes here.

File details

Details for the file zephyr_rtsp-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: zephyr_rtsp-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for zephyr_rtsp-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 912bbae4d08f3048b9567cb8460e81b97e4f0d53ff1073e457913dc739404ab8
MD5 72c65f04f02417360f193aafe9d62e70
BLAKE2b-256 a41b00e8c3d498357a3cd8a845d5371e93813840c7769f0dcc85f1c5f571ad8a

See more details on using hashes here.

Supported by

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