pymediainfo
A Python wrapper for the MediaInfo library.
What it is and what it does
pymediainfo is a Python wrapper around the MediaInfo library that extracts detailed metadata from multimedia files. It parses video, audio, image, and other media tracks into structured Python objects with attributes like bitrate, frame rate, codec, duration, and dimensions. The package supports Linux, macOS, and Windows, with wheels bundling MediaInfo for common architectures; however, it requires the external MediaInfo library to be present on the system to actually parse files—without it, the package can only process pre-generated XML output from MediaInfo.
You use it by calling `MediaInfo.parse()` with a file path, which returns a `MediaInfo` object containing a list of `Track` objects. Each track's attributes are dynamically populated during parsing and can be accessed directly or converted to a dictionary. The package also supports text output similar to the command-line `mediainfo` tool and can parse existing MediaInfo XML strings directly.
Use it for:
- Extract video codec, bitrate, frame rate, and duration from media files for transcoding pipelines or quality assessment
- Retrieve image dimensions, format, and file size for thumbnail generation or asset validation workflows
- Batch analyze audio tracks to identify channel layout, sample rate, and compression mode for media library cataloging
- Parse pre-generated MediaInfo XML output when the MediaInfo binary is not available on the deployment system
- Build media validation tools that check file properties against expected specifications before processing
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pymediainfo extracts detailed metadata from multimedia files by wrapping the MediaInfo library, parsing video, audio, and image properties into structured Python objects.
Yes, if you need to extract multimedia metadata in Python and can ensure the MediaInfo library is installed on your system. The package is stable (Production/Stable status), supports modern Python versions (3.9–3.13), has no known vulnerabilities, and carries a permissive MIT license. However, maintenance is dormant and the external MediaInfo dependency adds installation complexity; verify that your deployment environment can satisfy this requirement before adopting.
Install
pymediainfo on PyPI
pip
pip install pymediainfouv
uv add pymediainfopoetry
poetry add pymediainfoInstalling pymediainfo
Before you install
Medium install friction: wheels are available for Linux x86-64/ARM64, macOS x86-64/ARM64, and Windows x86/x86-64, but the package requires the external MediaInfo library to be present on the system to parse files. Maintenance is dormant (548 days since last release), though the repository remains active with a recent commit on 2025-02-12.
License in practice
MIT license is permissive and imposes no significant restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
from pymediainfo import MediaInfo
media_info = MediaInfo.parse("/path/to/file.mp4")
for track in media_info.tracks:
print(f"Track type: {track.track_type}, Bit rate: {track.bit_rate}")
The MediaInfo library must be installed on your system; pymediainfo cannot parse media files without it. Wheels bundle MediaInfo for common platforms, but Linux distribution packages or system installation may be required on other systems.
Verify before relying
- Performance characteristics when parsing large files or batch processing multiple media files
- Completeness of metadata extraction across different media formats and codecs
- Whether dormant maintenance status affects compatibility with newer MediaInfo library versions
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 548 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,551,681/month — #3,003 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pymediainfo-7.0.1-py3-none-macosx_10_10_universal2.whl; pymediainfo-7.0.1-py3-none-manylinux_2_27_aarch64.whl; pymediainfo-7.0.1-py3-none-manylinux_2_27_x86_64.whl; pymediainfo-7.0.1-py3-none-win32.whl; pymediainfo-7.0.1-py3-none-win_amd64.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
knowitExtracts detailed metadata from media files…
permissive · top 15,000 on PyPI
audiofileReads and writes audio files across formats…
permissive · top 15,000 on PyPI
pyaaf2Read, write, and modify Advanced Authoring…
permissive · top 15,000 on PyPI
imageio-ffmpegProvides a simple Python wrapper around ffmpeg…
permissive · top 5,000 on PyPI
pyobjc-framework-AVFoundationProvides Python bindings to macOS's…
permissive · top 15,000 on PyPI
filetypeInfers file type and MIME type by examining…
permissive · top 1,000 on PyPI
trakitParses track names and filenames to extract…
permissive · top 15,000 on PyPI
scikit-videoscikit-video reads, writes, and analyzes video…
permissive · top 5,000 on PyPI
ffmpyffmpy is a Python wrapper around FFmpeg that…
permissive · top 5,000 on PyPI