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 details)

Uploaded Python 2 Python 3

File details

Details for the file vidgear-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: vidgear-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for vidgear-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0cca7c7fbac160439e864aa37ef73fac9930fd8fb50397206d70757e943e6645
MD5 b4ba8ba7eb007433ab67ae3a2a77c4c1
BLAKE2b-256 da5f80885ec3cd1c4b248bfc71fbfa41b31a44daeb9f2dd580448be814fe9469

See more details on using hashes here.

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