mp4 creation date and time zone

Started by paolobenve, August 29, 2022, 03:43:36 PM

Previous topic - Next topic

paolobenve

Hi!

I have a video made with a canon camera (actually a PowerShow G5Xm2), I want to extract the creation date metadata, it's there, in UTC:

$ exiftool video.mp4
ExifTool Version Number         : 12.40
File Name                       : video.mp4
Directory                       : .
File Size                       : 25 MiB
File Modification Date/Time     : 2022:08:28 11:25:09-04:00
File Access Date/Time           : 2022:08:28 20:13:59-04:00
File Inode Change Date/Time     : 2022:08:28 20:27:13-04:00
File Permissions                : -rw-rw-r--
File Type                       : MP4
File Type Extension             : mp4
MIME Type                       : video/mp4
Major Brand                     : MP4 Base Media v1 [IS0 14496-12:2003]
Minor Version                   : 0.2.0
Compatible Brands               : isom, iso2, mp41
Media Data Size                 : 26478082
Media Data Offset               : 44
Movie Header Version            : 0
Create Date                     : 2022:08:28 15:25:09
Modify Date                     : 2022:08:28 15:25:09
Time Scale                      : 1000
Duration                        : 0:00:54
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                   : 3
Track Header Version            : 0
Track Create Date               : 2022:08:28 15:25:09
Track Modify Date               : 2022:08:28 15:25:09
Track ID                        : 1
Track Duration                  : 0:00:54
Track Layer                     : 0
Track Volume                    : 0.00%
Image Width                     : 1920
Image Height                    : 1080
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : hvc1
Source Image Width              : 1920
Source Image Height             : 1080
X Resolution                    : 72
Y Resolution                    : 72
Bit Depth                       : 24
Video Field Order               : Progressive; 0
Color Representation            : nclx 1 1 1
Buffer Size                     : 0
Max Bitrate                     : 3796297
Average Bitrate                 : 3796297
Video Frame Rate                : 25
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 2022:08:28 15:25:09
Media Modify Date               : 2022:08:28 15:25:09
Media Time Scale                : 48000
Media Duration                  : 0:00:54
Media Language Code             : eng
Handler Description             : SoundHandler
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 48000
Handler Type                    : Metadata
Handler Vendor ID               : Apple
Encoder                         : Lavf58.76.100
Image Size                      : 1920x1080
Megapixels                      : 2.1
Avg Bitrate                     : 3.93 Mbps
Rotation                        : 0


The relevant data is the line:

Create Date                     : 2022:08:28 15:25:09


which, unlucky, gives the UTC date/time of video creation, in my tz it was 11:25:09.

I'd expect that if a datetime is given in UTC, the TZ should be given, too. But I can't find it. Neiter if I use the -a flag.

Is it hidden?

Is exiftool which forgets to show it?



StarGeek

The main video timestamps, CreateDate/ModifyDate, are supposed to be recorded in UTC, as you found.  It's not a requirement to record the time zone, though some cameras will shove an EXIF block into a video (which goes against the specs) which may have it.

Run this command to see all the time related tags in the file
exiftool -time:all -G1 -a -s File.mp4

If you don't see a time zone, possibly one of the OffsetTime* tags, then it just wasn't recorded.

When listing tags, you can add the -api QuickTimeUTC option and exiftool will adjust the listed time to the local time zone.  For example, in my local -07:00 time zone
C:\>exiftool -P -overwrite_original -CreateDate Y:\!temp\Test1.mp4
Create Date                     : 2022:08:30 19:00:00

C:\>exiftool -P -overwrite_original -api QuickTimeUTC -CreateDate Y:\!temp\Test1.mp4
Create Date                     : 2022:08:30 12:00:00-07:00

Though if the video was shot in a time zone other than the one the computer is in, it will be adjusted to that time zone.

If you want to add the proper local time for the video, you can add them to the Quicktime:CreationDate or Quicktime:DateTimeOriginal. These tags are supposed to be local time and will also hold the time zone. Assuming the computer is in the same time zone as where the video was shot, that can be done like this
exiftool -api QuickTimeUTC "-Quicktime:CreationDate<CreateDate" "-Quicktime:DateTimeOriginal<CreateDate /path/to/files/

