News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

how to combine two code commands?

Started by Rerol, March 02, 2020, 02:01:51 PM

Previous topic - Next topic

Rerol

how to combine two code commands?
exiftool -r. * "-FileCreateDate>CreateDate" -overwrite_original *.mp4
and
exiftool -r. * "-CreateDate-=0:0:0 3:0:0" -overwrite_original *.mp4

StarGeek

exiftool -r "-FileCreateDate>CreateDate" -globalTimeShift "-0 3" -ext mp4 .

Dot at the end, no asterisk.  This command subtracts 3 hours from FileCreateDate before copying it.
* 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).

Rerol

Quote from: StarGeek on March 02, 2020, 05:32:24 PM
exiftool -r "-FileCreateDate>CreateDate" -globalTimeShift "-0 3" -ext mp4 .

Dot at the end, no asterisk.  This command subtracts 3 hours from FileCreateDate before copying it.

wonderful, everything works!

I have more than 1000 files, and only some of them require changes. Is it possible to somehow add a verification algorithm, if the date is the same (FileCreateDate = CreateDate), then skip this file, if the dates are different, then run the command
exiftool -r "-FileCreateDate>CreateDate" -globalTimeShift "-0 3" -ext mp4 .

Phil Harvey

You could try adding this to the command:

-if "$createdate ne ${filecreatedate;s/[-+].*//}"

The trick here is that I needed to remove the time zone from FileCreateDate.  But are you sure your MP4 CreateDate isn't writting in UTC (ie. did you try the -api quicktimeutc option?) -- I'm just wondering if the times really need shifting.

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

Rerol

#4
Quote from: Phil Harvey on March 05, 2020, 09:55:25 PM
- Phil

I correctly understood that the time in "CreateDate" should be GMT and should not be changed to local?
my camera records all the files FileCreateDate and CreateDate, the difference is 3 hours. How to check it? Maybe I'm doing something wrong?

Phil Harvey

Let me know if you have any questions after reading the 4th paragraph in the QuickTime tags documentation.

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

Rerol

Quote from: Phil Harvey on March 06, 2020, 07:10:03 AM
Let me know if you have any questions after reading the 4th paragraph in the QuickTime tags documentation.

- Phil

very interesting! but I don't understand the meaning.
Why make video creation time in an inappropriate time zone. The truth is when I shot the video file and there is truth. Why change it to a zero hour format. I can `t get it.

Rerol

Quote from: Phil Harvey on March 05, 2020, 09:55:25 PM
You could try adding this to the command:

-if "$createdate ne ${filecreatedate;s/[-+].*//}"
...

I try to run this command, but it does not work. How to run it right?

Phil Harvey

exiftool -r "-FileCreateDate>CreateDate" -globalTimeShift "-0 3" -ext mp4 . -if "$createdate ne ${filecreatedate;s/[-+].*//}"
...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 ($).

Rerol

Quote from: Phil Harvey on March 06, 2020, 09:44:17 PM
exiftool -r "-FileCreateDate>CreateDate" -globalTimeShift "-0 3" -ext mp4 . -if "$createdate ne ${filecreatedate;s/[-+].*//}"

Thanks for helping.

I did not understand the time offset to the local one. What to do right?
Do not shift to local time?

Phil Harvey

You are free to do what you want, but the "correct" thing to do would be to use the -api quicktimeutc option and write QuickTime:CreateDate with a date/time that includes a time zone (the system time zone will be assumed in this case if no time zone is specified).

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

StarGeek

Windows and Google Photos will correctly read video time stamps as if they were UTC and display the correct local time based upon the time zone set in the computer.

Adobe Bridge will not adjust the time and display it as if it was local time.  It's probably the same for other Adobe programs.
* 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).

Rerol

Quote from: Phil Harvey on March 07, 2020, 07:22:05 AM
You are free to do what you want, but the "correct" thing to do would be to use the -api quicktimeutc option and write QuickTime:CreateDate with a date/time that includes a time zone (the system time zone will be assumed in this case if no time zone is specified).

- Phil

thanks.
I also think what needs to be done correctly. I will not shift the time and leave it in the default format.

since I already started this command with shifts, now I need to finish and redo what I did.
will the command line be like this?:
exiftool -r "-FileCreateDate>CreateDate" -ext mp4 .

Rerol

additionally:
I understand correctly that it's best to set the time on the camera to UTC 00:00. Is there an idea in this?

Phil Harvey

Quote from: Rerol on March 08, 2020, 02:28:28 PM
will the command line be like this?:
exiftool -r "-FileCreateDate>CreateDate" -ext mp4 .

No.  Like this:

exiftool -r "-FileCreateDate>CreateDate" -api quicktimeutc -ext mp4 .

Quote from: Rerol on March 08, 2020, 02:34:48 PM
additionally:
I understand correctly that it's best to set the time on the camera to UTC 00:00. Is there an idea in this?

If you use the above command, your camera should be set to the same time zone as your computer system.   But make sure your camera time zone is also set properly to this zone.  If you travel with your camera, just change the time zone, but don't change the time.

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

Rerol

Quote from: Phil Harvey on March 08, 2020, 08:39:18 PM
- Phil
Thanks for the advice.

can this command be optimized so that it skips files that already meet these conditions? I have more than 1000 of them. video.

Phil Harvey

exiftool -r "-FileCreateDate>CreateDate" -if "$createdate ne $filecreatedate" -api quicktimeutc -ext mp4 .
...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 ($).