# Zephyr
Zephyr is a simple RTSP library to stream and receive video over RTSP.
## Pre-requisites
- Python 3.8 or higher
- [FFmpeg](https://ffmpeg.org/) to encode and decode video
- [MediaMTX](https://github.com/bluenviron/mediamtx) as RTSP server
## Installation
The easiest way to install Zephyr is using pip:
```bash
$ pip install zephyr-rtsp
```
But you can also install Zephyr from source:
```bash
$ 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.
```python
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.
```python
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](LICENSE).
## Credits
- Zephyr uses [FFmpeg](https://ffmpeg.org/) to encode and decode video.
- The name Zephyr is inspired by [Zephyr](https://github.com/octavvia/zephyr) a video streaming project by [Octavia](https://github.com/octavvia).
Raw data
{
"_id": null,
"home_page": "https://github.com/bpradana/zephyr",
"name": "zephyr-rtsp",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,rtsp,streaming,video",
"author": "Bintang Pradana Erlangga Putra",
"author_email": "<work.bpradana@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/12/2a/e32605e5d869d2bc0a6d9333b942c6a39383f479f9d2fb902b22d71b3dc1/zephyr-rtsp-0.0.6.tar.gz",
"platform": null,
"description": "# Zephyr\nZephyr is a simple RTSP library to stream and receive video over RTSP.\n\n## Pre-requisites\n- Python 3.8 or higher\n- [FFmpeg](https://ffmpeg.org/) to encode and decode video\n- [MediaMTX](https://github.com/bluenviron/mediamtx) as RTSP server\n\n## Installation\nThe easiest way to install Zephyr is using pip:\n```bash\n$ pip install zephyr-rtsp\n```\nBut you can also install Zephyr from source:\n```bash\n$ git clone https://github.com/bpradana/zephyr.git\n$ cd zephyr\n$ python setup.py install\n```\n\n## Usage\nZephyr 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.\n### Stream\nTo stream video, you need to create a `Stream` object and call `send` with a frame. You can also call `end` to stop the stream.\n```python\nimport cv2\nfrom zephyr import Stream\n\nif __name__ == \"__main__\":\n stream = Stream(\n url=\"rtsp://localhost:8554/test\",\n resolution=(1280, 720),\n fps=30,\n bitrate=\"2M\"\n )\n\n cap = cv2.VideoCapture(0)\n while True:\n ret, frame = cap.read()\n stream.send(frame)\n```\n### Client\nTo 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.\n```python\nimport cv2\nfrom zephyr import Client\n\nif __name__ == \"__main__\":\n client = Client(url=\"rtsp://localhost:8554/test\")\n\n while True:\n ret, frame = client.read()\n cv2.imshow('frame', frame)\n\n if cv2.waitKey(1) & 0xFF == ord(\"q\"):\n client.release()\n break\n```\n\n## License\nZephyr is licensed under the [MIT License](LICENSE).\n\n## Credits\n- Zephyr uses [FFmpeg](https://ffmpeg.org/) to encode and decode video.\n- The name Zephyr is inspired by [Zephyr](https://github.com/octavvia/zephyr) a video streaming project by [Octavia](https://github.com/octavvia).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python library for streaming video over RTSP",
"version": "0.0.6",
"project_urls": {
"Homepage": "https://github.com/bpradana/zephyr"
},
"split_keywords": [
"python",
"rtsp",
"streaming",
"video"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a41b00e8c3d498357a3cd8a845d5371e93813840c7769f0dcc85f1c5f571ad8a",
"md5": "72c65f04f02417360f193aafe9d62e70",
"sha256": "912bbae4d08f3048b9567cb8460e81b97e4f0d53ff1073e457913dc739404ab8"
},
"downloads": -1,
"filename": "zephyr_rtsp-0.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "72c65f04f02417360f193aafe9d62e70",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10463,
"upload_time": "2023-12-14T06:36:01",
"upload_time_iso_8601": "2023-12-14T06:36:01.648736Z",
"url": "https://files.pythonhosted.org/packages/a4/1b/00e8c3d498357a3cd8a845d5371e93813840c7769f0dcc85f1c5f571ad8a/zephyr_rtsp-0.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "122ae32605e5d869d2bc0a6d9333b942c6a39383f479f9d2fb902b22d71b3dc1",
"md5": "2dec1814a01747f45e94f4fce3fdef3f",
"sha256": "82680696b608764f0d1a10830494c1b7d33ef8453602b27049bc19bc7ed26601"
},
"downloads": -1,
"filename": "zephyr-rtsp-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "2dec1814a01747f45e94f4fce3fdef3f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8199,
"upload_time": "2023-12-14T06:36:03",
"upload_time_iso_8601": "2023-12-14T06:36:03.423096Z",
"url": "https://files.pythonhosted.org/packages/12/2a/e32605e5d869d2bc0a6d9333b942c6a39383f479f9d2fb902b22d71b3dc1/zephyr-rtsp-0.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-14 06:36:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bpradana",
"github_project": "zephyr",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "zephyr-rtsp"
}