Skip to main content

CFFI interface for libmediainfo

Project description

This library provides a convenient CFFI wrapper for libmediainfo, a lightweight library that displays information about video and audio files. Supported attributes here.

Quickstart

Easy enough:

from libmediainfo_cffi import MediaInfo
data = MediaInfo.read_metadata(path)

You can also pass options, e.g. if you want JSON output:

from libmediainfo_cffi import MediaInfo
data = MediaInfo.read_metadata(path, Inform='JSON')

Differences between this and pymediainfo

The main difference is that this library uses the API mode of CFFI, while pymediainfo uses the ABI mode. Libmediainfo_cffi approach is safer and faster but it’s a bit more complicated to debug, since you need to wrap the C++ mediainfo library in C to comunicate with Python.
On the other hand pymediainfo is more tested, Python only (but needs libmediainfo installed, while with this library you don’t) and supports Python 2 (while this library doesn’t and won’t) and has better crossplatform capabilities (since, again, it uses ABI mode).

Installation

pip install libmediainfo_cffi

Development

Download the source, launch make setup and start tinkering.
Note: the .cpp and .h file in the libmediainfo_cffi directory are not used directly, but read as strings and fed to CFFI. They are useful only for IDE code hinting. Don’t try to compile them with CMake, it won’t work.

Licenses

Copyright (c) 2019 Alessandro Cerruti

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

This product uses MediaInfo library, Copyright (c) 2002-2019 MediaArea.net SARL.

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

libmediainfo_cffi-2.1.5.tar.gz (3.9 kB view details)

Uploaded Source

Built Distributions

libmediainfo_cffi-2.1.5-cp37-cp37m-manylinux1_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.7m

libmediainfo_cffi-2.1.5-cp36-cp36m-manylinux1_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.6m

File details

Details for the file libmediainfo_cffi-2.1.5.tar.gz.

File metadata

  • Download URL: libmediainfo_cffi-2.1.5.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3

File hashes

Hashes for libmediainfo_cffi-2.1.5.tar.gz
Algorithm Hash digest
SHA256 650fa36f7caa2a806d130ea9da9294c77d37c245b3b9cb58b5181a340def459f
MD5 61ebbd8715c644011de766a02bfc7054
BLAKE2b-256 3f007ed66b2264949b71044361d15ca4e06876d5869ad0a763bd1b7199079fb6

See more details on using hashes here.

File details

Details for the file libmediainfo_cffi-2.1.5-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: libmediainfo_cffi-2.1.5-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 6.2 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3

File hashes

Hashes for libmediainfo_cffi-2.1.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5a62febeb0f8028d722b331c677e99adc8e72000ed418349913c85d7d469d5ff
MD5 148805b6c037bf6d94fe3cae4bc324cc
BLAKE2b-256 c1169ee3a31bccf2a1f1af33a855939169ffbceff80e00b3c8ec099a5275269e

See more details on using hashes here.

File details

Details for the file libmediainfo_cffi-2.1.5-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: libmediainfo_cffi-2.1.5-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 6.2 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3

File hashes

Hashes for libmediainfo_cffi-2.1.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6524796ff98c02de1da117fd8fab3d7ff7d1b205137941b680cbf7a7f2c52f16
MD5 1a14f060dc4e60357ea13ce36373edc2
BLAKE2b-256 fd27f623fa976992a60455dd621e9a7e6811c3e558350cdd146ef4e541c4f24c

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