ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: js29pub on November 26, 2016, 03:51:46 PM

Title: Changing only the timezone
Post by: js29pub on November 26, 2016, 03:51:46 PM
I've combed the manual and the forums, can't seem to figure out how to change only the timezone (and nothing else) on a Sony XAVC MP4 file (I'm running this on OS X Yosemite 10.10.5 using 'exiftool' in the terminal):

ExifTool Version Number         : 10.36
---- File ----
File Type                       : MP4
File Type Extension             : mp4
MIME Type                       : video/mp4
---- QuickTime ----
Major Brand                     : Sony XAVC
Minor Version                   : 100.1f.ff
Compatible Brands               : XAVC, mp42, iso2

For example, here is the time info:

> exiftool -time:all -G0:1 -s C0003.MP4

[File:System]   FileModifyDate                  : 2016:11:18 06:30:14-08:00
[File:System]   FileAccessDate                  : 2016:11:26 12:34:24-08:00
[File:System]   FileInodeChangeDate             : 2016:11:26 12:33:27-08:00
[QuickTime]     CreateDate                      : 2016:11:18 14:30:04
[QuickTime]     ModifyDate                      : 2016:11:18 14:30:04
[QuickTime:Track1] TrackCreateDate              : 2016:11:18 14:30:04
[QuickTime:Track1] TrackModifyDate              : 2016:11:18 14:30:04
[QuickTime:Track3] MediaCreateDate              : 2016:11:18 14:30:04
[QuickTime:Track3] MediaModifyDate              : 2016:11:18 14:30:04
[QuickTime]     TimeZone                        : +02:00
[XML]           LastUpdate                      : 2016:11:18 16:30:04+02:00

I just want to modify the two bolded/red "+02:00" values to "-07:00".  I tried the following:

> exiftool -v2 -TimeZone=-07:00 C0003.MP4

Writing Ricoh:TimeZone if tag exists
Writing Canon:TimeZone if tag exists
Writing Nikon:TimeZone if tag exists
======== C0003.MP4
Rewriting C0003.MP4...
  FileType = MP4
  FileTypeExtension = MP4
  MIMEType = video/mp4
  Editing tags in: MakerNotes
  Creating tags in:
  Rewriting Movie
  Rewriting MovieHeader
  Rewriting Track
  Rewriting TrackHeader
  Rewriting Media
  Rewriting MediaHeader
  Rewriting Track
  Rewriting TrackHeader
  Rewriting Media
  Rewriting MediaHeader
  Rewriting Track
  Rewriting TrackHeader
  Rewriting Media
  Rewriting MediaHeader
Nothing changed in C0003.MP4
    0 image files updated
    1 image files unchanged

I also tried:

> exiftool -v2 -QuickTime:TimeZone=-07:00 C0003.MP4
Warning: Tag 'QuickTime:TimeZone' is not supported
Nothing to do.

Can someone explain how to do this?
Title: Re: Changing only the timezone
Post by: Hayo Baan on November 26, 2016, 04:25:57 PM
Exiftool only has limited write support for MP4 files so you'll need another tool for this.  In answer to a question on this forum a while ago, I wrote a script to alter mts and other movie files (matchdatetime (https://github.com/HayoBaan/matchDateTime)) perhaps it also suits your needs. If not, let me know and I might be able to alter the script.
Title: Re: Changing only the timezone
Post by: js29pub on November 26, 2016, 06:00:43 PM
Thanks for the reply.  Too bad about the limited support for MP4.  I tried your matchdatetime, but it gave me this message:

> matchDateTime -tz -07 C0003.MP4
Skipped: Unable to find MakerNotes DateTimeOriginal in C0003.MP4

I guess I'll just focus on changing the file system timestamps.
Title: Re: Changing only the timezone
Post by: Hayo Baan on November 27, 2016, 06:15:48 AM
Right, one of the two current modes is that it tries to find the datetime in the Nikon makernotes. If you could mail me a small sample file, I will have a look at extending my script so it covers your case too.
Title: Re: Changing only the timezone
Post by: ragnor on March 23, 2019, 10:48:00 AM
Hello all,

I have the same request, so I´m answering to this old post.

GoPro is messing with my dates, apparently because the files are saved with the dates taken as UTC, and when files are stored to my PC it takes into account my local timezone (+1) so it adds 1h to all videos.
I would like to know if it would be possible to just add a +1GMT in the metadata to correct this issue.

Some years passed since the original post, so I guess there has been some improvement in MP4 management?

Thank you!
Title: Re: Changing only the timezone
Post by: StarGeek on March 23, 2019, 11:35:50 AM
Quote from: ragnor on March 23, 2019, 10:48:00 AM
GoPro is messing with my dates, apparently because the files are saved with the dates taken as UTC, and when files are stored to my PC it takes into account my local timezone (+1) so it adds 1h to all videos.

Yes, the time stamps embedded in .mp4/.mov files is supposed to be stored as UTC time as per the spec and Windows takes it as such and corrects appropriately.  Most non-phone cameras are usually not aware of time zones and save it as local time.  Not all programs/web sites will correct automatically.  I believe, for example, you'll run into the reverse problem if you upload the video to Google Photos.

QuoteI would like to know if it would be possible to just add a +1GMT in the metadata to correct this issue.

You'll have to figure out which tag is the correct one to edit, as I can't remember off hand, but the basic command would be:
exiftool -TAG+=1 FileOrDir

Title: Re: Changing only the timezone
Post by: Phil Harvey on March 26, 2019, 10:03:18 PM
If all goes well, I plan a big improvement to MP4 writing in the next release.

- Phil
Title: Re: Changing only the timezone
Post by: Phil Harvey on March 27, 2019, 12:35:51 PM
(This update is turning out to be a real pain in the ass.  But then, this is expected or else I would have done it a lot sooner.)
Title: Re: Changing only the timezone
Post by: StarGeek on March 27, 2019, 01:02:22 PM
Even though I don't do much with video, I'm very interested in what you are working up.  I can hardly wait to see.
Title: Re: Changing only the timezone
Post by: Phil Harvey on March 28, 2019, 01:15:54 PM
ExifTool 11.33 is now available.

With this version you should be able to edit most QuickTime tags, but you still won't be able to add any new ones.  Only XMP tags may be added.

- Phil
Title: Re: Changing only the timezone
Post by: ragnor on April 10, 2019, 11:19:45 AM
Thank you so much for the update!

The problem seems that my GoPro is not adding any Timezone tag.

For instance:

ExifTool Version Number         : 11.35
File Name                       : GX011182.MP4
Directory                       : C:/Users/xxxx
File Size                       : 12 MB
[b]File Modification Date/Time     : 2019:03:23 12:00:43+01:00[/b]
File Access Date/Time           : 2019:04:10 17:08:38+02:00
File Creation Date/Time         : 2019:04:10 17:08:38+02:00
File Permissions                : rw-rw-rw-
File Type                       : MP4
File Type Extension             : mp4
MIME Type                       : video/mp4
Major Brand                     : MP4 v1 [ISO 14496-1:ch13]
Minor Version                   : 2013.10.18
Compatible Brands               : mp41
Movie Data Size                 : 12908548
Movie Data Offset               : 28
Movie Header Version            : 0
[b]Create Date                     : 2019:03:23 12:00:39
Modify Date                     : 2019:03:23 12:00:39[/b]
Time Scale                      : 60000
Duration                        : 2.09 s
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 6
Lens Serial Number              : LAJ8082436601367
Camera Serial Number Hash       : aaa1c890f8dabf18748907aa17a01ab5
Camera Serial Number            : C3281325274627
Camera Model Name               : HERO7 Black
Firmware Version                : HD7.01.01.70.00
Auto Rotation                   : Up
Digital Zoom                    : No
Pro Tune                        : Off
White Balance                   : AUTO
Sharpness                       : HIGH
Color Mode                      : GOPRO
Auto ISO Max                    : 3200
Auto ISO Min                    : 100
Exposure Compensation           : 0.0
Rate                            : 1_60SEC
Field Of View                   : Wide
Audio Setting                   : AUTO
Device Name                     : Highlights
Track Header Version            : 0
Track Create Date               : 2019:03:23 12:00:39
Track Modify Date               : 2019:03:23 12:00:39
Track ID                        : 1
Track Duration                  : 2.09 s
Track Layer                     : 0
Track Volume                    : 0.00%
Image Width                     : 3840
Image Height                    : 2160
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : hvc1
Source Image Width              : 3840
Source Image Height             : 2160
X Resolution                    : 72
Y Resolution                    : 72
Compressor Name                 : GoPro H.265 encoder
Bit Depth                       : 24
Video Frame Rate                : 59.94
Time Code                       : 3
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 24
Audio Sample Rate               : 48000
Text Font                       : Unknown (21)
Text Face                       : Plain
Text Size                       : 10
Text Color                      : 0 0 0
Background Color                : 65535 65535 65535
Font Name                       : Helvetica
Other Format                    : tmcd
Warning                         : [minor] The ExtractEmbedded option may find more tags in the movie data
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 2019:03:23 12:00:39
Media Modify Date               : 2019:03:23 12:00:39
Media Time Scale                : 60000
Media Duration                  : 2.09 s
Handler Class                   : Media Handler
Handler Type                    : NRT Metadata
Handler Description             : GoPro SOS
Gen Media Version               : 0
Gen Flags                       : 0 0 0
Gen Graphics Mode               : srcCopy
Gen Op Color                    : 0 0 0
Gen Balance                     : 0
Meta Format                     : fdsc
Avg Bitrate                     : 49.4 Mbps
Image Size                      : 3840x2160
Megapixels                      : 8.3
Rotation                        : 0


The problem here is that the correct time was not 2019:03:23 12:00:39, but 2019:03:23 11:00:39+01:00. Windows seems to get that time thinking that is UTC and then adds a +01:00, so then it displays incorrectly in Windows and also when uploading them to Google photos, for example.

I uploaded the same clip in case anyone wants to take a look: https://drive.google.com/file/d/1DXUyazWnd_KX6gOA7G6Z3I1cwLY2KMQu/view (https://drive.google.com/file/d/1DXUyazWnd_KX6gOA7G6Z3I1cwLY2KMQu/view)
Any idea of how to fix the times?
I have over 2000 clips to fix already, and the number is increasing day by day, so it´s really a problem.
GoPro doesn´t seem to be going to fix it.

Thank you!
Title: Re: Changing only the timezone
Post by: Hayo Baan on April 10, 2019, 12:01:30 PM
It's a real pity there's no time zone / offset information in those files. But have you already tried simply subtracting an hour from the current times?

E.g. exiftool -ModifyDate-=1:0:0 -CreateDate-=1:0:0 -FileModifyDate-=1:0:0 GX011182.MP4

(To make the dates consistent, consider doing the same to the TrackCreateDate, TrackModifyDate, MediaCreateDate, and MediaModifyDate)
Title: Re: Changing only the timezone
Post by: ragnor on April 10, 2019, 12:21:48 PM
Thanks for your fast reply!
That would indeed be an option. But wouldn´t that create a ¨fake¨ time on the clip, showing a createtime that is not actually correct?
Title: Re: Changing only the timezone
Post by: Phil Harvey on April 10, 2019, 12:29:02 PM
Try using the -api quicktimeutc option (https://exiftool.org/ExifTool.html#QuickTimeUTC) when extracting tags.  Could it be that these tags are already written correctly?

- Phil
Title: Re: Changing only the timezone
Post by: StarGeek on April 10, 2019, 12:30:54 PM
As I said in my first response (https://exiftool.org/forum/index.php/topic,7839.msg51915.html#msg51915), the time stamp is supposed to be in UTC according to the spec.  Windows, for once, is actually reading the data correctly.  But other programs might not.  I'm not sure how Google Photos reads it.

You have to decide based upon what programs you use and how they read the timestamp if you want it to be technically correct and set to UTC time or set it the actual, local time it was shot.
Title: Re: Changing only the timezone
Post by: Phil Harvey on April 10, 2019, 12:33:28 PM
Sorry if I have been throwing out random ideas here, but I don't have time right now to read the whole thread in detail.

- Phil
Title: Re: Changing only the timezone
Post by: ragnor on April 10, 2019, 12:59:06 PM
Quote from: StarGeek on April 10, 2019, 12:30:54 PM
As I said in my first response (https://exiftool.org/forum/index.php/topic,7839.msg51915.html#msg51915), the time stamp is supposed to be in UTC according to the spec.  Windows, for once, is actually reading the data correctly.  But other programs might not.  I'm not sure how Google Photos reads it.

You have to decide based upon what programs you use and how they read the timestamp if you want it to be technically correct and set to UTC time or set it the actual, local time it was shot.
Not sure if I understood correctly.
The time on my GoPro is synchronized with my phone. So it´s adjusted as the time in my timezone, and then assumed that it´s UTC in the timestamp.
I can correct that manually in the camera, using the time minus my time zone, but then tags for photos will be wrong.


@Phil: quicktimeutc option shows indeed the incorrect time + the timezone.

PS: now with the daylight hour change it´s even more messy, as now the new videos are +2.
Title: Re: Changing only the timezone
Post by: StarGeek on April 10, 2019, 01:14:13 PM
Quote from: ragnor on April 10, 2019, 12:59:06 PM
The time on my GoPro is synchronized with my phone. So it´s adjusted as the time in my timezone, and then assumed that it´s UTC in the timestamp.
I can correct that manually in the camera, using the time minus my time zone, but then tags for photos will be wrong.

And there lies the problem between video metadata timestamps and photo metadata timestamps.  The video time is supposed to be UTC according to the spec.  The photo time is supposed to be local time.  If you're taking both at the same time, one of them is going to be technically wrong, unless the software understands the difference, which is unlikely.  So you're going to have to correct one or the other.

Hayo's post (https://exiftool.org/forum/index.php/topic,7839.msg52202.html#msg52202) shows you how to subtract an hour from the video timestamps.  I would expand upon that to include all the video timestamps with this command:
exiftool -quicktime:*Date-=1 GX011182.MP4
which would subtract 1 hour from the time in the file.  Change as needed.

Title: Re: Changing only the timezone
Post by: ragnor on April 10, 2019, 02:22:43 PM
Thanks for the comprehensive explanation!
It seems weird though that this only happens with GoPro. I never had this problem before with other cameras.

I will follow your advice and change the dates on the videos then.
Title: Re: Changing only the timezone
Post by: Hayo Baan on April 10, 2019, 02:39:58 PM
Quote from: ragnor on April 10, 2019, 02:22:43 PM
It seems weird though that this only happens with GoPro. I never had this problem before with other cameras.

I guess that's because most (?) cameras likely add time zone information into the relevant tags. Your GoPro sadly does not.
Title: Re: Changing only the timezone
Post by: ragnor on April 11, 2019, 07:24:45 AM
Quote from: Hayo Baan on April 10, 2019, 02:39:58 PM
Quote from: ragnor on April 10, 2019, 02:22:43 PM
It seems weird though that this only happens with GoPro. I never had this problem before with other cameras.

I guess that's because most (?) cameras likely add time zone information into the relevant tags. Your GoPro sadly does not.
So no way to add tags in the near future?
Title: Re: Changing only the timezone
Post by: Phil Harvey on April 11, 2019, 08:14:37 AM
Specifically, what tag(s) do you want to add?

- Phil
Title: Re: Changing only the timezone
Post by: ragnor on April 11, 2019, 12:36:54 PM
I guess a Timezone tag would solve the issue, or am I missing something else?
Title: Re: Changing only the timezone
Post by: Phil Harvey on April 11, 2019, 12:45:15 PM
The QuickTime TimeZone tag is stored in a very weird location, and as such it won't be a high priority to add support for being able to create this tag.  So don't expect this in the near future.

I wish that video metadata was more standardized.  Even if I add the ability to write this, most other software probably won't read it.

- Phil
Title: Re: Changing only the timezone
Post by: Hayo Baan on April 11, 2019, 01:26:16 PM
Hi Phil,

How about the TimeOffset tags instead?
Title: Re: Changing only the timezone
Post by: Phil Harvey on April 11, 2019, 04:22:59 PM
Quote from: Hayo Baan on April 11, 2019, 01:26:16 PM
How about the TimeOffset tags instead?

You mean the EXIF OffsetTimeXxxx tags?  Nothing but ExifTool will read these from a video, so writing them won't be much use.

The first QuickTime tags that will be creatable in videos will be the ItemList (https://exiftool.org/TagNames/QuickTime.html#ItemList) and UserData (https://exiftool.org/TagNames/QuickTime.html#UserData) tags.

- Phil
Title: Re: Changing only the timezone
Post by: Hayo Baan on April 11, 2019, 10:32:50 PM
Quote from: Phil Harvey on April 11, 2019, 04:22:59 PM
You mean the EXIF OffsetTimeXxxx tags?  Nothing but ExifTool will read these from a video, so writing them won't be much use.
Yes, I meant those. Interesting that no one seems to read these... They are written by some cameras though (I've seen a capture from a Canon 1D X that has these tags). Note though that they aren't writeable in MP4 files at the moment by exiftool. Since they are simple (fixed length?) string tags in the EXIF block, I figured they shouldn't be too hard to support?

Quote from: Phil Harvey on April 11, 2019, 04:22:59 PM
The first QuickTime tags that will be creatable in videos will be the ItemList (https://exiftool.org/TagNames/QuickTime.html#ItemList) and UserData (https://exiftool.org/TagNames/QuickTime.html#UserData) tags.

Excellent!
Title: Re: Changing only the timezone
Post by: Phil Harvey on April 12, 2019, 07:16:34 AM
Quote from: Hayo Baan on April 11, 2019, 10:32:50 PM
Note though that they aren't writeable in MP4 files at the moment by exiftool. Since they are simple (fixed length?) string tags in the EXIF block, I figured they shouldn't be too hard to support?

Right.  I will be able to add support for editing existing EXIF without too much trouble, but I won't add the ability to create new EXIF in videos if it didn't already exist.

- Phil