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.8.tar.gz (4.2 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.8-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rtsp-1.1.8.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.4.2 requests/2.21.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.5

File hashes

Hashes for rtsp-1.1.8.tar.gz
Algorithm Hash digest
SHA256 2af552f0640680ef90d9c66b3983bcd9a2983762b84b864d6e1e6e62b29a9fe4
MD5 80d87d228efab5c90ec9ee0bfdded57e
BLAKE2b-256 cc30596132c955ce438ae7f0576bbdcdb5216e2ca020fbfa3cef7ef664102751

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rtsp-1.1.8-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.4.2 requests/2.21.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.5

File hashes

Hashes for rtsp-1.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d28868dcb0f669cc35c1438e1820da1effab6197a2dd6efbd30114d4702041c5
MD5 3d48c1318b8d2d9721b4ba4e34000602
BLAKE2b-256 c565e09499bc11322e4d0235cc19b1e19b52fe3b7cb5154ce75ebbb737b0fd04

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