I can get the Movie name from my avi files with the command line
mediainfo --Inform="General;%Movie%" file.avi
In python I have access to the mediainfo structure
mediainfo = MediaInfo.parse(filename)
But nowhere can I find out how the command line matches to the data structure. The sparse documentation and all examples talk about track structures, when my item is in General
NO IDEA WHY THIS SITE ONLY ALLOWS VERY SHORT COMMENTS, BELOW IS A COMMENT
I am confused. The code I'm looking at is nemo-media-columns.py (https://github.com/linuxmint/nemo-extensions/blob/master/nemo-media-columns/nemo-media-columns.py) has
from pymediainfo import MediaInfo ... mediainfo = MediaInfo.parse(filename)
duration = 0
for trackobj in mediainfo.tracks:
track = trackobj.to_data()
if track["track_type"] == "Video":
try:
info.pixeldimensions = "%dx%d" % (track["width"], track["height"])
except:
pass
Which is entirely different syntax from your suggestion, and the example talks about DLLs which don't exist in my Linux world. I'm baffled with it all, and as the code is buried within the application diagnostics are hard.
mediainfo --Inform="General;%Movie%" file.avi
The Python equivalent is:
MI = MediaInfo()
MI.Open("file.avi")
MI.Get(Stream.General, 0, "Movie")
You can have examples about how to use the Python binding (including the list of field names) at this place.
Edit for answering your edit: your first question was about MediaInfo within Python (and is still the title of the question), not "pymediainfo", I answered with MediaInfo within Python. MediaInfo has a Python binding (for Windows/macOS/Linux, "DLL" stands for dynamic loaded library and is the generic name in MediaInfo for all platforms, it works well within Windows .dll, Linux .so and macOS .dylib) and my example works very well on your "Linux world"; pymediainfo is a third party binding with its own interface but in practice this is similar field names as pymediainfo uses MediaInfo field names. FYI "Movie" and "Title" are synonym in MediaInfo, pymediainfo prefered "title". In short, if you use pymediainfo indicate that you use pymediainfo so people are not confused when you want an answer about pymediainfo but you say you use MediaInfo within Python.
Jérôme, developer of MediaInfo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With