Looking for speed up suggestions

Started by Sawfish, November 22, 2020, 10:06:15 PM

Previous topic - Next topic

Sawfish

I recently wrote  a c-shell script for a project that required several thousand .tif and .jpg files that had incorrectly rendered Croatian names and placenames to have these letters replaced with the proper Croatian letters. I used exiftool to extract the contents of  four informational tags: ImageDescription, Description, Caption-Abstract, and Headline., store them in a vairable, then run a sed script over the contents of the variable and write them back into the same tags, overwriting the file.

This worked well but took approximately 4 hours (240 min).

After delivery I wanted to teach myself Python, so I re-wrote the shell script in Python 3. I got it to run, and have been tweaking it in hopes of a speed up. I have gotten it down from 291 minutes for the first fully functional run to 216 minutes. Mainly this was by limiting the frequency of  subprocess calls to exiftool, using -execute. 6562 files were processed.

I am new to both Python and to exiftool, and wonder if there are any here who would be willing to look at the code and offer up speed up ideas on this forum.

If so, let me know and I will post the main function part of the code.

StarGeek

Have you checked out PyExifTool?  It's a Python wrapper for exiftool that keeps exiftool running and will help speed things up.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Sawfish