Skip to content

DIMFLIX/OmniView

Repository files navigation

📝 About the project

A system for simultaneous viewing and processing of streams from multiple cameras (USB/IP) with the ability to integrate into computer vision.

🚀 Features

  • Support for USB and IP cameras (via RTSP)
  • Automatic reconnection in case of connection failure
  • Customizable camera parameters (resolution, FPS)
  • Multithreaded frame processing
  • Hardware-accelerated decoding (D3D11 on Windows, VAAPI on Linux) with automatic software fallback
  • USB hub multiplexing — auto-detect cameras sharing a USB 2.0 hub and time-multiplex them with a rolling-window scheduler (STREAMON/STREAMOFF for sub-second rotation)
  • Flexible callback system for video processing
  • Ready-to-use GUI for viewing streams
  • Configuration via constructor parameters

⚙️ Installation

pip install omniview

🛠️ Usage

🔌 Basic example for USB cameras

from omniview.managers import USBCameraManager


def frame_callback(camera_id, frame):
    # Your framing
    pass


if __name__ == "__main__":
    manager = USBCameraManager(
        show_gui=True,
        show_camera_id=True,
        frame_callback=frame_callback
    )
    try:
        manager.start()
    except KeyboardInterrupt:
        manager.stop()

🌐 Basic example for IP cameras

from omniview.managers import IPCameraManager


def frame_callback(camera_id, frame):
    # Your framing
    pass


if __name__ == "__main__":
    manager = IPCameraManager(
        show_gui=True,
        rtsp_urls=[
            "rtsp://admin:12345@192.168.0.1:9090",
        ],
        frame_callback=frame_callback
    )
    try:
        manager.start()
    except KeyboardInterrupt:
        manager.stop()

📚 API

Main methods:

  • start() - starts the camera manager (blocking call)
  • stop() - stops all threads correctly

Class USBCameraManager

Designer Parameters:

Parameter Type Default Description
show_gui bool False Show video windows
show_camera_id bool False Adds a caption with the camera ID to the frame
max_cameras int 10 Max. number of cameras
frame_width int 640 frame width
frame_height int 480 frame height
fps int 30 target FPS
min_uptime float 5.0 Min. uptime (sec)
frame_callback function None Callback for frame processing
exit_keys tuple (ord('q'),27) exit keys
hw_acceleration bool True Use GPU video decoding when available (D3D11/VAAPI); falls back to software
sequential_mode bool False
switch_interval float 5.0
multiplex_mode str "auto"
multiplex_slots int 2
multiplex_dwell float 1.5
multiplex_settle float 0.2
multiplex_backend str "v4l2"
multiplex_fourcc str "MJPG"

USB Hub Multiplexing

When multiple USB cameras share a single USB 2.0 hub, the bus can only sustain a limited number of simultaneous isochronous streams (empirically K=2). Opening more cameras causes ENOSPC ("No space left on device").

OmniView automatically detects which cameras are behind the same hub by reading /sys/class/video4linux symlinks, and applies a rolling-window rotation: K cameras stream live while the rest show their last captured frame ("parked"). The active window rotates every dwell seconds.

manager = USBCameraManager(
    show_gui=True,
    multiplex_mode="auto",   # detect from USB topology
    multiplex_slots=2,        # K=2 simultaneous streams per hub
    multiplex_dwell=1.5,      # rotate every 1.5 seconds
    multiplex_backend="v4l2", # fast STREAMON/STREAMOFF
)

Cameras connected directly to root hub ports (no intermediate hub) are not multiplexed — they have no bus contention.

Class IPCameraManager

Builder parameters (Same as USBCameraManager, but with an addition):

Parameter Type Default Description
rtsp_urls list[str] [] List of RTSP URLs

🎨 Built With

Developed on

Meowrch Linux

Meowrch — A Linux distribution built for creators and developers

🤝 Contributing

Contributions are welcome! Here's how you can help:

  • 🐛 Report bugs and request features via Issues
  • 🔧 Submit pull requests with improvements
  • 📖 Improve documentation

®️ Legal status

This project is protected by patent. All rights reserved. Use, copying, and distribution are permitted only with the written permission of the copyright holder.

Page 1 Page 2

📝 License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.