About this project

VidGear (vidgear) is a Python framework that simplifies complex real-time video processing tasks through a collection of specialized APIs called "Gears." It provides a high-level, multi-threaded and asyncio-compatible layer over libraries such as OpenCV, FFmpeg, ZeroMQ, picamera2, starlette, yt-dlp, dxcam, aiortc, and python-mss, exposing their parameters while handling errors and synchronization internally. The framework organizes functionality into four groups: **Video-Capture Gears** - CamGear: Reads from IP/USB cameras, network streams (RTSP, RTMP, HTTP), multimedia files, GStreamer pipelines, and streaming sites (YouTube, Twitch, etc.) via yt-dlp. Uses a threaded queue for low-latency frame delivery. - FFGear: Hardware-accelerated FFmpeg decoder wrapper (CUDA/CUVID, etc.) with full filtergraph support, per-frame metadata extraction, and keyframe-only processing for AI inference optimization. - PiGear: Optimized for Raspberry Pi camera modules (OV5647, IMX219) via picamera2/libcamera, with fallback to legacy picamera and a threaded watchdog for hardware failures. - ScreenGear: High-speed screen capture using dxcam, pyscreenshot, or mss backends, supporting multi-monitor regions. - VideoGear: Unified capture API that can switch between CamGear, PiGear, and FFGear backends; includes an integrated video stabilizer for real-time shake reduction. **Video-Writer Gear** - WriteGear: FFmpeg-based encoder for lossless/compressed output with arbitrary codec, bitrate, resolution, subtitles, and audio multiplexing. Also offers an OpenCV VideoWriter non-compression mode. Supports live streaming to RTMP/RTSP endpoints. **Streaming Gears** - StreamGear: Transcodes input into adaptive streaming formats (MPEG-DASH, Apple HLS) with chunking and manifest generation. - WebGear: ASGI server broadcasting live MJPEG frames to browsers. - WebGear_RTC: Asyncio WebRTC media server for low-latency peer-to-peer streaming. **Network Gears** - NetGear: High-performance frame and data transfer between systems over the network (ZeroMQ-based). - NetGear_Async: Memory-efficient asyncio version of NetGear. All Gears share a consistent start/read/stop pattern, extensive logging, and detailed documentation. The project is licensed under Apache 2.0.