Read videos as numpy arrays
Project description
Reading videos into NumPy arrays was never more simple. In addition, this library also provides an entire range of additional functionalities for reading the videos.
Getting started
How to simply read a video, given its path?
# Import
from mydia import Videos
# Initialize video path
video_path = r"./static/sample_video/bigbuckbunny.mp4"
# Create a reader object
reader = Videos()
# Call the 'read()' function to get the video tensor
video = reader.read(video_path) # a tensor of shape (1, 132, 720, 1080, 3)
The tensor represents 1 video having 132 frames, with each frame having a width and height of 1080 and 720 pixels respectively. “3” denotes the Red, Green and Blue (RGB) channels of the video.
More examples available in the code documentation 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 Scikit-video, which requires FFmpeg to be installed on the system. 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
Additional Libraries to install:
Several libraries like Numpy, Pillow and Matplotlib, required for the package come pre-installed with the Anaconda distribution for Python. If you are not using the default anaconda distribution, then first install the packages mentioned above and along with their dependencies.
Also, install the following additional packages:
pip install sk-video
tqdm - Required for displaying the progress bar.
pip install tqdm
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.