PyMediaInfo-PyroFork

raw JSON →
6.0.2 verified Mon Apr 27 auth: no python

A Python wrapper for the mediainfo library, forked to support newer Python versions and provide up-to-date bindings. Current version is 6.0.2, requiring Python 3.9+. Released regularly with mediainfo dependency updates.

pip install pymediainfo-pyrofork
error FileNotFoundError: [Errno 2] No such file or directory: 'mediainfo'
cause mediainfo CLI not installed on system PATH.
fix
Install mediainfo via system package manager or download from MediaInfo website.
error AttributeError: module 'pymediainfo' has no attribute 'MediaInfoParser'
cause Using deprecated class name.
fix
Use from pymediainfo import MediaInfo and MediaInfo.parse(...).
error TypeError: 'MediaInfoList' object is not subscriptable
cause Old code accessing result as single object, but new version returns list for single file (can be subscripted). This error may appear if the returned type is not a list but a single object; actually in this case it's subscriptable, but if an older script treats it as a single object, it will fail.
fix
Use result = MediaInfo.parse('file.mp4') then result.general_tracks[0] if result is not a list; check type. For consistency, use track = result[0] if isinstance(result, list) else result.
breaking The mediainfo CLI tool must be installed separately on the system. Python-only install may fail at runtime with "FileNotFoundError".
fix Install mediainfo using system package manager (e.g., apt install mediainfo, brew install mediainfo, or download from https://mediaarea.net/en/MediaInfo).
deprecated The old `MediaInfo.parse` returned a `MediaInfo` object; now it returns a `MediaInfoList` if multiple files are parsed. Access single file results with indexing.
fix Use `MediaInfo.parse('file.mp4')[0]` or iterate over the result if multiple files.
gotcha Empty fields in mediainfo output are returned as None, not empty string. Comparisons may fail if expecting string.
fix Use `field or ''` or check for None explicitly.

Parse a media file and print general track information as dict.

from pymediainfo import MediaInfo

media_info = MediaInfo.parse('video.mp4')
print(media_info.general_tracks[0].to_data())