I am using the script from this answer. I have made one minor modification, which is listed below.
Modification 1
sentinel = "{ready}\n"
def __init__(self, executable="/usr/local/bin/"):
self.executable = executable
def __enter__(self):
app = "exiftool"
command_line = [app, "stay_open", "True", "-@", "-"]
self.process = subprocess.Popen(command_line, executable=app, universal_newlines=True,
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
return self
The rest of the answer posted in the original link is completely unchanged.
I call the above as follows,
def main():
filename = r"/Volumes/backup/2017/MOV_0004.mp4"
with ExifTool.ExifTool() as e:
metadata = e.get_metadata(*filename)
json_str = json.dumps(metadata, indent=2)
print (json_str)
For some odd reason this works absolutely fine on Windows, but I just can't get it to work on a Mac.
In order to get this to work on Windows, I change the one line sentinel = "{ready}\n"
. I am using python 3.7.1 on the Mac and python 3.6.1 on Windows.
Would appreciate any advice.