# 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)
```
Raw data
{
"_id": null,
"home_page": "https://pypi.org/project/mextractor/",
"name": "mextractor",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<3.12",
"maintainer_email": "",
"keywords": "pydantic,metadata,video,image,bigdata",
"author": "Can H. Tartanoglu",
"author_email": "canhtart@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/6b/34/c0e742494bfafbbebded77173bd651c68692ce64a645fe4cd136a33dd320/mextractor-4.0.0.tar.gz",
"platform": null,
"description": "# mextractor: media metadata extractor\n\nVideos and images can be large. \n\n## Installation\n\nDownload and install from PyPi with `pip`:\n\n```shell\npip install mextractor\n```\nIf you are extracting metadata from videos, install additional dependencies:\n```shell\npip install mextractor[video-extract]\n```\n\n## Usage\nPlease back up your files before using them with the package, things might break during runtime causing corruption.\n\n### Command line interface (CLI)\n\nCopy directory to a new directory while extracting media info and a single frame from videos in subdirectories:\n```shell\nmextractor video-subdirs <path_to_root>\n```\n\n### Programmatically\nThese 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.\n\n#### Extract and dump metadata\n\n##### Video\n\n```python\nfrom mextractor.workflow import extract_and_dump_video\n\nmetadata = extract_and_dump_video(dump_dir, path_to_video, include_image, greyscale, lossy_compress_image)\n```\n\n##### Image\n\n```python\nfrom mextractor.workflow import extract_and_dump_image\n\nmetadata = extract_and_dump_image(dump_dir, path_to_image, include_image, greyscale, lossy_compress_image)\n```\n\n#### Load media\n\n##### Video\n\n```python\nimport mextractor\n\nvideo_metadata = mextractor.load(mextractor_dir)\n\nprint(video_metadata.average_fps)\nprint(video_metadata.frames)\nprint(video_metadata.resolution)\nprint(video_metadata.video_length_in_seconds)\n```\n\n##### Image\n\n```python\nimport mextractor\n\nimage_metadata = mextractor.load(mextractor_dir)\n\nprint(image_metadata.resolution)\n```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "mextractor can extract media metadata to YAML and read them",
"version": "4.0.0",
"project_urls": {
"Homepage": "https://pypi.org/project/mextractor/",
"Repository": "https://github.com/caniko/media-metadata-extractor"
},
"split_keywords": [
"pydantic",
"metadata",
"video",
"image",
"bigdata"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ecbce64a704ffafe5d9db8d373ee108945892536ff1fbd1b70e53f24706f14d3",
"md5": "a2c53e29eb3ff0aa61a1637895e22713",
"sha256": "9d3b0061b597760dd48bb75c6b3b24c2c689d880d4f789ebdaf45fa88cdd5451"
},
"downloads": -1,
"filename": "mextractor-4.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a2c53e29eb3ff0aa61a1637895e22713",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<3.12",
"size": 6490,
"upload_time": "2023-08-22T07:57:50",
"upload_time_iso_8601": "2023-08-22T07:57:50.454199Z",
"url": "https://files.pythonhosted.org/packages/ec/bc/e64a704ffafe5d9db8d373ee108945892536ff1fbd1b70e53f24706f14d3/mextractor-4.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6b34c0e742494bfafbbebded77173bd651c68692ce64a645fe4cd136a33dd320",
"md5": "c49041c44ab06cfa95fda963e6ae46e9",
"sha256": "b575e57434e3602f74563d476b0fc894c3f559c40d3d3bb6b2087c8d5611c419"
},
"downloads": -1,
"filename": "mextractor-4.0.0.tar.gz",
"has_sig": false,
"md5_digest": "c49041c44ab06cfa95fda963e6ae46e9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<3.12",
"size": 4760,
"upload_time": "2023-08-22T07:57:52",
"upload_time_iso_8601": "2023-08-22T07:57:52.105893Z",
"url": "https://files.pythonhosted.org/packages/6b/34/c0e742494bfafbbebded77173bd651c68692ce64a645fe4cd136a33dd320/mextractor-4.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-22 07:57:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "caniko",
"github_project": "media-metadata-extractor",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mextractor"
}