Skip to main content

A simple and efficient wrapper for reading videos as NumPy tensors

Project description

Mydia

Reading videos into NumPy arrays was never more simple. This library provides an entire range of additional functionalities such as custom frame selection, frame resizing, pixel normalization, grayscale conversion and much more.

Read the Documentation

Getting started

How to simply read a video, given its path?

# Import
from mydia import Videos

# Initialize video path
video_path = r".docs/examples/sample_video/bigbuckbunny.mp4"

# Create a reader object
reader = Videos()

# Call the 'read()' function to get the video tensor
# which will be of shape (1, 132, 720, 1080, 3)
video = reader.read(video_path)

The tensor can be interpreted as:

  • 1 video
  • Having 132 frames,
  • Dimension (width x height) of each frame: 1080x720 pixels
  • 3 denotes that the video is RGB

View detailed examples here

Installation

  • Install Mydia from PyPI (recommended):

        pip install mydia
    
  • Alternatively, install from Github source:

    First, clone the repository

        git clone https://github.com/MrinalJain17/mydia.git
    

    Then, build the module

        cd mydia
        python setup.py install
    

Requirements

Python 3.x (preferably from the Anaconda Distribution)

The program uses ffmpeg-python, which provides python bindings for FFmpeg (used as the backend for reading and processing videos)

To install FFmpeg on your machine:

For Linux users -

    $ sudo apt-get update
    $ sudo apt-get install libav-tools

For Windows or MAC/OSX users -

Download the required binaries from here. Extract the zip file and add the location of binaries to the PATH variable.

Required Libraries

Install the following packages along with their dependencies:

    pip install ffmpeg-python numpy tqdm matplotlib

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

mydia-2.1.1.tar.gz (8.0 kB view hashes)

Uploaded Source

Built Distribution

mydia-2.1.1-py3-none-any.whl (7.7 kB view hashes)

Uploaded 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