If the time zone is different, that will be complicated.
* 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).

paolobenve


Happy Hobo

Quote from: StarGeek on August 30, 2022, 09:27:58 PMThe main video timestamps, CreateDate/ModifyDate, are supposed to be recorded in UTC, as you found. 
...
If you want to add the proper local time for the video, you can add them to the Quicktime:CreationDate or Quicktime:DateTimeOriginal. These tags are supposed to be local time and will also hold the time zone.
Are you sure?  I have thousands of files from iPhone, iPad, and devices from several non-Apple companies.   In these images, GPSDateTime when present is consistently UTC and CreateDate/DateTimeOriginal/SubSecDateTimeOriginal are local time.

Happy Hobo

Quote from: Happy Hobo on September 15, 2022, 12:18:36 PMAre you sure?  I have thousands of files from iPhone, iPad, and devices from several non-Apple companies.  In these images, GPSDateTime when present is consistently UTC and CreateDate/DateTimeOriginal/SubSecDateTimeOriginal are local time.
The man page gives examples of how to change DateTimeOriginal & CreateDate, which one should not do to a UTC tag.

Happy Hobo

#5
I found what appears to be an official spec.  Unfortunately, its title page says it is for still¹ images, so I can't really complain about the videos being different.  It has no mention of CreateDate.  But it does specify DateTimeOriginal and DataTimeDigitized as local time.

Is there any official standard for EXIF on videos?

¹Title page does say still images, yet it contains information on exif for audio.  But nothing for video

Phil Harvey

The QuickTime specification applies to MOV videos.  MP4 is closely related but for some reason they changed the way metadata is stored.  The official MP4 specifications cost (a lot of) money, and I'm not sure they would answer your question anyway.  Many specifications deal in detail with the image/video encoding, and only treat metadata superfluously.

- 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

Quote from: Happy Hobo on September 15, 2022, 12:18:36 PMAre you sure?  I have thousands of files from iPhone, iPad, and devices from several non-Apple companies.  In these images, GPSDateTime when present is consistently UTC and CreateDate/DateTimeOriginal/SubSecDateTimeOriginal are local time.

Make sure you use the command in FAQ #3 to see all tags including their locations and any duplicates.  The values will vary depending upon if it's a video file or an image file.

Local time:
EXIF:CreateDate
EXIF:ModifyDate
EXIF:DateTimeOriginal
Quicktime:DateTimeOriginal
Quicktime:CreationDate

UTC
GPS:GPSDateStamp+GPS:GPSTimeStamp (these are in the EXIF block)
Quicktime:CreateDate
Quicktime:ModifyDate

Flexible
XMP-exif:GPSDateTime
This one can be set to any time as long as it includes the right time zone, i.e. "2022:09:18 07:00:00-07:00", "2022:09:18 14:00:00Z", "2022:09:18 21:00:00+07:00" are all the same.  I assume that if there isn't a time zone included then it should be UTC but I haven't tested that on any software.  I'm not sure what programs might read it.  I know my old version (4.4) of Lightroom would remove this tag and update the GPS/EXIF ones.
* 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).

Happy Hobo

I consider it a bug (or a design error) for Apple to make CreateDate local time in stills and UTC in videos.  I have reported it as such.

Phil Harvey

UTC time makes the most sense, and is how Apple wrote the QuickTime specification for videos.  Otherwise you can't make sensible comparisons between times in files shot in different time zones.  If you add the -api QuickTimeUTC option to ExifTool, it will convert these to local time when extracting.

The people who wrote the EXIF specification are brain dead, and didn't even consider time zones until finally after about 20 years they added tags for time zone.

- 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

Was subseconds original part of the EXIF standard or was it added later?  The earliest version I can find is 2.1 via Archive.org.
* 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).

Phil Harvey

All I can say is that ExifTool version 1.0 supported these tags back in 2003.  Exif 2.1 pre-dates this by about 5 years.

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