Skip to content

Instantly share code, notes, and snippets.

@ToshY
Last active May 18, 2020 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ToshY/1e0b615d48ec3bf3f3e510c0e2418ef1 to your computer and use it in GitHub Desktop.
Save ToshY/1e0b615d48ec3bf3f3e510c0e2418ef1 to your computer and use it in GitHub Desktop.
Exiftool for changing metadata (Python 3.x)
# Change metadata like Title, Comment, Description, by using Exiftool
# Tested with ExifTool 11.98 on Win10 and Ubuntu 18.04
import subprocess as sp
def change_file_metadata(input_file, meta_dict={'-Title':'','-Comment':''}):
return sp.check_output(["exiftool", "-api", "largefilesupport=1", "-overwrite_original"] + [ '{}={}'.format(k,v) for k, v in meta_dict.items() ] + [input_file])
change_file_metadata(r"D:\hello_world.mp4",{'-Title':'Hello Darkness','-Comment':'My Old Friend'})
# b' 1 image files updated\r\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment