Videos and images can be large.
Download and install from PyPi with pip
:
pip install mextractor
If you are extracting metadata from videos, install additional dependencies:
pip install mextractor[video-extract]
Please back up your files before using them with the package, things might break during runtime causing corruption.
Copy directory to a new directory while extracting media info and a single frame from videos in subdirectories:
mextractor video-subdirs <path_to_root>
These functions are useful when integrating mextractor to your own package. You can also use it for quick scripts, see the mextractor.workflows
submodule for inspiration.
from mextractor.workflow import extract_and_dump_video
metadata = extract_and_dump_video(dump_dir, path_to_video, include_image, greyscale, lossy_compress_image)
from mextractor.workflow import extract_and_dump_image
metadata = extract_and_dump_image(dump_dir, path_to_image, include_image, greyscale, lossy_compress_image)
import mextractor
video_metadata = mextractor.load(mextractor_dir)
print(video_metadata.average_fps)
print(video_metadata.frames)
print(video_metadata.resolution)
print(video_metadata.video_length_in_seconds)
import mextractor
image_metadata = mextractor.load(mextractor_dir)
print(image_metadata.resolution)