{"name":"vidgear: High-Performance Cross-Platform Video Processing Framework in Python","description":"vidgear is a high-performance, cross-platform Python framework for advanced video processing. It provides a comprehensive, multi-threaded, and asyncio API for real-time video capture, writing, streaming, and network transfer. This framework simplifies complex media operations, enabling developers to build robust applications with ease.","github":"https://github.com/abhiTronix/vidgear","url":"https://osrepos.com/repo/abhitronix-vidgear","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/abhitronix-vidgear","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/abhitronix-vidgear.md","json":"https://osrepos.com/repo/abhitronix-vidgear.json","topics":["Python","Video Processing","Real-time Streaming","FFmpeg","OpenCV","WebRTC","AI Optimization","Framework"],"keywords":["Python","Video Processing","Real-time Streaming","FFmpeg","OpenCV","WebRTC","AI Optimization","Framework"],"stars":null,"summary":"vidgear is a high-performance, cross-platform Python framework for advanced video processing. It provides a comprehensive, multi-threaded, and asyncio API for real-time video capture, writing, streaming, and network transfer. This framework simplifies complex media operations, enabling developers to build robust applications with ease.","content":"## Introduction\n\nvidgear is a high-performance, cross-platform Python framework that provides a comprehensive, one-stop solution for building complex real-time media applications. It leverages state-of-the-art specialized libraries such as OpenCV, FFmpeg, ZeroMQ, picamera2, and yt_dlp, offering a powerful Multi-Threaded and Asyncio API framework. vidgear is designed to simplify video processing tasks, enabling developers to read, write, process, send, and receive video files, frames, and streams from various devices in real-time, often faster than underlying libraries. Its architecture is built around a concept of \"Gears,\" each offering unique functionalities for different video processing needs.\n\n## Installation\n\nGetting started with vidgear is straightforward. For detailed instructions on how to install the framework and its dependencies, please refer to the official documentation:\n\n[Installation Guide](https://abhitronix.github.io/vidgear/latest/installation/)\n\n## Examples\n\nvidgear offers a variety of \"Gears\" for different functionalities. Here are a couple of examples showcasing its powerful capabilities:\n\n### FFGear: AI Inference Optimization with Keyframes\n\nFFGear is a multi-threaded, high-performance wrapper around DeFFcode's FFdecoder API, enabling real-time, low-overhead video frame decoding. It supports hardware-accelerated decoding, flexible pixel formats, and per-frame metadata extraction. A notable feature is its ability to optimize AI inference by processing only keyframes (I-frames), significantly reducing computational load.\n\npython\n# import required libraries\nfrom vidgear.gears import FFGear\nfrom ultralytics import YOLO\n\n# Initialize YOLOv10-Nano model\nmodel = YOLO(\"yolov10n.pt\")\n\n# Configure FFGear with per-frame metadata extraction enable\noptions = {\"-extract_metadata\": True}\nstream = FFGear(\n    source=\"test.mp4\", frame_format=\"bgr24\", logging=True, **options\n).start()\n\n# loop over\nwhile True:\n\n    # read data from stream\n    output = stream.read()\n\n    # check if end of stream\n    if output is None:\n        break\n\n    # Unpack the frame and its associated metadata\n    frame, meta = output\n\n    # --- OPTIMIZATION STEP ---\n    # We skip all non-keyframes to save processing power.\n    # This ensures the model only runs on the most information-dense frames.\n    if not meta.get(\"is_keyframe\"):\n        continue  # <-- Skips Non-key frames (P, B-frames)\n\n    # Log keyframe details\n    print(f\"Keyframe #{meta['frame_num']} at {meta['pts_time']:.3f}s\")\n\n    # Perform AI Inference on keyframes (I-frames) only\n    # Because we skip non-keyframes, this heavy task runs significantly less often.\n    results = model(frame)\n\n    # Annotate the frame with detection boxes and labels\n    annotated_frame = results[0].plot()\n\n    # {Insert your custom logic here, e.g., displaying/saving frames or triggering an alert}\n\n# safely close video stream\nstream.stop()\n\n\n### VideoGear: Real-time Video Stabilization\n\nVideoGear provides a special internal wrapper around vidgear's exclusive Video Stabilizer class. It serves as a unified video-capture API, offering seamless access to CamGear, PiGear, and FFGear, along with their respective parameters. This makes it particularly useful for easily stabilizing both real-time and non-real-time video streams with minimal code.\n\npython\n# import required libraries\nfrom vidgear.gears import VideoGear\nimport numpy as np\nimport cv2\n\n# open any valid video stream with stabilization enabled(`stabilize = True`)\nstream_stab = VideoGear(source=\"test.mp4\", stabilize=True).start()\n\n# open same stream without stabilization for comparison\nstream_org = VideoGear(source=\"test.mp4\").start()\n\n# loop over\nwhile True:\n\n    # read stabilized frames\n    frame_stab = stream_stab.read()\n\n    # check for stabilized frame if Nonetype\n    if frame_stab is None:\n        break\n\n    # read un-stabilized frame\n    frame_org = stream_org.read()\n\n    # concatenate both frames\n    output_frame = np.concatenate((frame_org, frame_stab), axis=1)\n\n    # put text over concatenated frame\n    cv2.putText(\n        output_frame,\n        \"Before\",\n        (10, output_frame.shape[0] - 10),\n        cv2.FONT_HERSHEY_SIMPLEX,\n        0.6,\n        (0, 255, 0),\n        2,\n    )\n    cv2.putText(\n        output_frame,\n        \"After\",\n        (output_frame.shape[1] // 2 + 10, output_frame.shape[0] - 10),\n        cv2.FONT_HERSHEY_SIMPLEX,\n        0.6,\n        (0, 255, 0),\n        2,\n    )\n\n    # Show output window\n    cv2.imshow(\"Stabilized Frame\", output_frame)\n\n    # check for 'q' key if pressed\n    key = cv2.waitKey(1) & 0xFF\n    if key == ord(\"q\"):\n        break\n\n# close output window\ncv2.destroyAllWindows()\n\n# safely close both video streams\nstream_org.stop()\nstream_stab.stop()\n\n\n## Why use vidgear?\n\nvidgear's motto is \"Write Less and Accomplish More.\" It is designed to be a cross-platform, high-performance framework that provides a one-stop video processing solution for building complex real-time media applications in Python. It excels at reading, writing, processing, sending, and receiving video files, frames, and streams from various devices in real-time, often outperforming underlying libraries. Whether you are new to Python programming or an experienced developer, vidgear allows you to easily integrate and perform complex video processing tasks in your applications without extensive documentation, often with just a few lines of code.\n\n## Links\n\n*   **GitHub Repository:** [https://github.com/abhiTronix/vidgear](https://github.com/abhiTronix/vidgear)\n*   **Official Documentation:** [https://abhitronix.github.io/vidgear](https://abhitronix.github.io/vidgear)\n*   **Installation Guide:** [https://abhitronix.github.io/vidgear/latest/installation/](https://abhitronix.github.io/vidgear/latest/installation/)\n*   **Support vidgear (GitHub Sponsors):** [https://github.com/sponsors/abhiTronix](https://github.com/sponsors/abhiTronix)","metrics":{"detailViews":2,"githubClicks":1},"dates":{"published":null,"modified":"2026-07-27T00:50:01.000Z"}}