Skip to main content

No project description provided

Project description

Generate Media Info

PyPI - Downloads

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

pip install mediainfo-generator

Then you can run it like this

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)

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


Build

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

[
  {
    "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

[
  {
      "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)"
      }
    },
    ...
]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mediainfo_generator-0.1.1.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

mediainfo_generator-0.1.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file mediainfo_generator-0.1.1.tar.gz.

File metadata

  • Download URL: mediainfo_generator-0.1.1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.10.6 Linux/5.15.0-76-generic

File hashes

Hashes for mediainfo_generator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 845d7f95e321d0a5dbff1bdc82b7cb8dd9a6cffbb9bdfd385142e4b4d1c01ab0
MD5 30f0bcdbf1e61484806e73cbd525325f
BLAKE2b-256 7a17a7681e48d3b1c77badaebc2b3c27ba8414995280173cb906a54b119c726a

See more details on using hashes here.

File details

Details for the file mediainfo_generator-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mediainfo_generator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c2abcafad34238112df4edbdd5e2d3fb801c8828d0a04b9927181d6c3fc2cc5a
MD5 50391604f59f43d62bad1ab444aa125a
BLAKE2b-256 5d8ce6c109aada6ff77bac2329b3979ec71edf9958cbc92df910a06886aa828b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page