Metadata-Version: 2.1
Name: haythemusv
Version: 0.1.0
Summary: Ultra low-latency RTSP stream interception library for USV robotics
Home-page: https://github.com/haythem/haythemusv
Author: Haythem
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: opencv-python

# haythemusv

An ultra low-latency RTSP video stream library designed for Unmanned Surface Vehicles (USV) and robotics. 

This library bypasses standard OpenCV/FFmpeg buffering to provide near-instant real-time video feeds by aggressively dropping stale frames and using hardware-accelerated decoding.

## Installation

```bash
pip install haythemusv
```

*Note: Requires `ffmpeg` to be installed and available in your system PATH.*

## Usage

```python
from haythemusv import USVStream
import cv2

# Initialize the stream (optimized for Dahua/Amcrest sub-streams)
url = "rtsp://admin:password@192.168.1.161:554/cam/realmonitor?channel=1&subtype=1"
cam = USVStream(url, width=640, height=352)

try:
    while cam.is_alive():
        frame = cam.get_frame()
        if frame is not None:
            cv2.imshow("USV Real-Time Feed", frame)
        
        if cv2.waitKey(1) & 0xFF == 27:
            break
finally:
    cam.stop()
    cv2.destroyAllWindows()
```

## Features
- **Zero Latency**: Aggressive frame-drop strategy ensures you always see the latest microsecond.
- **Hardware Accelerated**: Automatically uses NVIDIA NVDEC (`h264_cuvid`) if available.
- **Threaded Pipeline**: Background FFmpeg pipe maintains steady flow without blocking your main AI/Control loop.
- **Lightweight**: Minimal dependencies (`numpy`, `opencv-python`).

## License
MIT
