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.10.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.10-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rtsp-1.1.10.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.10.tar.gz
Algorithm Hash digest
SHA256 3c386a756172ff6f907000de6be9dab8f384fa24a5506ff4a969cee1621b25be
MD5 5f3d375f7133522a1f9b809c52e7d6f0
BLAKE2b-256 bcd3518f97edd2c38977c772d7ee0e1b6c33964c2f4064f76cdf6f9a30efa217

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rtsp-1.1.10-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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 75136d7c41a8094242ec2ad92c402fd313efdf4753d00968c968cb2d8b4f8cfc
MD5 afafe580319eeeff8dcf24b9932d462d
BLAKE2b-256 be6c974922e44218900c6b129a98038e6fb052c2a79198db4c21b882a2260904

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