Skip to main content

RTSP client wrapper around gstreamer/opencv

Project description

RTSP Package

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

Convenience-wrapper around OpenCV-Python RTSP functions.

Features

  • fetch a single image as Pillow Image
  • open RTSP stream and poll most recent frame as Pillow Image
  • preview stream in OpenCV
  • uniform interface for local web-cameras for rapid prototyping
    • integers will load a local USB or webcam 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://...')
client.read().show()
client.close()

Stream Preview

import rtsp
with rtsp.Client('rtsp://...') as client:
    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:

  • add better parsing for the RTSP resource 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.9.tar.gz (5.0 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.9-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rtsp-1.1.9.tar.gz
  • Upload date:
  • Size: 5.0 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.9.tar.gz
Algorithm Hash digest
SHA256 ff8e178de32a40fbd49b7dfef45bcb40c59e87494e10399639ed753f4c2588bd
MD5 6e8c76ea8936f23927cd0efed2457b8c
BLAKE2b-256 df98ad86dc93e50263819bd04508ec6dbea4480e45aaf370520b86bfe3bcf11a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rtsp-1.1.9-py3-none-any.whl
  • Upload date:
  • Size: 6.0 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 4819a25b93bed10beef4acbfd72410f10d9d4ccbb5f65d3e8cbc8720fc2c9601
MD5 aed00c35daf29727a0cf7f8b35063e10
BLAKE2b-256 6c4cb49925ddb3c2bc06e46133c0b9be074b0ba1a71b574dd5ad6912388a928f

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