Renaming files with multiple attributes (time and model)

Started by suschmania, September 10, 2018, 04:54:58 AM

Previous topic - Next topic

suschmania

Dear Exif Pros :)

i have lots of files i want to finally structure . For this i use exifer directly at my Synology server where all files ar stored. Due to lots of copies and movements the modify date and even createdate is wrong very often, so i want to rename the tags with the DateTimeOriginal, which is not affected and includes the original timestamp.
I want to have a naming combination for as follows:

For images the name should be a combination of "datetimeoriginal" tag with "model".
For Movies the name is created with "MediaCreateDate".

here is an example how it should look like:

images: 2016-12-04 16h-59m (DSC-RX100M3)_001.jpg ( _001, _002 etc. when multiple files are existing at the same minute)

My latest code looks as follows:

For movies it looks nearly fine with
exiftool '-FileModifyDate<MediaCreateDate' '-FileName<MediaCreateDate' -d "%Y-%m-%d %Hh-%Mm%+.3c.%%le" -ext 3gp -ext avi -ext mp4 -overwrite_original FOLDER

For images:
exiftool '-FileModifyDate<DateTimeOriginal' '-FileName<DateTimeOriginal' -d "%Y-%m-%d %Hh-%Mm%+.3c.%%le" -ext jpg -ext jpeg -ext png -ext arw -ext cr2 -overwrite_original FOLDER

but there the Model is missing.

With
exiftool '-FileModifyDate<DateTimeOriginal' '-FileName<DateTimeOriginal' -d "%Y-%m-%d %Hh-%Mm %f(${model;})%+-3c.%%le" -ext jpg -ext jpeg -ext png -ext arw -ext cr2 -overwrite_original FOLDER
i receive a syntax problem (bad substitution).

For imags and movis i have the problem, that the incrementing numbers are written always, anyway if there are multiple files at the same time or not: 2017-11-03 12h-15m_000.mp4

Can someone help me with my problem?
Thank you  :)

StarGeek

You can't include a tag in the date format string.  You have split the date string at the point you want to include a tag and move that part into the tag copy section.
'-FileName<$DateTimeOriginal ${model;}%+3c.%le' -d "%Y-%m-%d %Hh-%Mm"

Because the %c and %e options are no longer in the date string, the percent signs no longer have to be doubled.  The dot with the %c option forces the copy number to always print, so that is removed (see -wm (writemode) option, paragraph that starts "For %c,").

I'd also suggest adding a hashtag for the FileModifyDate assignments.  The -d option might cause an error there as you don't have the seconds included.  Try '-FileModifyDate<DateTimeOriginal#' and '-FileModifyDate<MediaCreateDate#'
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

suschmania

Dear StarGeek,
thank you very much for your suggestions! They worked very well! I just had to place a $ in front of DateTimeOriginal and then it worked like a charm.

exiftool '-FileModifyDate<DateTimeOriginal#' '-FileName<$DateTimeOriginal (${model;})%+3c.%le' -d "%Y-%m-%d %Hh-%Mm" -ext jpg -ext jpeg -ext png -ext arw -ext cr2 -overwrite_original "DIR"
results in
2013-06-15 01h-48m (RAZR i).jpg
and
2013-06-15 01h-48m (RAZR i)_001.jpg

Super! Thank you very much.

Unfortunately, for movies there is nowhere the model saved in the metadata. But i think this is a camera "problem" or behaviour.

suschmania

#3
The renaming is finished, the names are like i want them. BUT, i think i have a timezone problem now.

For example the following file was recorded in Almaty during new year (GMT +6h,  MediaCreateDate is correct. FileModifyDate has a +1(maybe, because +1 is my home timezone CET?) ).

======== ./2018-01-01 - 00h - 21m.mp4
[System]        FileModifyDate                  : 2018:01:01 00:21:46+01:00
[System]        FileAccessDate                  : 2018:09:12 07:00:38+02:00
[System]        FileInodeChangeDate             : 2018:09:12 06:59:33+02:00
[QuickTime]     CreateDate                      : 2017:12:31 18:21:46
[QuickTime]     ModifyDate                      : 2017:12:31 18:21:46
[Track1]        TrackCreateDate                 : 2017:12:31 18:21:46
[Track1]        TrackModifyDate                 : 2017:12:31 18:21:46
[Track1]        MediaCreateDate                 : 2018:01:01 00:21:46
[Track1]        MediaModifyDate                 : 2017:12:31 18:21:46


Windows tells me that the file was taken 5h later...

The used code was
exiftool '-FileModifyDate<MediaCreateDate#' '-FileName<$MediaCreateDate%+3c.%le' -d "%Y-%m-%d - %Hh - %Mm" -overwrite_original .


Edit:
Is it possible, that Exifer (or Windows 10?) is checking my actual timezone? I am currently in Bishkek (Kyrgyzstan) and have files shot in Copenhagen. The time difference between the places is 4 hours.
I've just had to update DateTimeOriginal from filename for 2 files exiftool '-alldates<${filename' -overwrite_original. and then changed the filename as described.
The time difference for the files is exactly 4h and plus 2 additional hours when using "date" as an extra column (see picture attached, the "Datum" column).

All in All: How can i write an "absolute" time tag which is not shifted or/and equal to the filename? :)

