mediainfo-generator


Namemediainfo-generator JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/ravensorb/mediainfo-generator
Summary
upload_time2023-07-10 20:17:31
maintainer
docs_urlNone
authorShawn Anderson
requires_python>=3.10,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Generate Media Info

![PyPI - Downloads](https://img.shields.io/pypi/:period/mediainfo-generator)

This set of scripts and corresponding docker file will process all media files within a folder structure recursively and do one of the following:

* create a mediainfo.json file for each one found and then create a single file that combines them all into one (to simplify processing)
* process the mediainfo.json file that was created and extract a few key properties to simplify reporting and save this to mediainfo.summary.josn

## Ways to run

There are two ways to run the script, one is via installation (pip module) and the3 other is via docker.

### Installation

First step is to install the module via pip

```bash
pip install mediainfo-generator
```

Then you can run it like this

```bash
mediainfo-generator --path.data /mnt/video
```

### Docker

To Generate media info files and consolidated mediainfo.json file run the following command (after building the container)

```bash
docker run --rm -v /path/to/your/video/files:/data media-info --path.data /data
```

**Note:** You can pass an optional argument if you want to change the root folder in the container to scan (defaults to /data)

## Command Line Arguments

```bash

```

## Build

``` bash
git clone https://github.com/ravensorb/mediainfo-generator.git

cd mediainfo-generator/docker
docker build -t media-info . 
```

## Example Output

### Media Info Consolidate File Example

```json
[
  {
    "streams": [
      {
        "index": 0,
        "codec_name": "h264",
        "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
        "profile": "Main",
        "codec_type": "video",
        "codec_tag_string": "[0][0][0][0]",
        "codec_tag": "0x0000",
        "width": 1920,
        "height": 752,
        "coded_width": 1920,
        "coded_height": 752,
        "closed_captions": 0,
        "film_grain": 0,
        "has_b_frames": 2,
        "sample_aspect_ratio": "1:1",
        "display_aspect_ratio": "120:47",
        "pix_fmt": "yuv420p",
        "level": 40,
        "color_range": "tv",
        "color_space": "bt709",
        "color_transfer": "bt709",
        "color_primaries": "bt709",
        "chroma_location": "left",
        "field_order": "progressive",
        "refs": 1,
        "is_avc": "true",
        "nal_length_size": "4",
        "r_frame_rate": "24000/1001",
        "avg_frame_rate": "24000/1001",
        "time_base": "1/1000",
        "start_pts": 7,
        "start_time": "0.007000",
        "bits_per_raw_sample": "8",
        "extradata_size": 43,
        "disposition": {
          "default": 1,
          "dub": 0,
          "original": 0,
          "comment": 0,
          "lyrics": 0,
          "karaoke": 0,
          "forced": 0,
          "hearing_impaired": 0,
          "visual_impaired": 0,
          "clean_effects": 0,
          "attached_pic": 0,
          "timed_thumbnails": 0,
          "captions": 0,
          "descriptions": 0,
          "metadata": 0,
          "dependent": 0,
          "still_image": 0
        },
        "tags": {
          "BPS-eng": "1667533",
          "DURATION-eng": "02:07:01.990000000",
          "NUMBER_OF_FRAMES-eng": "182745",
          "NUMBER_OF_BYTES-eng": "1588740197",
          "_STATISTICS_WRITING_APP-eng": "mkvmerge v52.0.0 ('Secret For The Mad') 64-bit",
          "_STATISTICS_WRITING_DATE_UTC-eng": "2023-04-26 12:14:35",
          "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES"
        }
      },
      {
        "index": 1,
        "codec_name": "opus",
        "codec_long_name": "Opus (Opus Interactive Audio Codec)",
        "codec_type": "audio",
        "codec_tag_string": "[0][0][0][0]",
        "codec_tag": "0x0000",
        "sample_fmt": "fltp",
        "sample_rate": "48000",
        "channels": 6,
        "channel_layout": "5.1",
        "bits_per_sample": 0,
        "initial_padding": 312,
        "r_frame_rate": "0/0",
        "avg_frame_rate": "0/0",
        "time_base": "1/1000",
        "start_pts": -7,
        "start_time": "-0.007000",
        "extradata_size": 27,
        "disposition": {
          "default": 1,
          "dub": 0,
          "original": 0,
          "comment": 0,
          "lyrics": 0,
          "karaoke": 0,
          "forced": 0,
          "hearing_impaired": 0,
          "visual_impaired": 0,
          "clean_effects": 0,
          "attached_pic": 0,
          "timed_thumbnails": 0,
          "captions": 0,
          "descriptions": 0,
          "metadata": 0,
          "dependent": 0,
          "still_image": 0
        },
        "tags": {
          "language": "eng",
          "title": "Opus / 5.1 / 48 kHz / 1152 kbps",
          "BPS-eng": "774388",
          "DURATION-eng": "02:07:09.661000000",
          "NUMBER_OF_FRAMES-eng": "381483",
          "NUMBER_OF_BYTES-eng": "738540139",
          "_STATISTICS_WRITING_APP-eng": "mkvmerge v52.0.0 ('Secret For The Mad') 64-bit",
          "_STATISTICS_WRITING_DATE_UTC-eng": "2023-04-26 12:14:35",
          "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES"
        }
      },
      {
        "index": 2,
        "codec_name": "hdmv_pgs_subtitle",
        "codec_long_name": "HDMV Presentation Graphic Stream subtitles",
        "codec_type": "subtitle",
        "codec_tag_string": "[0][0][0][0]",
        "codec_tag": "0x0000",
        "r_frame_rate": "0/0",
        "avg_frame_rate": "0/0",
        "time_base": "1/1000",
        "start_pts": -7,
        "start_time": "-0.007000",
        "duration_ts": 7629661,
        "duration": "7629.661000",
        "disposition": {
          "default": 1,
          "dub": 0,
          "original": 0,
          "comment": 0,
          "lyrics": 0,
          "karaoke": 0,
          "forced": 0,
          "hearing_impaired": 0,
          "visual_impaired": 0,
          "clean_effects": 0,
          "attached_pic": 0,
          "timed_thumbnails": 0,
          "captions": 0,
          "descriptions": 0,
          "metadata": 0,
          "dependent": 0,
          "still_image": 0
        },
        "tags": {
          "language": "eng",
          "title": "SDH",
          "BPS-eng": "52274",
          "DURATION-eng": "02:04:19.077000000",
          "NUMBER_OF_FRAMES-eng": "2478",
          "NUMBER_OF_BYTES-eng": "48739495",
          "_STATISTICS_WRITING_APP-eng": "mkvmerge v52.0.0 ('Secret For The Mad') 64-bit",
          "_STATISTICS_WRITING_DATE_UTC-eng": "2023-04-26 12:14:35",
          "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES"
        }
      }
    ],
    "format": {
      "filename": "/data/movie.mkv",
      "nb_streams": 3,
      "nb_programs": 0,
      "format_name": "matroska,webm",
      "format_long_name": "Matroska / WebM",
      "start_time": "-0.007000",
      "duration": "7629.661000",
      "size": "2351055609",
      "bit_rate": "2465174",
      "probe_score": 100,
      "tags": {
        "title": "Some Title",
        "creation_time": "2023-04-26T12:14:35.000000Z",
        "ENCODER": "Lavf58.45.100"
      }
    }
  },
  ...
]
```

### Media Info Summary File Examplpe

```json
[
  {
      "filename": "/data/movie.mkv",
      "format": {
        "format_name": "matroska,webm",
        "format_long_name": "Matroska / WebM",
        "bit_rate": "9878670",
        "size": "7725436645",
        "encoder": "libebml v1.4.2 + libmatroska v1.6.4"
      },
      "video": {
        "codec_name": "hevc",
        "codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)",
        "profile": "Main 10",
        "codec_type": "video",
        "coded_width": 3840,
        "coded_height": 1600,
        "avg_frame_rate": "24000/1001"
      },
      "audio": {
        "codec_name": "eac3",
        "codec_long_name": "ATSC A/52B (AC-3, E-AC-3)",
        "profile": null,
        "codec_type": "audio",
        "sample_rate": "48000",
        "channels": 6,
        "channel_layout": "5.1(side)"
      }
    },
    ...
]
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ravensorb/mediainfo-generator",
    "name": "mediainfo-generator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Shawn Anderson",
    "author_email": "sanderson@eye-catcher.com",
    "download_url": "https://files.pythonhosted.org/packages/7a/17/a7681e48d3b1c77badaebc2b3c27ba8414995280173cb906a54b119c726a/mediainfo_generator-0.1.1.tar.gz",
    "platform": null,
    "description": "# Generate Media Info\n\n![PyPI - Downloads](https://img.shields.io/pypi/:period/mediainfo-generator)\n\nThis set of scripts and corresponding docker file will process all media files within a folder structure recursively and do one of the following:\n\n* create a mediainfo.json file for each one found and then create a single file that combines them all into one (to simplify processing)\n* process the mediainfo.json file that was created and extract a few key properties to simplify reporting and save this to mediainfo.summary.josn\n\n## Ways to run\n\nThere are two ways to run the script, one is via installation (pip module) and the3 other is via docker.\n\n### Installation\n\nFirst step is to install the module via pip\n\n```bash\npip install mediainfo-generator\n```\n\nThen you can run it like this\n\n```bash\nmediainfo-generator --path.data /mnt/video\n```\n\n### Docker\n\nTo Generate media info files and consolidated mediainfo.json file run the following command (after building the container)\n\n```bash\ndocker run --rm -v /path/to/your/video/files:/data media-info --path.data /data\n```\n\n**Note:** You can pass an optional argument if you want to change the root folder in the container to scan (defaults to /data)\n\n## Command Line Arguments\n\n```bash\n\n```\n\n## Build\n\n``` bash\ngit clone https://github.com/ravensorb/mediainfo-generator.git\n\ncd mediainfo-generator/docker\ndocker build -t media-info . \n```\n\n## Example Output\n\n### Media Info Consolidate File Example\n\n```json\n[\n  {\n    \"streams\": [\n      {\n        \"index\": 0,\n        \"codec_name\": \"h264\",\n        \"codec_long_name\": \"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10\",\n        \"profile\": \"Main\",\n        \"codec_type\": \"video\",\n        \"codec_tag_string\": \"[0][0][0][0]\",\n        \"codec_tag\": \"0x0000\",\n        \"width\": 1920,\n        \"height\": 752,\n        \"coded_width\": 1920,\n        \"coded_height\": 752,\n        \"closed_captions\": 0,\n        \"film_grain\": 0,\n        \"has_b_frames\": 2,\n        \"sample_aspect_ratio\": \"1:1\",\n        \"display_aspect_ratio\": \"120:47\",\n        \"pix_fmt\": \"yuv420p\",\n        \"level\": 40,\n        \"color_range\": \"tv\",\n        \"color_space\": \"bt709\",\n        \"color_transfer\": \"bt709\",\n        \"color_primaries\": \"bt709\",\n        \"chroma_location\": \"left\",\n        \"field_order\": \"progressive\",\n        \"refs\": 1,\n        \"is_avc\": \"true\",\n        \"nal_length_size\": \"4\",\n        \"r_frame_rate\": \"24000/1001\",\n        \"avg_frame_rate\": \"24000/1001\",\n        \"time_base\": \"1/1000\",\n        \"start_pts\": 7,\n        \"start_time\": \"0.007000\",\n        \"bits_per_raw_sample\": \"8\",\n        \"extradata_size\": 43,\n        \"disposition\": {\n          \"default\": 1,\n          \"dub\": 0,\n          \"original\": 0,\n          \"comment\": 0,\n          \"lyrics\": 0,\n          \"karaoke\": 0,\n          \"forced\": 0,\n          \"hearing_impaired\": 0,\n          \"visual_impaired\": 0,\n          \"clean_effects\": 0,\n          \"attached_pic\": 0,\n          \"timed_thumbnails\": 0,\n          \"captions\": 0,\n          \"descriptions\": 0,\n          \"metadata\": 0,\n          \"dependent\": 0,\n          \"still_image\": 0\n        },\n        \"tags\": {\n          \"BPS-eng\": \"1667533\",\n          \"DURATION-eng\": \"02:07:01.990000000\",\n          \"NUMBER_OF_FRAMES-eng\": \"182745\",\n          \"NUMBER_OF_BYTES-eng\": \"1588740197\",\n          \"_STATISTICS_WRITING_APP-eng\": \"mkvmerge v52.0.0 ('Secret For The Mad') 64-bit\",\n          \"_STATISTICS_WRITING_DATE_UTC-eng\": \"2023-04-26 12:14:35\",\n          \"_STATISTICS_TAGS-eng\": \"BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\"\n        }\n      },\n      {\n        \"index\": 1,\n        \"codec_name\": \"opus\",\n        \"codec_long_name\": \"Opus (Opus Interactive Audio Codec)\",\n        \"codec_type\": \"audio\",\n        \"codec_tag_string\": \"[0][0][0][0]\",\n        \"codec_tag\": \"0x0000\",\n        \"sample_fmt\": \"fltp\",\n        \"sample_rate\": \"48000\",\n        \"channels\": 6,\n        \"channel_layout\": \"5.1\",\n        \"bits_per_sample\": 0,\n        \"initial_padding\": 312,\n        \"r_frame_rate\": \"0/0\",\n        \"avg_frame_rate\": \"0/0\",\n        \"time_base\": \"1/1000\",\n        \"start_pts\": -7,\n        \"start_time\": \"-0.007000\",\n        \"extradata_size\": 27,\n        \"disposition\": {\n          \"default\": 1,\n          \"dub\": 0,\n          \"original\": 0,\n          \"comment\": 0,\n          \"lyrics\": 0,\n          \"karaoke\": 0,\n          \"forced\": 0,\n          \"hearing_impaired\": 0,\n          \"visual_impaired\": 0,\n          \"clean_effects\": 0,\n          \"attached_pic\": 0,\n          \"timed_thumbnails\": 0,\n          \"captions\": 0,\n          \"descriptions\": 0,\n          \"metadata\": 0,\n          \"dependent\": 0,\n          \"still_image\": 0\n        },\n        \"tags\": {\n          \"language\": \"eng\",\n          \"title\": \"Opus / 5.1 / 48 kHz / 1152 kbps\",\n          \"BPS-eng\": \"774388\",\n          \"DURATION-eng\": \"02:07:09.661000000\",\n          \"NUMBER_OF_FRAMES-eng\": \"381483\",\n          \"NUMBER_OF_BYTES-eng\": \"738540139\",\n          \"_STATISTICS_WRITING_APP-eng\": \"mkvmerge v52.0.0 ('Secret For The Mad') 64-bit\",\n          \"_STATISTICS_WRITING_DATE_UTC-eng\": \"2023-04-26 12:14:35\",\n          \"_STATISTICS_TAGS-eng\": \"BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\"\n        }\n      },\n      {\n        \"index\": 2,\n        \"codec_name\": \"hdmv_pgs_subtitle\",\n        \"codec_long_name\": \"HDMV Presentation Graphic Stream subtitles\",\n        \"codec_type\": \"subtitle\",\n        \"codec_tag_string\": \"[0][0][0][0]\",\n        \"codec_tag\": \"0x0000\",\n        \"r_frame_rate\": \"0/0\",\n        \"avg_frame_rate\": \"0/0\",\n        \"time_base\": \"1/1000\",\n        \"start_pts\": -7,\n        \"start_time\": \"-0.007000\",\n        \"duration_ts\": 7629661,\n        \"duration\": \"7629.661000\",\n        \"disposition\": {\n          \"default\": 1,\n          \"dub\": 0,\n          \"original\": 0,\n          \"comment\": 0,\n          \"lyrics\": 0,\n          \"karaoke\": 0,\n          \"forced\": 0,\n          \"hearing_impaired\": 0,\n          \"visual_impaired\": 0,\n          \"clean_effects\": 0,\n          \"attached_pic\": 0,\n          \"timed_thumbnails\": 0,\n          \"captions\": 0,\n          \"descriptions\": 0,\n          \"metadata\": 0,\n          \"dependent\": 0,\n          \"still_image\": 0\n        },\n        \"tags\": {\n          \"language\": \"eng\",\n          \"title\": \"SDH\",\n          \"BPS-eng\": \"52274\",\n          \"DURATION-eng\": \"02:04:19.077000000\",\n          \"NUMBER_OF_FRAMES-eng\": \"2478\",\n          \"NUMBER_OF_BYTES-eng\": \"48739495\",\n          \"_STATISTICS_WRITING_APP-eng\": \"mkvmerge v52.0.0 ('Secret For The Mad') 64-bit\",\n          \"_STATISTICS_WRITING_DATE_UTC-eng\": \"2023-04-26 12:14:35\",\n          \"_STATISTICS_TAGS-eng\": \"BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\"\n        }\n      }\n    ],\n    \"format\": {\n      \"filename\": \"/data/movie.mkv\",\n      \"nb_streams\": 3,\n      \"nb_programs\": 0,\n      \"format_name\": \"matroska,webm\",\n      \"format_long_name\": \"Matroska / WebM\",\n      \"start_time\": \"-0.007000\",\n      \"duration\": \"7629.661000\",\n      \"size\": \"2351055609\",\n      \"bit_rate\": \"2465174\",\n      \"probe_score\": 100,\n      \"tags\": {\n        \"title\": \"Some Title\",\n        \"creation_time\": \"2023-04-26T12:14:35.000000Z\",\n        \"ENCODER\": \"Lavf58.45.100\"\n      }\n    }\n  },\n  ...\n]\n```\n\n### Media Info Summary File Examplpe\n\n```json\n[\n  {\n      \"filename\": \"/data/movie.mkv\",\n      \"format\": {\n        \"format_name\": \"matroska,webm\",\n        \"format_long_name\": \"Matroska / WebM\",\n        \"bit_rate\": \"9878670\",\n        \"size\": \"7725436645\",\n        \"encoder\": \"libebml v1.4.2 + libmatroska v1.6.4\"\n      },\n      \"video\": {\n        \"codec_name\": \"hevc\",\n        \"codec_long_name\": \"H.265 / HEVC (High Efficiency Video Coding)\",\n        \"profile\": \"Main 10\",\n        \"codec_type\": \"video\",\n        \"coded_width\": 3840,\n        \"coded_height\": 1600,\n        \"avg_frame_rate\": \"24000/1001\"\n      },\n      \"audio\": {\n        \"codec_name\": \"eac3\",\n        \"codec_long_name\": \"ATSC A/52B (AC-3, E-AC-3)\",\n        \"profile\": null,\n        \"codec_type\": \"audio\",\n        \"sample_rate\": \"48000\",\n        \"channels\": 6,\n        \"channel_layout\": \"5.1(side)\"\n      }\n    },\n    ...\n]\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/ravensorb/mediainfo-generator",
        "Repository": "https://github.com/ravensorb/media-info-generator"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5d8ce6c109aada6ff77bac2329b3979ec71edf9958cbc92df910a06886aa828b",
                "md5": "50391604f59f43d62bad1ab444aa125a",
                "sha256": "c2abcafad34238112df4edbdd5e2d3fb801c8828d0a04b9927181d6c3fc2cc5a"
            },
            "downloads": -1,
            "filename": "mediainfo_generator-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "50391604f59f43d62bad1ab444aa125a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 9565,
            "upload_time": "2023-07-10T20:17:29",
            "upload_time_iso_8601": "2023-07-10T20:17:29.349030Z",
            "url": "https://files.pythonhosted.org/packages/5d/8c/e6c109aada6ff77bac2329b3979ec71edf9958cbc92df910a06886aa828b/mediainfo_generator-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7a17a7681e48d3b1c77badaebc2b3c27ba8414995280173cb906a54b119c726a",
                "md5": "30f0bcdbf1e61484806e73cbd525325f",
                "sha256": "845d7f95e321d0a5dbff1bdc82b7cb8dd9a6cffbb9bdfd385142e4b4d1c01ab0"
            },
            "downloads": -1,
            "filename": "mediainfo_generator-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "30f0bcdbf1e61484806e73cbd525325f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 9689,
            "upload_time": "2023-07-10T20:17:31",
            "upload_time_iso_8601": "2023-07-10T20:17:31.080426Z",
            "url": "https://files.pythonhosted.org/packages/7a/17/a7681e48d3b1c77badaebc2b3c27ba8414995280173cb906a54b119c726a/mediainfo_generator-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-10 20:17:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ravensorb",
    "github_project": "mediainfo-generator",
    "github_not_found": true,
    "lcname": "mediainfo-generator"
}
        
Elapsed time: 0.08244s