Use FileModifyDate and in other tags from a source file to a destination file

Started by invada, July 06, 2020, 03:38:05 AM

Previous topic - Next topic

invada

Hi there,

I am trying to figure out how to use the "File > FileModifyDate" from a source file and use it in many tags on the destination file.

I've been googling and looking at the FAQ's etc. I'm getting close but no cigar just yet.

The example files are:

exiftool.exe -time:all -g -s "2009_10_18-00_08_01-Source.mpeg"
---- File ----
FileModifyDate                  : 2009:10:18 00:08:01+11:00
FileAccessDate                  : 2020:07:06 17:22:45+10:00
FileCreateDate                  : 2020:07:06 17:20:50+10:00

exiftool.exe -time:all -g -s "2009_10_18-00_08_01-Destination.mp4"
---- File ----
FileModifyDate                  : 2020:07:01 15:38:09+10:00
FileAccessDate                  : 2020:07:06 17:22:46+10:00
FileCreateDate                  : 2020:07:06 17:22:45+10:00
---- QuickTime ----
TrackCreateDate                 : 2020:07:01 05:38:08
TrackModifyDate                 : 2020:07:01 05:38:08
MediaCreateDate                 : 2020:07:01 05:38:08
MediaModifyDate                 : 2020:07:01 05:38:08
---- XMP ----
CreateDate                      : 2020:07:01 15:38:08+10:00
ModifyDate                      : 2020:07:01 15:38:09+10:00
MetadataDate                    : 2020:07:01 15:38:09+10:00
HistoryWhen                     : 2020:07:01 15:38:09+10:00, 2020:07:01 15:36:36+10:00, 2020:07:01 15:38:09+10:00, 2020:07:01 15:38:09+10:00
PantryMetadataDate              : 2020:07:01 14:11:13+10:00
PantryModifyDate                : 2020:07:01 14:11:13+10:00


FileModifyDate                  : 2009:10:18 00:08:01+11:00
This is the "real" date and time the video was shot.

I have edited the video and made it a much quicker time lapse so instead of 1 hour it's now 30 seconds. Because Premiere has written all new metadata in the resulting .mp4, all the dates are when I exported it, or at least they are not the original shot dates.

What I am trying to achieve is:

Take 2009_10_18-00_08_01-Source.mpeg -File:FileModifyDate
And copy it to

2009_10_18-00_08_01-Destination.mp4

-File:FileModifyDate
-File:FileCreateDate
-QuickTime:TrackCreateDate
-QuickTime:TrackModifyDate
-QuickTime:MediaCreateDate
-QuickTime:MediaModifyDate
-XMP:CreateDate
-XMP:ModifyDate
-XMP:MetadataDate
-XMP:HistoryWhen
-XMP:PantryMetadataDate
-XMP:PantryModifyDate

Some of these tags I'm not really sure about but basically I'm trying to make the date the real taken date everywhere I can.

I've got close. If I do:
exiftool.exe "2009_10_18-00_08_01-Destination.mp4" FILE:FileModifyDate<=2009_10_18-00_08_01-Source.mpeg -p

This copies the File Modify date. But I'm not sure how to use it in a different tag.

Thanks in advance for any assistance and thank for an amazing program. I still can't believe how poorly "date this was shot" dates are handled for cameras and video files. EXIFtool is the savior!







wywh

You seem to have the date in the filename so you could use the following command to set QuickTime and creation & modification dates (I still separate the commands with -execute because I haven't yet got it to properly work on macOS when create date is moved backwards):

exiftool -api QuickTimeUTC=1 '-CreateDate<filename' '-ModifyDate<filename' '-Track*Date<filename' '-Media*Date<filename' -execute '-FileCreateDate<filename' '-FileModifyDate<filename' -common_args -m -P -overwrite_original_in_place -wm w movies.*

invada

Thanks wywh! :) This is an example where I have the date in the filename but all of my other files aren't necessarily as lucky. Any idea what the command would be if you discard the filename? Thanks.

Phil Harvey

If you want to set the tags from FileModifiyDate instead of FileName, use the same command without the '-FileModifyDate<filename', and change all FileName to FileModifyDate in the rest of the arguments.

- 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 ($).

invada

Thanks Phil. I think I'm still missing something.

I think '-FileModifyDate<filename' takes the filename and makes it the FileModifyDate. Therefore wouldn't '-FileModifyDate<FileModifyDate' make the FileModifyDate from the same file to the same thing?

I can't see how you reference a source and destination file? As in I want to take FileModifyDate from one file and write it as FileModifyDate of another file. 

wywh

Does this work for your movies:

Copy FileModifyDate from source file to destination file's existing date tags:

exiftool -m -overwrite_original_in_place -wm w -api QuickTimeUTC=1 '-AllDates<FileModifyDate' -tagsFromFile source.mov destination.mov

Then copy the date to FileCreateDate and FileModifyDate:

exiftool -m -overwrite_original_in_place -wm w -api QuickTimeUTC=1 '-FileCreateDate<CreateDate' '-FileModifyDate<CreateDate' destination.mov

It might be possible to combine those commands.

