definition of -DateTimeOriginal

Started by Big_Lynx, July 05, 2011, 03:06:12 PM

Previous topic - Next topic

Big_Lynx

Hi,

sorry for asking that question if it is already answered somewhere on the forum. I was trying hard but finally was not able to find an answer.

My issue is relatively simple. I do a lot of scans from analog films. Then I want to define proper - as much as possible - DateTimeOriginal for each file. I do not want to shift the date - just to define it.

First - I do not have any date (beside "Modify Date") defined in my scan, that is why "exiftool -DateTimeOriginal test.tif" produces no output.

-->> How to define DateTimeOriginal for the first file in a directory?

The idea is to define the time for each file in the directory the same as for first one but shifted by couple of minutes forward


thanks

Phil Harvey

Adding a couple of minutes to subsequent files in a directory would be very tricky.

Also, just writing to the first file in a directory is somewhat problematic.  The directory order is not well defined and varies on different systems.

The best thing would be if the filesystem modification time is still valid, then you could do something like this:

exiftool "-datetimeoriginal<filemodifydate" DIR

to set DateTimeOriginal from the filesystem modification date for all files in a directory.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Big_Lynx

The directory order is properly determined by two factors: file name and file creation date. Frames are scanned in proper order. I do not want to set datetimeoriginal equal to filemodifydate because file creation date is significantly different then date of a shot. What I need is the following:

file.1 - datetimeoriginal=1971/10/1 10:30
file.2 - datetimeoriginal=1971/10/1 10:35
file.3 - datetimeoriginal=1971/10/1 10:40
....

Tomek

Phil Harvey

Interestingly, I found a thread where another user gives a .BAT file which very nearly does exactly what you want:

https://exiftool.org/forum/index.php/topic,3221

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Big_Lynx

Indeed solution is rather simple. Very raw (for further development) script for my task is the following:

#!/bin/bash
#
s_date="2011:03:19"
s_minute=40
s_hour=15
delta=15

echo "$# file(s) to update"

current_minute=$s_minute
current_hour=$s_hour

for i in $*
do
echo -datetimeoriginal="$s_date $current_hour:$current_minute:00" $i
exiftool -m -datetimeoriginal="$s_date $current_hour:$current_minute:00" $i
current_minute=$(( $current_minute + $delta ))
if [ $current_minute -ge 60 ]; then
current_minute=$(( $current_minute - 60 ))
current_hour=$(( $current_hour +1 ))
if [ $current_hour -ge 24 ]; then
echo "Date over limit"
exit 1
fi
fi

done


I decided to do not use "-overwrite_original" because exiftool generates in my case the following error for each file: "Maker notes could not be parsed". Therefore I decided to use "-m" but I am not sure how safe it is

Tomek

Phil Harvey

Hi Tomek,

Ah ha!  You're on a Unix system.  Plus you know scripting.  A powerful combination! :)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

BogdanH

Well, this "Preview" option before posting is very usefull... got a message "".. 2 new replies have been posted.."
I was trying to help and just made "DateTime set & incremet" option in GUI.. and then I see, Unix is used  :o

Ok, it will be in next GUI update  :)

Bogdan

Big_Lynx

QuoteI was trying to help and just made "DateTime set & incremet" option in GUI

I am totally new in the exiftool. What is GUI? https://exiftool.org/gui/ ? BTW I am using MacOS what may have influence on GUI but not on command line of course

Tomek

Phil Harvey

Tomek: The GUI is for Windows only.

Bogdan: This isn't a feature I would expect to see in the GUI because it is very rare that anyone wants to do this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Big_Lynx

QuoteThe GUI is for Windows only.

I have just tested it. Works great! Impressive development and great consolidation of both applications

QuoteThis isn't a feature I would expect to see in the GUI because it is very rare that anyone wants to do this

Oh no! I will be very, very, very please to have such a feature on Windows systems as scripting in DOS/Windows-Command environment is black-magic for me. BTW - in my opinion this feature should be extremely useful for everyone working with scans of analog films. I have my archive of film negatives very well described by dates but hi-res scan (e.g. of 36 frames) takes a lot of time. Each post-processing application (e.g. Lightroom, ACDsee, PS, ...) offers some sort of shifting of DateTimeOriginal - but in framework for scans the problem is not to shift but to define proper time (especially when you scan one film during a week - with 7 different dates for frames - but is was exposed in one day).

I work with both - MAC and Windows but according to my age  :( I have mostly UNIX-based based background - on Windows I am just GUI user  ;)

Tomek

BogdanH

Phil, for me too, doing something like this sounds odd. However, Tomek seemed to be quite desperate, so I couldn't resist :) -at the time of my previous posting in this thread, option was allready made... wasn't that much work, though.
So Tomek, if you're interested, GUI update will be available in next few days.

Bogdan

Big_Lynx

Bogdan,

I am very much interested  :)

Thank you

Tomek