Skip to main content

📹 TrueFrame

A robust, latency-free RTSP stream reader for Python, designed to fetch the absolute latest frame.

TrueFrame gives you a clean, dependency-light Python interface to any RTSP stream. It intelligently handles connection drops and buffer management, ensuring you always get the most recent frame without smearing, artifacting, or latency buildup.

✨ Features

  • 🚀 Zero Latency: Uses a background thread to continuously flush the stream buffer, so read() always returns the latest frame.
  • 🔌 Robust Reconnects: Automatically handles stream interruptions and attempts to reconnect without user intervention.
  • 🖼️ Simple & Clean API: An intuitive interface that's easy to integrate. Use it as a context manager for automatic resource cleanup.
  • 🗂️ Modular Design: A clean, SOLID-based architecture (Camera, FrameGrabber, Stream) for better maintainability.
  • ⚡ Minimal Dependencies: Only needs opencv-python and numpy.
  • 🐍 Context Manager: Built-in __enter__ and __exit__ for safe and easy resource management.

📥 Installation

pip install trueframe

Or, to install directly from source:

pip install .

🚀 Quick Start

import cv2
from trueframe import TrueFrame

# Replace with your RTSP stream URL
RTSP_URL = 'rtsp://user:pass@192.168.1.100:554/stream'

def main():
    # Use a 'with' statement for automatic resource management
    with TrueFrame(RTSP_URL) as stream:
        print(f"Connecting to {RTSP_URL}...")
        
        while True:
            # Read the latest frame
            frame = stream.read()

            # If a frame was received, display it
            if frame is not None:
                cv2.imshow("TrueFrame RTSP Stream", frame)

            # Press 'q' to exit the loop
            if cv2.waitKey(1) & 0xFF == ord('q'):
                break

    # Clean up
    cv2.destroyAllWindows()
    print("Stream stopped.")

if __name__ == "__main__":
    main()

⚙️ Core Components

Class Description
TrueFrame The main, user-facing class that provides the simple read()/stop() API.
Stream A facade that coordinates the Camera and FrameGrabber components.
Camera A low-level wrapper around cv2.VideoCapture for connecting and grabbing.
FrameGrabber The background worker that runs in a separate thread to continuously fetch frames.

🐍 Requirements

  • Python 3.8+
  • opencv-python
  • numpy

🤝 Contributing

Issues and pull requests are welcome! Please file an issue if you encounter any problems or have suggestions for improvements.


Built with ❤️ for smooth video streaming. MIT Licensed.

Metadata

Release files for trueframe 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trueframe 0.1.0
File Size Uploaded
trueframe-0.1.0.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for trueframe 0.1.0
File Interpreter ABI Platform
trueframe-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.5 kB

Release files / trueframe-0.1.0.tar.gz

Download URL trueframe-0.1.0.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3ad96b545c3279c7166105121e21f5cb2da951fb4817d019d11725dde657b1aa
BLAKE2b-256 checksum
How to use checksums
926eef152837dbe95af38c094df86ff57072641d4ed8125fa711b09815c64f1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 22, 2026.

Transparency log

Release files / trueframe-0.1.0-py3-none-any.whl

Download URL trueframe-0.1.0-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68857818627f34cbdc27d98b6e8ba90288614b44bb3051846acc98f2efd964a8
BLAKE2b-256 checksum
How to use checksums
2adf0bd97b4b61a25f43c0f062cce4844d6d4a30e336eb8268f4d99095320bdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page