Skip to main content

Python package for easily interfacing with MediaCatch APIs and data formats.

Project description

Python package for easily interfacing with MediaCatch APIs and data formats. Documentation can be found at api.mediacatch.io/mediacatch/docs/.

Requirements

Installation

Install with pip

pip install mediacatch

Getting Started

Firstly, add your MediaCatch API key to your environment variables

export MEDIACATCH_API_KEY=<your-api-key-here>

Then you can start using the command line interface

mediacatch --help
usage: mediacatch <command> [<args>]

MediaCatch CLI tool

positional arguments:
  {speech,vision,viz}  mediacatch command helpers
    speech             CLI tool to run inference with MediaCatch Speech API
    vision             CLI tool to run inference with MediaCatch Vision API
    viz                CLI tool to visualize the results of MediaCatch

options:
  -h, --help           show this help message and exit

Upload a file to MediaCatch Speech API and get the results

mediacatch speech path/to/file --save-result path/to/save/result.json
# or to see options
mediacatch speech --help

Upload a file to MediaCatch vision API and get the results

mediacatch vision ocr path/to/file --save-result path/to/save/result.json
# or to see options
mediacatch vision --help

Or import as a module

from mediacatch.vision import upload, wait_for_result

file_id = upload(
  fpath='path/to/file',
  type='ocr',
  # Optional parameters with their default values
  fps=1, # Frames per second for video processing. Defaults to 1.
  tolerance=10, # Tolerance for text detection. Defaults to 10.
  min_bbox_iou=0.5 # Minimum bounding box intersection over union for text detection. Defaults to 0.5.
  min_levenshtein_ratio=0.75 # Minimum Levenshtein ratio for merging text detection (more info here: https://rapidfuzz.github.io/Levenshtein/levenshtein.html#ratio). Defaults to 0.75.
  moving_threshold=50, # If merged text detections center moves more pixels than this threshold, it will be considered moving text. Defaults to 50.
  max_text_length=3, # If text length is less than this value, use max_text_confidence as confidence threshold. Defaults to 3.
  min_text_confidence=0.5, # Confidence threshold for text detection (if text length is greater than max_text_length). Defaults to 0.5.
  max_text_confidence=0.8, # Confidence threshold for text detection (if text length is less than max_text_length). Defaults to 0.8.
  max_height_width_ratio=2.0, # Discard detection if height/width ratio is greater than this value. Defaults to 2.0.
  get_detection_histogram=False, # If true, get histogram of detection. Defaults to False.
  detection_histogram_bins=8, # Number of bins for histogram calculation. Defaults to 8.
)

result = wait_for_result(file_id)

Visualize the results from MediaCatch

mediacatch viz ocr path/to/file path/to/result.json path/to/save.mp4
# or to see options
mediacatch viz --help

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

mediacatch-0.5.1.tar.gz (346.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mediacatch-0.5.1-py3-none-any.whl (187.1 kB view details)

Uploaded Python 3

File details

Details for the file mediacatch-0.5.1.tar.gz.

File metadata

  • Download URL: mediacatch-0.5.1.tar.gz
  • Upload date:
  • Size: 346.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mediacatch-0.5.1.tar.gz
Algorithm Hash digest
SHA256 a8bd5fc3c2ecf56f28db424d130514d3560dac7c3b1b0d45667b59a5cdf55f76
MD5 83bc33f4854d431264d3e5ce55501c3d
BLAKE2b-256 49b529dbc79706b821ce796ef6668c07c72b651dde4e7cb66d0fb66e93f296a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for mediacatch-0.5.1.tar.gz:

Publisher: publish.yaml on mediacatch/mediacatch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mediacatch-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: mediacatch-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 187.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mediacatch-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d6b9717c27b6450732a18b5238e8e516ab3695a6b7c7274919c12de5b04e8f9
MD5 25e73ad27dd5e8c48dac200970721acf
BLAKE2b-256 545159d9b67f5ee72bdfb9216dcedf71031bff3e64123819c465c27feb9d69a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mediacatch-0.5.1-py3-none-any.whl:

Publisher: publish.yaml on mediacatch/mediacatch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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