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 : advanced DCP validation tool, including (non exhaustive) :

    • SMPTE / Interop standard convention (naming, …)

    • 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 :

    • Should work on python 2.7 and python 3.4+

    • Tested on : python 2.7, python 3.6

  • Platform :

    • Should work on Windows, macOS, Linux

    • Tested on : macOS 10.12

  • External (non-python) dependencies :

    • asdcplib

    • mediainfo (opt)

    • sox (opt)

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

pip install clairmeta

Install from Debian package (all requirements will be automatically installed):

# Optional : add Bintray public key
apt-get install dirmngr
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 379CE192D401AB61
gpg --export --armor 379CE192D401AB61 | apt-key add -

# Add Clairmeta repository to apt sources
# Replace <distro> appropriately
# Ubuntu 14.04 : use trusty
# Ubuntu 16.04 : use xenial
# Ubuntu 17.04 : use artful
# Ubuntu 18.04 : use bionic
echo "deb https://dl.bintray.com/ymagis/Clairmeta <distro> main" | sudo tee /etc/apt/sources.list.d/clairmeta.list

sudo apt-get update
sudo apt-get install python3-clairmeta

Usage

General

As a command line tool :

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
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")
# Parse DCP
dcp.parse()
# Check DCP
status, report = dcp.check()
# Check DCP VF against OV
status, report = dcp.check(ov_path="/path/to/dcp_ov")

# Check DCP with default 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 criteria 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 bypassing, 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 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, use pipenv :

pip install pipenv
git clone https://github.com/Ymagis/ClairMeta.git
cd clairmeta
pipenv install --dev [--two]
pipenv check
# Enter virtual environment
pipenv shell
# Code...
# Get tests resources
git clone https://github.com/Ymagis/ClairMeta_Data tests/resources
# Run tests
nosetests --nocapture --with-doctest --doctest-options=+ELLIPSIS --with-coverage --cover-package=clairmeta
# Leave virtual environment
exit
  • 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.1.1.tar.gz (89.1 kB view details)

Uploaded Source

Built Distribution

clairmeta-1.1.1-py2.py3-none-any.whl (115.8 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: clairmeta-1.1.1.tar.gz
  • Upload date:
  • Size: 89.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/2.7.15

File hashes

Hashes for clairmeta-1.1.1.tar.gz
Algorithm Hash digest
SHA256 89de5fd9b1383545408f346b05fbcc229d8d973e91722493d8c006900298bc30
MD5 2b29353d52d8d9ace54bf9549a492c41
BLAKE2b-256 0286351f6b03184389205c1fc7aaffd4fee375b2c3d062c87ec71e66ae92ca32

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clairmeta-1.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 115.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/2.7.15

File hashes

Hashes for clairmeta-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e2fe9e4db8d2158afd14d0101684c3a92284d88b0f0a5517e38a9d4b3c989a78
MD5 8b6220d74f10872db6a3232d0bc71d47
BLAKE2b-256 68db1a8404393856b0c54f40c66f59c4efe3028a0f17a71571aa76346521a67d

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