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 get_metadata_as_dict
metadata_dict = get_metadata_as_dict('path/to/file')
And voilà, you get a dict with the following structure:
keys are track types (General/Audio/Video)
values are dicts “{tag: tag_value}”
If you want to parse the MediaInfo returned String yourself you can do it with:
from libmediainfo_cffi import get_metadata
metadata_string = get_metadata(path)
Now you have a formatted string, happy parsing!
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, so a bit easier to read (don’t be mistaken, this library is PyPy compatible too, and it works great!) and supports Python 2 (while this library doesn’t and won’t) and has crossplatform capabilities (since 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for libmediainfo_cffi-2.0.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a79a93e18559a8dfc96ad1e7af7910b52f2f7e690d50fdc202c2bdc1ade7df58 |
|
MD5 | f5e42580401e405d29c53cbfc7a251c0 |
|
BLAKE2b-256 | 9ab0ba0e97587fc881d1647bcc850ff2c6d1f528e92bc901d412515405bc9312 |