Author Topic: Looking for way to name file to modification time  (Read 3630 times)

Offline NickML

  • Newcomer
  • *
  • Posts: 15
    • View Profile
Looking for way to name file to modification time
« on: November 21, 2013, 07:11:42 AM »
I've been using Photo Mechanic 5 (build 15011, 54772e6) on a Mac to import and rename some .avi videos from a trail camera (remotely operated wildlife camera).

I've been experiencing a problem where the IPTC creation date and times don't match the actual creation date or time. As far as I can tell, I believe this is probably the camera's problem, not that of PM. In short: the modification date/time is correct on the .avi file, but the iptc date/time and creation iptc/time are incorrect, so the regular time variables can't be used.

What I would like to do is this: upon ingest, I would like the file to be renamed with the equivalent of {modifyyear4}{modifymonth0}{modifyday0}-{modifyhour0}{modifyminute}. Obviously, those variables don't exist. Is there any way of doing this ?

Thanks in advance - Nick

Offline Brandon

  • Member
  • **
  • Posts: 85
    • View Profile
Re: Looking for way to name file to modification time
« Reply #1 on: November 21, 2013, 11:06:30 AM »
NickML,

Quick question: If you look at the creation date/time of the files while they're still on the card is it correct?


In your IPTC Stationary Pad you can change the "IPTC Date" section to apply the Capture Time to the "IPTC Date", or you can apply the Modification Time to the "IPTC Date."

If you need to fix existing files then you can use the stationary pad to apply the modification time to the IPTC Date/Time, then use the IPTC Date and Time variables to rename your files.

You can use EXIFTool to update the creation time if you follow the format: Section 5  http://www.sno.phy.queensu.ca/~phil/exiftool/faq.html

Main page: http://www.sno.phy.queensu.ca/~phil/exiftool/

If you want to preserve the original filenames then you can apply the {fbas} variable to an empty field in the file. Assuming you've updated the IPTC Date with the Modification Date from the stationary pad as mentioned above, you'd then use the rename tool using this string:

IMG_{iptcyear4}{iptcmonth0}{iptcday0}_{iptchour24}{iptcminute}{iptcsecond}

Next you'll need exiftool and run: exiftool -o "outputdirectory/" "-alldates<filename" "source directory of images"

Do note that it's creating a new directory for your fixed images. The originals are not 'fixed'
exiftool will pull the date info from the filename and write it into the creation date/time of a new file. Then you can go back to photo mechanic and rename your files back using the variable you stored the original filename in.
« Last Edit: November 21, 2013, 11:38:36 AM by Brandon »

Offline NickML

  • Newcomer
  • *
  • Posts: 15
    • View Profile
Re: Looking for way to name file to modification time
« Reply #2 on: November 21, 2013, 11:59:30 AM »
NickML,

Quick question: If you look at the creation date/time of the files while they're still on the card is it correct?
Yes. To give two examples:

0001.avi:
Reading from the card:
Mac finder creation date: 20/11/13, 10.31am
Mac finder last modification date: 20/11/13, 10.32am
After ingest:
{iptcday0}{iptcmonthname3}{iptcyear2}-{iptchour24}{iptcminute}
resolves incorrectly as 21Nov13-1020
and {day0}{monthname3}{year2}-{hour24}{minute}
resolves incorrectly as  05Nov13-1020
(The 05 appears to be from the last time {day0} was used in Stationary Pad).

0002.avi:
Mac finder creation date: 21/11/13, 12.38pm
Mac finder last modification date: 21/11/13, 12.39pm
After ingest:
{iptcday0}{iptcmonthname3}{iptcyear2}-{iptchour24}{iptcminute}
resolves incorrectly as 21Nov13-1022
and {day0}{monthname3}{year2}-{hour24}{minute}
resolves incorrectly as  05Nov13-1022

