Skip to main content

Digital Cinema Package (DCP) probing and checking utility

Project description

Build Status PyPI version Code coverage

ClairMeta

ClairMeta is a python package for Digital Cinema Package (DCP) probing and checking.

Features

  • DCP Probe:
    • Metadata extraction of the whole DCP, including all XML fields and MXF assets inspection.

  • DCP Checker:
    • SMPTE / Interop standard convention

    • Integrity (MIME type, size, hash) of all assets

    • Foreign file identification

    • XSD Schema validation for XML files (VOLINDEX, ASSETMAP, CPL, PKL)

    • Digital signature validation (CPL, PKL)

    • Intra / Inter Reels integrity and coherence

    • Metadata match between CPL assets and MXF headers

    • Re-link VF / OV

    • Picture tests : FrameRate, BitRate

    • Sound tests : Channels, Sampling

    • Subtitle : Deep inspection of Interop and SMPTE subtitles

  • DSM / DCDM Checker:
    • Basic image file sequence validation with some specific rules.

Installation

Requirements:

  • Python: 3.6 or later

  • Platform: Windows (with limitations), macOS, Linux

  • External (non-python) dependencies:
    • asdcplib

    • mediainfo (opt)

    • sox (opt)

Install from PyPI package (this does not install external dependencies):

pip install clairmeta

If you need help installing the external dependencies, you can have a look at our continuous integration system, specifically the .github folder.

Usage

General

As a command line tool:

# Probing
python3 -m clairmeta.cli probe -type dcp path/to/dcp
python3 -m clairmeta.cli probe -type dcp path/to/dcp -format json > dcp.json
python3 -m clairmeta.cli probe -type dcp path/to/dcp -format xml > dcp.xml

# Checking
python3 -m clairmeta.cli check -type dcp path/to/dcp
python3 -m clairmeta.cli check -type dcp path/to/dcp -format json > check.json
python3 -m clairmeta.cli check -type dcp path/to/dcp -format xml > check.xml
python3 -m clairmeta.cli check -type dcp path/to/dcp -kdm /path/to/kdm -key /path/to/privatekey
python3 -m clairmeta.cli check -type dcp path/to/dcp -progress

As a python library:

from clairmeta import DCP

dcp = DCP("path/to/dcp")
dcp.parse()
status, report = dcp.check()
# Check DCP VF against OV
status, report = dcp.check(ov_path="/path/to/dcp_ov")
# DCP check with console progression report
from clairmeta.utils.file import ConsoleProgress

status, report = dcp.check(hash_callback=ConsoleProgress())
# Alternatives
# - function matching utils.file.ConsoleProgress.__call__ signature
# - derived class from utils.file.ConsoleProgress

Profiles

Check profile allow custom configuration of the DCP check process such as bypassing some unwanted tests or error level specification. To implement a check profile, simply write a JSON file derived from this template (actual content listed below is for demonstration purposes only):

  • criticality key allow custom criteria level specification, check name can be incomplete to quickly ignore a bunch of tests, default is used if no other match where found.

  • bypass key allow specific test bypass, incomplete names are not allowed.

{
    "criticality": {
        "default": "ERROR",
        "check_dcnc_": "WARNING",
        "check_cpl_reel_duration_picture_subtitles": "WARNING",
        "check_picture_cpl_avg_bitrate": "WARNING",
        "check_picture_cpl_resolution": "WARNING"
    },
    "bypass": ["check_assets_pkl_hash"]
}

Custom profile check:

python3 -m clairmeta.cli check -type dcp path/to/dcp -profile path/to/profile.json
from clairmeta import DCP
from clairmeta.profile import load_profile

dcp = DCP("path/to/dcp")
profile = load_profile("/path/to/profile.json")
status, report = dcp.check(profile=profile)

Logging

Logging is customizable, see the settings.py file or below. By default ClairMeta logs to stdout and a rotated log file.

'level': 'INFO'  # Minimum log level
'enable_console': True  # Enable / Disable stdout logging
'enable_file': True  # Enable / Disable file logging
'file_name': '/log/path/clairmeta.log'  # Log file absolute path
'file_size': 1e6  # Individual log file maximum size
'file_count': 10  # Number of files to rotate on

Contributing

  • To setup your environment follow these steps:

git clone https://github.com/Ymagis/ClairMeta.git
cd clairmeta
git clone https://github.com/Ymagis/ClairMeta_Data tests/resources

pip install pipenv
pipenv install --dev
pipenv shell

# Code... and tests
pytest --doctest-modules
  • Open a Pull Request

  • Open an Issue

Changes

The release changes are available on Github: https://github.com/Ymagis/ClairMeta/releases

References

The following sources / software were used:

About

http://www.ymagis.com/

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

clairmeta-1.2.1.tar.gz (93.7 kB view details)

Uploaded Source

Built Distribution

clairmeta-1.2.1-py2.py3-none-any.whl (121.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file clairmeta-1.2.1.tar.gz.

File metadata

  • Download URL: clairmeta-1.2.1.tar.gz
  • Upload date:
  • Size: 93.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for clairmeta-1.2.1.tar.gz
Algorithm Hash digest
SHA256 517efa51352273e264fceb6f698f8110a7d1a028bdf4375fe20b829cb2f6ab22
MD5 132b8aeb6847cc9aa27b0996c2240c28
BLAKE2b-256 182db97b3c2fee5f6d944d251b3d5c2384f4bac9fbede55697960a9fafff152d

See more details on using hashes here.

File details

Details for the file clairmeta-1.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: clairmeta-1.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 121.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for clairmeta-1.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fefdf44fc9f9e7bf6f4f898e8aac272afe6fe7ec6ed110686f7619aac18a81dc
MD5 7d865e84dc8fa20edbd96a19fb82b722
BLAKE2b-256 6e120676c7fc31418d33e1748bed1b53a712f006e397691691643bd46dee5b72

See more details on using hashes here.

Supported by

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