Skip to main content

Demos of OpenCV, read/write videos, etc.

Project description

Travis CI status coverage AppVeyor CI Maintainability pypi versions PyPi Download stats

Python Image and Video Read/Write Examples

Functions to write multipage images and make videos from Numpy arrays. Also includes functions to test Matlab and Python OpenCV codecs.


python -m pip install -e .

Scripts converts HDF5 video data to AVI. Typically used in biomedical and science imaging, where they use HDF5 instead of TIFF, since HDF5 is a very widespread, fast file format that can store arbitrarily large datasets and metadata. It is recommended to researchers to use HDF5 instead of TIFF, FITS, CDF or proprietary formats for large data streams, including lossless video. demonstration of writing multipage TIFF from Numpy arrays, using tifffile and freeimage (tifffile is 20x faster and much more featureful) converts large directory of files with same prefix to multipage TIFFs


The audio_*.py scripts show several methods for generating audio output from Python.

Python lossless AVI writing

You can write AVI from Python without axes labels (openCV) or with labels/axes (Matplotlib)

OpenCV AVI writing demonstrates using OpenCV to write video, with a lot of codecs to try. This does not insert any of the axes stuff that Matplotlib does, so it can be useful for machine vision work. You can optinally overlay dynamic text on the video.

Matplotlib AVI writing writes axes labels AVIs lossless using Matplotlib. Note that file-based matplotlib.animation.writers['ffmpeg_file'] is used for better reliability, even though it takes twice as long as the pipe-based ffmpeg. On some computers, pipe-based matplotlib.animation.writers['ffmpeg'] results in very distorted, scrambled output for some reason, with Matplotlib 1.5 and 2.0. In that case, I have empirically found ffmpeg_file to Just Work.


Project details

Download files

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

Files for pyimagevideo, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size pyimagevideo-1.0.1.tar.gz (27.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page