Metadata-Version: 2.1
Name: mextractor
Version: 2.2.0
Summary: mextractor can extract media metadata to YAML and read them
Home-page: https://pypi.org/project/mextractor/
License: Apache-2.0
Keywords: pydantic,metadata,video,image,bigdata
Author: Can H. Tartanoglu
Author-email: canhtart@gmail.com
Requires-Python: >=3.7,<3.11
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Provides-Extra: video-extract
Requires-Dist: click (>=8.1.3,<9.0.0)
Requires-Dist: ffmpeg-python (>=0.2.0,<0.3.0); extra == "video-extract"
Requires-Dist: numba (>=0.56.0,<0.57.0)
Requires-Dist: numpy (>=1.21.0,<2.0.0); python_version >= "3.7" and python_version < "3.8"
Requires-Dist: numpy; python_version >= "3.8" and python_version < "3.11"
Requires-Dist: opencv-python (>=4.6.0,<5.0.0)
Requires-Dist: pydantic (>=1.9.2,<2.0.0)
Requires-Dist: pydantic-numpy (>=1.3.0,<2.0.0)
Requires-Dist: ruamel.yaml (>=0.17.21,<0.18.0)
Requires-Dist: setuptools
Project-URL: Repository, https://github.com/caniko/media-metadata-extractor
Description-Content-Type: text/markdown

# mextractor: media metadata extractor

Videos and images can be large. 

## Installation

Download and install from PyPi with `pip`:

```shell
pip install mextractor
```
If you are extracting metadata from videos, install additional dependencies:
```shell
pip install mextractor[video-extract]
```

## Usage
Please back up your files before using them with the package, things might break during runtime causing corruption.

### Command line interface (CLI)

Copy directory to a new directory while extracting media info and a single frame from videos in subdirectories:
```shell
mextractor video-subdirs <path_to_root>
```

### Programmatically
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.

#### Extract and dump metadata

##### Video

```python
from mextractor.workflow import extract_and_dump_video

metadata = extract_and_dump_video(dump_dir, path_to_video, include_image, greyscale, lossy_compress_image)
```

##### Image

```python
from mextractor.workflow import extract_and_dump_image

metadata = extract_and_dump_image(dump_dir, path_to_image, include_image, greyscale, lossy_compress_image)
```

#### Load media

##### Video

```python
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)
```

##### Image

```python
import mextractor

image_metadata = mextractor.load(mextractor_dir)

print(image_metadata.resolution)
```

