Skip to main content

A OpenCV Python Multi-Threaded Video Streaming Wrapper Library

Project description

VidGear

VidGear is a lightweight python wrapper around OpenCV Video I/O module that contains powerful multi-thread modules(gears) to enable high-speed video frames read functionality across various devices and platforms. It is a reworked implementation of imutils library's video modules with all major bugs fixed and comes with addition features like direct network streaming(GStreamer Pipeline supported) and flexible source parameters/attributes manipulation of OpenCV and picamera libraries on the go. This library is very well compatible with Raspberry Pi Camera module's Picamera library and provides us the ability exploit its various features like brightness, saturation, sensor_mode etc. easily. This library supports Python 2.7 and all above versions.

Installation

VidGear requires OpenCV and Picamera (Only if you want to use Raspberry Pi Camera Module) libraries installation prior to its installation (Latest versions recommended).

  • Download from PIP: vidgear wheel file could be easily be downloaded and can be installed as follows(Now available on Python Package Index (PyPI)):
    sudo pip install vidgear
    
  • Clone This Repo(Latest but experimental): Or you can clone this repository and install using pip as follows:
    git clone https://github.com/abhiTronix/vidgear.git
    cd vidgear
    sudo pip install .
    
  • Conda Install: Anaconda prefers to use its own conda package manager, but it’s also possible to install packages using pip. You can install as follows:
    pip install vidgear
    

Usage

Basic example:

# import required libraries
from vidgear.gears import VideoGear
import cv2

stream = VideoGear(enablePiCamera = False, source=0).start() 
# define various attributes and start the stream

# infinite loop
while True:

	frame = stream.read()
	# read frames

	# check if frame is None
	if frame is None:
		#if True break the infinite loop
		break

	# do something with frame here

	cv2.imshow("Output Frame", frame)
	# Show output window

	key = cv2.waitKey(1) & 0xFF
	# check for 'q' key-press
	if key == ord("q"):
		if 'q' key-pressed break out
		break

cv2.destroyAllWindows()
# close output window

stream.stop()
# safely close video stream.

Important: Checkout wiki for extensive usage documentation and examples.


Salient Features:

  • Multi-Threaded high-speed OpenCV video-frame capturing(resulting in High FPS)
  • Lightweight
  • Built-in Robust Error and frame synchronization Handling
  • Multi-Platform compatibility
  • Flexible control over the output stream
  • Full Support for Network Video Streams(Including Gstreamer Raw Video Capture Pipeline)

Contributing and licenses:

This Project is licensed under the MIT license. You are welcome to contribute with suggestions, feature requests and pull requests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

vidgear-0.1.1-py2.py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page