======== ./2018-07-19 - 13h - 49m.mp4
[System]        FileModifyDate                  : 2018:07:19 13:49:52+02:00
[System]        FileAccessDate                  : 2018:09:12 09:50:24+02:00
[System]        FileInodeChangeDate             : 2018:09:12 09:45:38+02:00
[QuickTime]     CreateDate                      : 2018:07:19 13:49:52
[QuickTime]     ModifyDate                      : 2018:07:19 13:49:52
[Track1]        TrackCreateDate                 : 2018:07:26 14:01:20
[Track1]        TrackModifyDate                 : 2018:07:26 14:01:20
[Track1]        MediaCreateDate                 : 2018:07:26 14:01:20
[Track1]        MediaModifyDate                 : 2018:07:26 14:01:20
[XMP-exif]      DateTimeOriginal                : 2018:07:19 13:49:52
[XMP-xmp]       CreateDate                      : 2018:07:19 13:49:52
[XMP-xmp]       MetadataDate                    : 2018:07:26 16:01:21+02:00
[XMP-xmp]       ModifyDate                      : 2018:07:19 13:49:52
[XMP-xmpMM]     HistoryWhen                     : 2018:07:26 16:01:21+02:00, 2018:07:26 16:01:21+02:00, 2018:07:26 16:01:21+02:00



StarGeek

Quote from: suschmania on September 12, 2018, 01:12:15 AM
For example the following file was recorded in Almaty during new year (GMT +6h,  MediaCreateDate is correct. FileModifyDate has a +1(maybe, because +1 is my home timezone CET?) ).

Just to clarify, MediaCreateDate is correct for local time for Almaty, so it technically is 2018:01:01 00:21:46+06:00?

The time stamps in video files are always a problem.  The Quicktime time stamps are supposed to be UTC, but many cameras don't do that, as they may not be aware of the proper time zone. 

The File*Date time stamps are always adjusted to the local time set on the local computer.  So the time that shows up when you use a computer in +06:00 (for example, 2018:01:01 00:21:46) will show a different value than one it -08:00 (2017:12:31 10:21:46-08:00), but they will be the exact same time, properly adjusted for time zone.

When you copy '-FileModifyDate<MediaCreateDate#', exiftool can't adjust FileModifyDate to the proper time zone as it doesn't have that data.  To adjust it properly, you would need to add the time zone, '-FileModifyDate<$MediaCreateDate#+06:00'.

But there is good news in this case.  I just noticed, it appears that the Quicktime time stamps are correctly set to UTC.  2018:01:01 00:21:46+06:00 is the same as 2017:12:31 18:21:46Z.  You might try using QuickTime:CreateDate as the time stamp in part of your commands and add -api QuickTimeUTC option.  That option tells exiftool that the Quicktime time stamps are properly set to UTC and not local time and it will adjust them correctly to local time.  So '-FileModifyDate<MediaCreateDate#' becomes '-FileModifyDate<QuickTime:CreateDate#' -api QuickTimeUTC. This allows you to not worry about time zone when setting FileModifyDate.  Of course, if you have videos from a different camera, you probably want to double check to see how it is setting QuickTime:CreateDate.

QuoteAll in All: How can i write an "absolute" time tag which is not shifted or/and equal to the filename? :)

If you're talking about the file system time stamps, you can't.   The File*Date cannot be locked.  They will always adjust automatically to the time zone of whatever computer is dealing with them.  This is a property of the underlying OS and TBH, you really shouldn't worry about it, once they're set properly.

For any other time stamp, the ones internal to the media (images, video, etc), you'll have to deal with time zones and figure out how the data is written by your camera.  Especially if you're taking shots in multiple time zones.  The time stamps in image tags are assumed to be local to the location shot.  Setting the time zone can help for image tags, as there are some standards for doing so (I can expand upon this if you like) but I'm not sure if there is any tags specifically for time zones in videos.  And these are usually not set automatically by most cameras, so you usually have to do extra work to deal with them.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

suschmania

Quote from: StarGeek on September 12, 2018, 03:14:08 PM
Just to clarify, MediaCreateDate is correct for local time for Almaty, so it technically is 2018:01:01 00:21:46+06:00?

In the case of the Almaty video clip, the timestamp of MediaCreateDate is correct. It was recorder shortly after Midnight at new year local time (0:21).

For Copenhagen i got the correct (local)time from the filename, which is written into DateTimeOriginal (13:49 at the 19th July 2018, +1 which is CET).
So as i understand, when i rename my files i have to add for every folder (or let's say city) the correct timezone. Does exifer assume that when i don't provide this info my actual computer timezone is the timezone to use? Then it would make sense why my files (even most of the images) have these 4h difference now, as i am currently in Kyrgyzstan and not in central europe.

Hayo Baan

I don't know exifer, but I would say it is extremely likely it uses the local time zone if none is provided.
Hayo Baan – Photography
Web: www.hayobaan.nl

suschmania

#7
I tried to change all the files with a timezone information in the code. It seems like it is working, when i switch my computer-timezone into the "correct" zone, where the picture was taken and in addition with this code:

exiftool -r '-DateTimeOriginal<$DateTimeOriginal+TIMEZONE' 'MediaCreateDate<$MediaCreateDate+TIMEZONE' '-FileModifyDate<$DateTimeOriginal+TIMEZONE' '-FileModifyDate<$MediaCreateDate+TIMEZONE' -overwrite_original .

DateTimeOriginal for images, MediaCreateDate for Videos