Skip to main content

RTSP client wrapper around gstreamer/opencv

Project description

RTSP Package

        /((((((\\\\
=======((((((((((\\\\\
     ((           \\\\\\\
     ( (*    _/      \\\\\\\
       \    /  \      \\\\\\________________
        |  |   |      </    __             ((\\\\
        o_|   /        ____/ / _______       \ \\\\    \\\\\\\
             |  ._    / __/ __(_-</ _ \       \ \\\\\\\\\\\\\\\\
             | /     /_/  \__/___/ .__/       /    \\\\\\\     \\
     .______/\/     /           /_/           /         \\\
    / __.____/    _/         ________(       /\
   / / / ________/`---------'         \     /  \_
  / /  \ \                             \   \ \_  \
 ( <    \ \                             >  /    \ \
  \/      \\_                          / /       > )
           \_|                        / /       / /
                                    _//       _//
                                   /_|       /_|

Convenience-wrapper around OpenCV-Python RTSP functions.

Features

  • read most-recent RTSP frame as Pillow Image on demand
  • preview stream in OpenCV. 'q' to quit preview.
  • URI shortcuts for rapid prototyping
    • integers load a USB or webcam from starting with interface 0 via OpenCV, e.g. rtsp.Client(0)
    • 'picam' uses a Raspberry Pi camera as source e.g. rtsp.Client('picam')

Examples

Use RTSP access credentials in your connection string e.g.

RTSP_URL = f"rtsp://{USERNAME}:{PASSWORD}@192.168.1.221:554/11"

One-off Retrieval

import rtsp
client = rtsp.Client(rtsp_server_uri = 'rtsp://...', verbose=True)
client.read().show()
client.close()

Stream Preview

import rtsp
with rtsp.Client(0) as client: # previews USB webcam 0
    client.preview()

Continuous Retrieval

import rtsp

with rtsp.Client(rtsp_server_uri = 'rtsp://...') as client:
    _image = client.read()

    while True:
        process_image(_image)
        _image = client.read(raw=True)

Roadmap:

I don't plan to develop this module any further, as more complex applications are better suited to use OpenCV, Gstreamer, or ffmpeg directly.

To do:

  • might improve parsing for RTSP server URIs

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-1.1.11.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

rtsp-1.1.11-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file rtsp-1.1.11.tar.gz.

File metadata

  • Download URL: rtsp-1.1.11.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.7

File hashes

Hashes for rtsp-1.1.11.tar.gz
Algorithm Hash digest
SHA256 3c69b3733f2084c21781b308c89ca0f1117c762800f847e6df25d4a55570f1ab
MD5 fced3f3cadf7d25380a3e5827de8b1cd
BLAKE2b-256 83329e9c5a1eb84b215208f2309737aff9b5a556d037de98f7a038ca7d2b7211

See more details on using hashes here.

File details

Details for the file rtsp-1.1.11-py3-none-any.whl.

File metadata

  • Download URL: rtsp-1.1.11-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.7

File hashes

Hashes for rtsp-1.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 8b9c86c9a03cdea51593c927b75ae8625c25d3e97c68c796918cbcd063dd75a8
MD5 350501bdffb222ffc8853dc51f09a36b
BLAKE2b-256 43444f3366eca8b43a14862927b7c7b45f1ed0c2bac68ab4a3272b2d4c605764

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