Applying globaltimeshift option using TimeZone value

Started by eltaniin, February 07, 2025, 06:20:45 AM

Previous topic - Next topic

eltaniin

Hello.

I want to rename my mp4 files using CreateDate and TimeZone tag.
These mp4 files have time tags as shown below.
In this case, its datetime should be "2017:01:19 17:21:13"

exiftool.exe -d "R%y%m%d_%H%M%S%%+c.%%ue" "-filename<CreateDate" -globaltimeshift "0:0:0 1:0:0" -progress *.mp4

If I use the command above, it is done as I wanted.
But I had to set globaltimeshift option manually like "0:0:0 1:0:0".
How can I set globaltimeshift option using TimeZone tag?

CreateDate                      : 2017:01:19 16:21:13
ModifyDate                      : 2017:01:19 16:21:13
TrackCreateDate                 : 2017:01:19 16:21:13
TrackModifyDate                 : 2017:01:19 16:21:13
MediaCreateDate                 : 2017:01:19 16:21:13
MediaModifyDate                 : 2017:01:19 16:21:13
TimeZone                        : +01:00
LastUpdate                      : 2017:01:19 17:21:13+01:00

Phil Harvey

Instead of doing a GlobalTimeShift for CreateDate in MP4 files, you should be using the -api QuickTimeUTC option.

- 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

The GlobalTimeShift option can't access a tag value to do the shift.

Phil's suggest is the correct answer unless the computer you are using is not in the same time zone as where the video was shot. In that case it would require a much more complex command involving the ShiftTime helper function and $self->GetValue.
"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

eltaniin

Unfortunately the time zone of my PC is not the same as the pictures as I took them when traveling abroad.
In that case, how should I use ShiftTime to rename mp4 files?

StarGeek

Are you on Windows or Mac/Linux.

On Mac/Linux, you can use the -api TimeZone option like this
-api TimeZone=+08:00
Note that this is the opposite of what the time zone actually is. In this case, my time zone is -08:00, so I need to use +08:00.
Also, you can use standard time zone names (see the TZ identifier on this Wikipedia page). Again, for me, I could use this (if I used a Mac/Linux)
-api TimeZone=America/Los_Angeles

On Windows, you have to use the format described in _tzset.
-api TimeZone=PST8PDT
Though honestly, Windows doesn't actually check the letters to see if it's a legit time zone name. Any three letters, then the reverse value of the time zone, then three more letters for Daylight time.

Phil, is the first version supposed to work for Windows? Because it isn't on my system. It's defaulting to UTC
C:\>exiftool -P -overwrite_original -api Timezone=+05:00 "-xmp:DateTimeOriginal=now" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -DateTimeOriginal y:\!temp\Test4.jpg
[XMP-exif]      DateTimeOriginal                : 2025:02:14 16:27:24+00:00
"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

Phil Harvey

I thought the first version should work with Windows.  It seemed to when I tested it before.   Looks like more testing/documenting is required...

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