Apple Photos doesn't recognize correct encoding date for mp4 file

Started by Resultant, December 23, 2019, 11:23:30 AM

Previous topic - Next topic

Resultant

Greetings,

I've been using ExifTool for a while now to correct the dates for my photos and videos, largely by slowly reading and digesting the valuable information on this wonderful site. This however is my first post because I've now hit a brick wall.

I've successfully tagged numerous video files (mp4, mov) so that Apple Photos correctly identifies the date they were taken, so I'm not new to this process. However, as of late, I've run into an issue where videos captured and encoded from my old VHS tapes don't show up with the correct date taken using my trusted procedure. I've been using the -AllDates command to set the 3 key tags necessary (Create Date, Modify Date and Date/Time Original) which successfully does the trick to get Apple Photos to recognize the correct dates. I've learned that Media Create/Modify Date and Track Create/Modify Date are not really necessary to set for this purpose.

Here's the info of the file that I've set to "1995:01:18 18:50:00" and yet it shows up in Apple Photos as "November 24, 183057   7:15:10 PM". Yes, you read that correct - 183057. I'm facing a similar issue with numerous other videos and when I compare their ExifTool output to others that I've successfully converted, I can see NO discernible difference the types of fields/tages used etc. I'm stumped. Please help.

ExifTool Version Number         : 11.80
File Name                       : ultra.mp4
Directory                       : .
File Size                       : 130 MB
File Modification Date/Time     : 2019:12:23 06:50:03-08:00
File Access Date/Time           : 2019:12:23 06:50:16-08:00
File Inode Change Date/Time     : 2019:12:23 06:50:03-08:00
File Permissions                : rwxrwxrwx
File Type                       : MP4
File Type Extension             : mp4
MIME Type                       : video/mp4
Major Brand                     : MP4 v2 [ISO 14496-14]
Minor Version                   : 0.0.1
Compatible Brands               : isom, mp41, mp42
Movie Header Version            : 0
Time Scale                      : 30000
Duration                        : 0:13:03
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               : 2019:12:23 14:43:54
Track Modify Date               : 2019:12:23 14:45:50
Track ID                        : 1
Track Duration                  : 0:13:03
Track Layer                     : 0
Track Volume                    : 100.00%
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 48000
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Image Width                     : 640
Image Height                    : 480
Media Header Version            : 0
Media Create Date               : 2019:12:23 14:43:54
Media Modify Date               : 2019:12:23 14:45:50
Media Time Scale                : 30000
Media Duration                  : 0:13:03
Media Language Code             : und
Handler Type                    : Video Track
Handler Description             : Core Media Video
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : avc1
Source Image Width              : 640
Source Image Height             : 480
X Resolution                    : 72
Y Resolution                    : 72
Bit Depth                       : 24
Color Representation            : nclx 6 1 6
Video Field Order               : Progressive; 0
Pixel Aspect Ratio              : 1:1
Video Frame Rate                : 29.97
Clip File Name                  : original
Description                     : Sound Capture
Unknown Thumbnail               : (Binary data 42827 bytes, use -b option to extract)
Author                          :
Title                           : original
XMP Toolkit                     : Image::ExifTool 11.80
Date/Time Original              : 1995:01:18 18:50:00
Create Date                     : 1995:01:18 18:50:00
Modify Date                     : 1995:01:18 18:50:00
Movie Data Size                 : 135583983
Movie Data Offset               : 345473
Image Size                      : 640x480
Megapixels                      : 0.307
Avg Bitrate                     : 1.38 Mbps
Rotation                        : 0

Resultant

To help troubleshoot here's a few more things:
- Videos were captured from VHS using a PC program
- Local installation of Apple Photos is not a problem; the problem persists across different Macs
- Google Photos correctly recognizes the date created for the resulting videos

StarGeek

Use this command to show all time related tags and where they are located. 
exiftool -time:all -g1 -a -s ultra.mp4

This command will show duplicate tags and the groups they belong to, which is very important when trying to figure where a problem might be.
* 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).

Resultant

Thanks StarGeek. Here's what I got:

