Skip to main content

OpenCV Guides Repository

View the full source code and example projects for DWE.ai cameras on GitHub.

Features

  • Raw RTP/UDP: No GStreamer or external dependencies required.
  • High Resolution: Optimized for 1080p 30fps+ streams.
  • 10-bit Support: Handles 10-bit YUV 4:4:4 (yuv444p10le) and standard 8-bit formats.
  • Low Latency: Uses a background receiver thread and multi-threaded decoding.
  • Modular Design: Separates network handling, decoding, and display logic.

Prerequisites

  • Python 3.8+
  • FFmpeg libraries (usually installed automatically via PyAV)

Installation

Navigate to the 3-receive-dweos-h264/python directory in the repository and set up your environment:
  1. Create a virtual environment:
    python3 -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  2. Install the required dependencies:
    pip install -r requirements.txt
    

Usage

  1. Start your H.264 RTP stream (defaulting to 127.0.0.1:5600).
  2. Run the receiver:
    python main.py
    

Project Structure

  • rtp_receiver.py: Handles raw UDP packet reception and H.264 NAL reassembly (including FU-A and STAP-A).
  • h264_decoder.py: Wraps PyAV for high-performance H.264 decoding.
  • main.py: The main entry point that connects the receiver and decoder to an OpenCV window.