- Matti

StarGeek

Quote from: invada on July 06, 2020, 07:14:26 AM
I think '-FileModifyDate<filename' takes the filename and makes it the FileModifyDate. Therefore wouldn't '-FileModifyDate<FileModifyDate' make the FileModifyDate from the same file to the same thing?

Yes, that part could be dropped.  But leaving it as is won't hurt anything.

QuoteI can't see how you reference a source and destination file? As in I want to take FileModifyDate from one file and write it as FileModifyDate of another file.

As Phil said
Quote from: wywh on July 06, 2020, 04:26:54 AM
You seem to have the date in the filename
So rather than have a more complex command to copy from one file to the other, it's much simpler to copy dates directly from the filename.

If you have files that don't have a time stamp in the filename, then something else will need to be done.
* 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).

wywh

I am not the original poster but I tried to copy FileModifyDate while learning the tagsFromFile command but for some reason I could not make '-FileModifyDate<FileModifyDate' work while '-AllDates<FileModifyDate' did work (see my previous message for a workaround). Am I missing something?

exiftool -a -G1 -s -api QuickTimeUTC=1 -time:all *.mp4
======== destination.mp4
[System]        FileModifyDate                  : 2020:02:02 02:02:02+02:00
======== source.mp4
[System]        FileModifyDate                  : 1988:08:08 08:08:08+03:00

exiftool '-FileModifyDate<FileModifyDate' -tagsFromFile source.mp4 destination.mp4
    1 image files updated
   
exiftool -a -G1 -s -api QuickTimeUTC=1 -time:all *.mp4
======== destination.mp4
[System]        FileModifyDate                  : 2020:02:02 02:02:02+02:00
======== source.mp4
[System]        FileModifyDate                  : 1988:08:08 08:08:08+03:00


- Matti

StarGeek

Quote from: wywh on July 08, 2020, 12:22:17 PM
I am not the original poster but I tried to copy FileModifyDate while learning the tagsFromFile command but for some reason I could not make '-FileModifyDate<FileModifyDate' work while '-AllDates<FileModifyDate' did work (see my previous message for a workaround). Am I missing something?

From the -TagsFromFile option docs (emphasis mine)
   Tag names on the command line after this option specify the tags to be copied

You placed '-FileModifyDate<FileModifyDate' before the -TagsFromFile, so it is copying from destination.mp4 to destination.mp4
* 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).

invada

Thanks for your help. That seems to be what I want to do as well. So if it was placed after:

exiftool.exe -tagsFromFile "-FileModifyDate<FileModifyDate" "source.mpeg" "destination.mp4"

That doesn't work for me.

Error:

File '-FileModifyDate<FileModifyDate' does not exist for -tagsFromFile option

StarGeek

That was in regards to the problem wywh was having.

But the very first item after the -TagsFromFile must be the source file.  Because you put "-FileModifyDate<FileModifyDate" directly after the -TagsFromFile option, it's looking for a file named "-FileModifyDate<FileModifyDate", which is why you get the File '-FileModifyDate<FileModifyDate' does not exist error.

The correct command for your example would be
exiftool.exe -tagsFromFile source.mpeg "-FileModifyDate<FileModifyDate" destination.mp4
or just simply
exiftool.exe -tagsFromFile source.mpeg -FileModifyDate destination.mp4
* 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).

invada

Yes! Thanks so much that's exactly what I was trying to figure out!

Thanks so much  :)


wywh

Quote from: StarGeek on July 08, 2020, 02:47:34 PM
Tag names on the command line after this option specify the tags to be copied

Thanks for the correction. So the very first item after the -TagsFromFile must be the source file and after this the tag names to be copied (if no tags are specified, then all possible tags from the source file are copied to same-named tags in the preferred location of the output file). I now noticed that there is a nice cookbook and recipes at:

https://exiftool.org/exiftool_pod.html#COPYING-EXAMPLES

I practiced my command line skills a little further: if the original poster wants to copy FileModifyDate from a mpeg file to a mp4 file's FileCreateDate, FileModifyDate and QuickTime dates the following two commands seem to work:

exiftool -m -P -overwrite_original_in_place -wm w -api QuickTimeUTC=1 -tagsFromFile source.mpeg '-FileCreateDate<FileModifyDate' '-FileModifyDate<FileModifyDate' destination.mp4

exiftool -m -P -overwrite_original_in_place -wm w -api QuickTimeUTC=1 -tagsFromFile source.mpeg '-AllDates<FileModifyDate' '-Track*Date<FileModifyDate' '-Media*Date<FileModifyDate' destination.mp4

Or combined in one line (I had to separate the commands with -execute so the FileCreateDate can go also forwards in time in macOS):

exiftool -tagsFromFile source.mpeg '-FileCreateDate<FileModifyDate' '-FileModifyDate<FileModifyDate' -execute -tagsFromFile source.mpeg '-AllDates<FileModifyDate' '-Track*Date<FileModifyDate' '-Media*Date<FileModifyDate' -common_args -m -P -overwrite_original_in_place -wm w -api QuickTimeUTC=1 destination.mp4

- Matti