---- System ----
FileModifyDate                  : 2019:12:23 06:50:03-08:00
FileAccessDate                  : 2019:12:23 09:12:24-08:00
FileInodeChangeDate             : 2019:12:23 06:50:03-08:00
---- QuickTime ----
CreateDate                      : 1995:01:18 18:50:00
ModifyDate                      : 1995:01:18 18:50:00
---- Track1 ----
TrackCreateDate                 : 2019:12:23 14:43:54
TrackModifyDate                 : 2019:12:23 14:45:50
MediaCreateDate                 : 2019:12:23 14:43:54
MediaModifyDate                 : 2019:12:23 14:45:50
---- Track2 ----
TrackCreateDate                 : 2019:12:23 14:43:54
TrackModifyDate                 : 2019:12:23 14:45:50
MediaCreateDate                 : 2019:12:23 14:43:54
MediaModifyDate                 : 2019:12:23 14:45:50
---- UserData ----
DateTimeOriginal                : 1995:01:18 18:50:00
---- XMP-exif ----
DateTimeOriginal                : 1995:01:18 18:50:00
---- XMP-xmp ----
CreateDate                      : 1995:01:18 18:50:00
ModifyDate                      : 1995:01:18 18:50:00

Phil Harvey

I don't have any ideas as to how/why this could happen, but you may be able to narrow it down with some work.  First, if you can determine which of the specific tags is causing the problem:

QuickTime:CreateDate, QuickTime:ModifyDate or UserData:DateTimeOriginal

(I doubt that the XMP tags would be the problem)

Once you find the date/time tag, try writing different values to find the latest date/time which gives a problem (I'm guessing Dec 1999).

Once it is narrowed down like this, I'll take a look at the specifications to see if I can come up with a theory as to how this could happen.

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

Resultant

Thanks Phil. I went to the original source capture that was done on a PC (and hence has nothing to do with QuickTime). I ran the -AllDates command, and the result is identical. Here are all the tags of the converted PC file (i.e. no QuickTime). So, I suppose QuickTime tags have nothing to do with the problem? Does this help narrow down?

exiftool -time:all -g1 -a -s originalpc.mp4
---- System ----
FileModifyDate                  : 2019:12:23 09:09:42-08:00
FileAccessDate                  : 2019:12:23 09:36:32-08:00
FileInodeChangeDate             : 2019:12:23 09:09:42-08:00
---- QuickTime ----
CreateDate                      : 1995:01:18 18:50:00
ModifyDate                      : 1995:01:18 18:50:00
---- Track1 ----
TrackCreateDate                 : 2019:12:23 07:43:44
TrackModifyDate                 : 2019:12:23 07:43:44
MediaCreateDate                 : 2019:12:23 07:43:44
MediaModifyDate                 : 2019:12:23 07:43:44
---- Track2 ----
TrackCreateDate                 : 2019:12:23 07:43:44
TrackModifyDate                 : 2019:12:23 07:43:44
MediaCreateDate                 : 2019:12:23 07:43:44
MediaModifyDate                 : 2019:12:23 07:43:44
---- ItemList ----
ContentCreateDate               : 2019:12:22
---- UserData ----
DateTimeOriginal                : 1995:01:18 18:50:00
---- XMP-exif ----
DateTimeOriginal                : 1995:01:18 18:50:00
---- XMP-xmp ----
CreateDate                      : 1995:01:18 18:50:00
ModifyDate                      : 1995:01:18 18:50:00

Resultant

Also, changing the written date to "2005:01:18 18:50:00" produces "November 25, 183067   7:15:10 PM". So

"1995:01:18 18:50:00" results in "November 24, 183057   7:15:10 PM"
"2005:01:18 18:50:00" results in "November 25, 183067   7:15:10 PM"

Phil Harvey

Quote from: Resultant on December 23, 2019, 12:41:29 PM
Thanks Phil. I went to the original source capture that was done on a PC (and hence has nothing to do with QuickTime).

The MP4 file format is based on the QuickTime format, so in this respect it does have something to do with QuickTime.

Quote from: Resultant on December 23, 2019, 12:53:10 PM
Also, changing the written date to "2005:01:18 18:50:00" produces "November 25, 183067   7:15:10 PM".

Which specific tag causes this change?

Which tag(s) do you have to write with post-2000 dates to get Photos to display the proper date?

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

Resultant

I'm not sure I understand Phil (sorry, I'm a newbie). The only tags I write/update are the 3 tags using -AllDates. No matter what dates I use (post or pre 2000) using -AllDates, the result is still garbage. However, I CAN confirm that without using -AllDates, the video shows up with today's date (the date it was encoded). So clearly, running -AllDates is messing something up.

Phil Harvey