In your IPTC Stationery Pad you can change the "IPTC Date" section to apply the Capture Time to the "IPTC Date", or you can apply the Modification Time to the "IPTC Date."

Using the local stationery pad in the Ingest dialog: date is currently checked, and set to "today". However, if I try to change this to "capture" or "modification time", the change doesn't seem to 'stick': if I close, then reopen the pad, the setting had returned to "today". Unchecking it gives me an incorrect time/date of 05Nov13, 10.22pm

If, after ingesting, I use stationary Pad to change the date to modification time, it gives me 05Nov13, 10.22pm. The relevance of that date is not at all clear to me; it might be a legacy date from a previous job, but I've shot a lot of other jobs since then.

Thanks for the other links: I'll look into those now, but obviously I'd prefer to keep my workflow as simple as possible if I can.

Nick
« Last Edit: November 21, 2013, 12:01:21 PM by NickML »

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24767
    • View Profile
    • Camera Bits, Inc.
Re: Looking for way to name file to modification time
« Reply #3 on: November 21, 2013, 12:18:46 PM »
Nick,

In your IPTC Stationery Pad you can change the "IPTC Date" section to apply the Capture Time to the "IPTC Date", or you can apply the Modification Time to the "IPTC Date."

Using the local stationery pad in the Ingest dialog: date is currently checked, and set to "today". However, if I try to change this to "capture" or "modification time", the change doesn't seem to 'stick': if I close, then reopen the pad, the setting had returned to "today". Unchecking it gives me an incorrect time/date of 05Nov13, 10.22pm

Turn off the setting "Always Use Today’s Date in Stationery Pad" in the IPTC/XMP Prefs.

http://wiki.camerabits.com/en/index.php?title=User_Manual_Flat_View#IPTC.2FXMP_Preferences

-Kirk

Offline NickML

  • Newcomer
  • *
  • Posts: 15
    • View Profile
Re: Looking for way to name file to modification time
« Reply #4 on: November 21, 2013, 01:10:01 PM »
Thanks, Kirk - that (indirectly) has solved it. I wonder if it was some temporary glitch with my version of PM, which must have been running for weeks if not months on the laptop without being shut down. I unchecked that box, which had no effect, and ran six or seven variants of the same ingest without success. Then I thought of quitting, which led to a hang, and I force quit. On restarting PM it took longer than normal, then told me an update was available, then the web page told me my licence had expired in 2004 (I renewed last when 5 came out). However, ingesting now works normally with the files, which are renamed correctly. Incidentally, quitting and restarting PM doesn't bring up the "update" or "licence expired" warnings. So one way or another, I have it working again. Thank you both for your help again.
« Last Edit: November 21, 2013, 01:22:41 PM by NickML »

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24767
    • View Profile
    • Camera Bits, Inc.
Re: Looking for way to name file to modification time
« Reply #5 on: November 21, 2013, 01:54:02 PM »
Nick,

Thanks, Kirk - that (indirectly) has solved it. I wonder if it was some temporary glitch with my version of PM, which must have been running for weeks if not months on the laptop without being shut down. I unchecked that box, which had no effect, and ran six or seven variants of the same ingest without success. Then I thought of quitting, which led to a hang, and I force quit. On restarting PM it took longer than normal, then told me an update was available, then the web page told me my licence had expired in 2004 (I renewed last when 5 came out). However, ingesting now works normally with the files, which are renamed correctly. Incidentally, quitting and restarting PM doesn't bring up the "update" or "licence expired" warnings. So one way or another, I have it working again. Thank you both for your help again.

Please go to the downloads page and get the latest version:

http://www.camerabits.com/download/

It won't complain about expired licenses.  The current build as of this writing is 15077.

-Kirk

Offline NickML

  • Newcomer
  • *
  • Posts: 15
    • View Profile
Re: Looking for way to name file to modification time
« Reply #6 on: November 22, 2013, 05:34:31 AM »
Thanks again Kirk: have done so.