# 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": null,
"docs_url": null,
"requires_python": "<3.14,>=3.10",
"maintainer_email": null,
"keywords": "metadata, video, image, bigdata",
"author": "Can H. Tartanoglu",
"author_email": "canhtart@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/47/8a/6581047028b849a09c60a0a16e9ad6f5ca0e4d547bbb808245a320d6d96f/mextractor-6.0.2.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": "BSD-4",
"summary": "mextractor can extract media metadata to YAML and read them",
"version": "6.0.2",
"project_urls": {
"Homepage": "https://pypi.org/project/mextractor/",
"Repository": "https://github.com/caniko/media-metadata-extractor"
},
"split_keywords": [
"metadata",
" video",
" image",
" bigdata"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "14d78bbbf960d61c760421ad68cc172a31d1942474cd16a503f3273b229b3b66",
"md5": "4adb2f333291e779c989d71e3d6f5a6c",
"sha256": "090546b98935e640dedbc368c46cd149b742ad48f65934d642b3d14719773a31"
},
"downloads": -1,
"filename": "mextractor-6.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4adb2f333291e779c989d71e3d6f5a6c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.10",
"size": 6855,
"upload_time": "2024-12-02T07:37:44",
"upload_time_iso_8601": "2024-12-02T07:37:44.658551Z",
"url": "https://files.pythonhosted.org/packages/14/d7/8bbbf960d61c760421ad68cc172a31d1942474cd16a503f3273b229b3b66/mextractor-6.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "478a6581047028b849a09c60a0a16e9ad6f5ca0e4d547bbb808245a320d6d96f",
"md5": "a0c7dc75c4ade07ee306d470544c57d0",
"sha256": "c62c6610b5fb15d9f7b25b0af181a7205c2e450dda4191335e25d38cafa06781"
},
"downloads": -1,
"filename": "mextractor-6.0.2.tar.gz",
"has_sig": false,
"md5_digest": "a0c7dc75c4ade07ee306d470544c57d0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.10",
"size": 5154,
"upload_time": "2024-12-02T07:37:46",
"upload_time_iso_8601": "2024-12-02T07:37:46.303276Z",
"url": "https://files.pythonhosted.org/packages/47/8a/6581047028b849a09c60a0a16e9ad6f5ca0e4d547bbb808245a320d6d96f/mextractor-6.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-02 07:37:46",
"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"
}