OK, so try starting from a file that shows the proper date/time in Photos and writing the tags I mentioned ( one at a time (QuickTime:CreateDate, QuickTime:ModifyDate and UserData:DateTimeOriginal) instead of using AllDates to see which one causes the problem.

And you say it is a problem no matter what date you write?  Odd.  I can't see how this would happen if you wrote the same date as was already in the file.

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

Resultant

SOLVED IT! Well sort of, without really understanding WHY the error was happening. As I suspected, the -AllDates was messing things up. I suspected, it was writing stuff that's probably not needed. So, instead of -AllDates, I did a -CreateDate and -ModifyDate and presto, Apple Photos picks up the correct date. So, I did a tags dump as a result of both operations, and you'll see that -AllDates creates "---- User Data----" section and "---- XMP-exif ----" sections that the -CreateDate and -ModifyDate operations do not. Why this is significant, I don't know, but would love to know since I've racked my brains on this for 6+ hours.


----------------- AllDates Operation ----------------
exiftool -time:all -g1 -a -s alldates.mp4
---- System ----
FileModifyDate                  : 2019:12:23 10:26:45-08:00
FileAccessDate                  : 2019:12:23 10:26:46-08:00
FileInodeChangeDate             : 2019:12:23 10:26:45-08:00
---- QuickTime ----
CreateDate                      : 1999:05:23 14:01:46
ModifyDate                      : 1999:05:23 14:01:46
---- Track1 ----
TrackCreateDate                 : 2019:12:23 18:22:47
TrackModifyDate                 : 2019:12:23 18:22:54
MediaCreateDate                 : 2019:12:23 18:22:47
MediaModifyDate                 : 2019:12:23 18:22:54
---- Track2 ----
TrackCreateDate                 : 2019:12:23 18:22:47
TrackModifyDate                 : 2019:12:23 18:22:54
MediaCreateDate                 : 2019:12:23 18:22:47
MediaModifyDate                 : 2019:12:23 18:22:54
---- UserData ----
DateTimeOriginal                : 1999:05:23 14:01:46
---- XMP-exif ----
DateTimeOriginal                : 1999:05:23 14:01:46
---- XMP-xmp ----
CreateDate                      : 1999:05:23 14:01:46
ModifyDate                      : 1999:05:23 14:01:46


----------------- CreateDate and ModifyDate Operation ----------------

exiftool -time:all -g1 -a -s createandmodify.mp4
---- System ----
FileModifyDate                  : 2019:12:23 10:27:53-08:00
FileAccessDate                  : 2019:12:23 10:27:54-08:00
FileInodeChangeDate             : 2019:12:23 10:27:53-08:00
---- QuickTime ----
CreateDate                      : 1999:05:23 14:01:46
ModifyDate                      : 1999:05:23 14:01:46
---- Track1 ----
TrackCreateDate                 : 2019:12:23 18:22:47
TrackModifyDate                 : 2019:12:23 18:22:54
MediaCreateDate                 : 2019:12:23 18:22:47
MediaModifyDate                 : 2019:12:23 18:22:54
---- Track2 ----
TrackCreateDate                 : 2019:12:23 18:22:47
TrackModifyDate                 : 2019:12:23 18:22:54
MediaCreateDate                 : 2019:12:23 18:22:47
MediaModifyDate                 : 2019:12:23 18:22:54
---- XMP-xmp ----
CreateDate                      : 1999:05:23 14:01:46
ModifyDate                      : 1999:05:23 14:01:46

StarGeek

Glad you got it solved.  I was about to put up a video with timestamps set by FFMpeg for you to test next.

The XMP tags are probably ignored by Apple Photos.  Adobe products are about the only things that read that data.
* 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

So was it the UserData:DateTimeOriginal that was causing the problem?  (I doubt the XMP would cause this.)

If so, I'll look into this tag to see if I can figure out how this could happen.

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

Phil Harvey

I did some digging into UserData:DateTimeOriginal.  I don't have any samples which contain this information, but this reference says it should be written in ISO 8601 format, which is what ExifTool is doing (see the user-data 'date' atom):

"Date and time, formatted according to ISO 8601, when the content was created. For clips captured by recording devices, this is typically the date and time when the clip's recording started."

However, I can't find reference to this tag in any Apple documentation.

Maybe I should make this tag read-only to prevent future confusion until we find a reason, and a compatible format to write for it.

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

Resultant

Hi Phil,

Very likely, it was the UserData:DateTimeOriginal that was causing the problem. I'm not smart enough to conclusively say that the XMP is not the problem. Just wanted to say THANK YOU for creating this Swiss Army Knife of a program. While it gives users enough rope to hang themselves, I'd rather be with it than without it. You're doing a terrific service by helping others like me curate their media. Best