Skip to main content

Video Frameserver for Numpy

Project description

Vidsrc is a Python library to read frames from video files as numpy arrays via the DirectShow IMediaDet interface.

Author:

Christoph Gohlke

License:

BSD 3-Clause

Version:

2024.1.6

Quickstart

Install the vidsrc package and all dependencies from the Python Package Index:

python -m pip install -U vidsrc

See Examples for using the programming interface.

Source code and support are available on GitHub.

Requirements

This revision was tested with the following requirements and dependencies (other versions may work):

  • CPython 3.9.13, 3.10.11, 3.11.7, 3.12.1

  • Numpy 1.26.3

  • Microsoft Visual Studio 2022 (build)

  • DirectX 9.0c SDK (build)

  • DirectShow BaseClasses include files (build)

  • DirectShow STRMBASE.lib (build)

Revisions

2024.1.6

  • Support Python 3.12.

  • Remove support for Python 3.8 and numpy 1.22 (NEP 29).

2022.9.28

  • Update metadata.

2021.6.6

  • Remove support for Python 3.6 (NEP 29).

  • Fix compile error on PyPy3.

2020.1.1

  • Remove support for Python 2.7 and 3.5.

Notes

The DirectShow IMediaDet interface is deprecated and may be removed from future releases of Windows (https://docs.microsoft.com/en-us/windows/desktop/directshow/imediadet).

To fix compile error C2146: syntax error: missing ';' before identifier 'PVOID64', change typedef void * POINTER_64 PVOID64; to typedef void * __ptr64 PVOID64; in winnt.h.

Examples

>>> from vidsrc import VideoSource
>>> video = VideoSource('test.avi', grayscale=False)
>>> len(video)  # number of frames in video
48
>>> video.duration  # length in s
1.6016
>>> video.framerate  # frames per second
29.970089850329373
>>> video.shape  # frames, height, width, color channels
(48, 64, 64, 3)
>>> frame = video[0]  # access first frame
>>> frame = video[-1]  # access last frame
>>> for frame in video:
...     pass  # do_something_with(frame)

Project details


Download files

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

Source Distribution

vidsrc-2024.1.6.tar.gz (147.8 kB view hashes)

Uploaded Source

Built Distributions

vidsrc-2024.1.6-pp310-pypy310_pp73-win_amd64.whl (14.7 kB view hashes)

Uploaded PyPy Windows x86-64

vidsrc-2024.1.6-cp312-cp312-win_arm64.whl (13.4 kB view hashes)

Uploaded CPython 3.12 Windows ARM64

vidsrc-2024.1.6-cp312-cp312-win_amd64.whl (14.6 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

vidsrc-2024.1.6-cp312-cp312-win32.whl (13.8 kB view hashes)

Uploaded CPython 3.12 Windows x86

vidsrc-2024.1.6-cp311-cp311-win_arm64.whl (13.4 kB view hashes)

Uploaded CPython 3.11 Windows ARM64

vidsrc-2024.1.6-cp311-cp311-win_amd64.whl (14.6 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

vidsrc-2024.1.6-cp311-cp311-win32.whl (13.7 kB view hashes)

Uploaded CPython 3.11 Windows x86

vidsrc-2024.1.6-cp310-cp310-win_amd64.whl (14.6 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

vidsrc-2024.1.6-cp310-cp310-win32.whl (13.7 kB view hashes)

Uploaded CPython 3.10 Windows x86

vidsrc-2024.1.6-cp39-cp39-win_amd64.whl (14.6 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

vidsrc-2024.1.6-cp39-cp39-win32.whl (13.7 kB view hashes)

Uploaded CPython 3.9 Windows x86

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