Date-stamping Movies in Apple Photos

Started by reggoboy, December 12, 2016, 11:25:21 PM

Previous topic - Next topic

reggoboy

Hello,

I'm a new user to ExifTool, and glad to have found it.

Let me just briefly describe my workflow and then the problem, and I'm hoping you can help me resolve it.

I have about 30 MiniDV tapes that I want to rip into video clips and have them live in Apple's Photos app, with the key feature that they are SEARCHABLE BY DATE. Eg, I want to find my child's 4th birthday videos, so I enter August 2006, and it shows up.

My general workflow I'm trying to use is:

MiniDV Cassette -> LifeFlix -> *.mov files -> ExifTool -> Apple Photos

LifeFlix is uniquely helpful by preserving the original DV "date code" data digitally encoded in the footage by stamping it into the resulting .mov file's Creation and Modification Dates (though not Access Date):

Daves-MBP:~ dkitabji$ ls -l /Users/dkitabji/Dropbox/test-ORIGINAL.mov
-rw-r--r--@ 1 dkitabji  staff  374992807 Oct 21  2006 /Users/dkitabji/Dropbox/test-ORIGINAL.mov
Daves-MBP:~ dkitabji$ ls -lU /Users/dkitabji/Dropbox/test-ORIGINAL.mov
-rw-r--r--@ 1 dkitabji  staff  374992807 Oct 21  2006 /Users/dkitabji/Dropbox/test-ORIGINAL.mov
Daves-MBP:~ dkitabji$ ls -lc /Users/dkitabji/Dropbox/test-ORIGINAL.mov
-rw-r--r--@ 1 dkitabji  staff  374992807 Dec 12 19:27 /Users/dkitabji/Dropbox/test-ORIGINAL.mov
Daves-MBP:~ dkitabji$ ls -lu /Users/dkitabji/Dropbox/test-ORIGINAL.mov
-rw-r--r--@ 1 dkitabji  staff  374992807 Dec 12 19:27 /Users/dkitabji/Dropbox/test-ORIGINAL.mov

which is also visible using the Mac's Finder.

Unfortunately, when the .mov file is imported to Photos, Photos thinks the video clip was shot at a date/time that matches "Creation Date":

Daves-MBP:~ dkitabji$ exiftool -a /Users/dkitabji/Dropbox/test-ORIGINAL.mov | grep 'Date' | sort | uniq
Create Date                     : 2016:12:11 22:37:57
Creation Date                   : 2016:12:11 17:37:56-05:00
Creation Date (und-US)          : 2016:12:11 17:37:56-05:00
File Access Date/Time           : 2016:12:12 20:04:00-05:00
File Inode Change Date/Time     : 2016:12:12 19:27:28-05:00
File Modification Date/Time     : 2006:10:21 20:16:00-04:00
Media Create Date               : 2016:12:11 22:37:57
Media Modify Date               : 2016:12:11 22:39:34
Modify Date                     : 2016:12:11 22:39:34
Track Create Date               : 2016:12:11 22:37:57
Track Modify Date               : 2016:12:11 22:39:34

completely ruining my ability to chronologically track my many video clips. However, you can see the correct historical date captured in "File Modification Date/Time".

So, I was hoping ExifTool would help me fix this (I made a copy of the .mov file first):

Daves-MBP:~ dkitabji$ exiftool '-CreationDate<FileModifyDate'  /Users/dkitabji/Dropbox/test-MODIFIED.mov
    1 image files updated
Daves-MBP:~ dkitabji$ exiftool -a /Users/dkitabji/Dropbox/test-MODIFIED.mov | grep 'Date' | sort | uniq
Create Date                     : 2016:12:11 22:37:57
Creation Date                   : 2006:10:21 20:16:00-04:00
Creation Date (und-US)          : 2016:12:11 17:37:56-05:00
File Access Date/Time           : 2016:12:12 23:01:25-05:00
File Inode Change Date/Time     : 2016:12:12 23:01:06-05:00
File Modification Date/Time     : 2016:12:12 23:01:06-05:00
Media Create Date               : 2016:12:11 22:37:57
Media Modify Date               : 2016:12:11 22:39:34
Modify Date                     : 2016:12:11 22:39:34
Track Create Date               : 2016:12:11 22:37:57
Track Modify Date               : 2016:12:11 22:39:34

Sure enough, the Creation Date now has the actual recording date (though, presumably because I just performed a filesystem operation, the actual File Modification Date/Time which originally captured that value, has now been overwritten).

Sadly, though, importing this newly-modified .mov into Photos leaves Photos still thinking the recording took place at 2016:12:11 17:37:56.

When I look at the above metadata dump, the only place left still showing that value is an attribute "Creation Date (und-US)". Is there any way to change that attribute?

Or am I barking up the wrong tree?

At the risk of looking stupid, hopefully I'm missing something simple. But your help is greatly appreciated!

Dave

Hayo Baan

File modification datetime is always one of the worst date fields to use as it changes each time you touch the file. In your exiftool change step, you can preserve it by using the -P option, but as you found it probably isn't the tag that is used by photos anyway.

The likeliest tag is, I think, the media create date. It depends on the format of the file, whether or not you can change it with exiftool. If not, I could look into extending my matchDateTime script to cater for your situation. Just send me an email with a small sample file and I will have a look.

I don't know the (und-US) version of the datetime but if you want to know the tag name you could use to change it, add -s to exiftool, that will show you the name of the tag instead of a description.
Hayo Baan – Photography
Web: www.hayobaan.nl

Alan Clifford

Can I suggest that the first think you do after the Lifeflix stage is to preserve the date into the file itself rather than just on the filesystem. .mov files can contain xmp tags so I would copy the correct date from creation date (or modification date) to xmp:datetimeoriginal.

This probably won't solve the photo application problem but your will have preserved the date.

reggoboy

Quote from: Hayo Baan on December 13, 2016, 01:48:05 AM
File modification datetime is always one of the worst date fields to use as it changes each time you touch the file.

Agreed. I'm in conversation with the LifeFlix developer with some feedback, but not sure how likely that is to change.

Quote from: Hayo Baan on December 13, 2016, 01:48:05 AM
In your exiftool change step, you can preserve it by using the -P option, but as you found it probably isn't the tag that is used by photos anyway.

Aha, good tip. Thanks! Correct that it won't solve my problem, but that will definitely be a good practice.

Quote from: Hayo Baan on December 13, 2016, 01:48:05 AM
The likeliest tag is, I think, the media create date. It depends on the format of the file, whether or not you can change it with exiftool. If not, I could look into extending my matchDateTime script to cater for your situation. Just send me an email with a small sample file and I will have a look.

Well thanks, I had already tried both the Media* and Track* attributes, using ExifTool to change them to the right value, but none of them affected Photos view of the footage date.

Quote from: Hayo Baan on December 13, 2016, 01:48:05 AM
I don't know the (und-US) version of the datetime but if you want to know the tag name you could use to change it, add -s to exiftool, that will show you the name of the tag instead of a description.

Aha, thanks. Another thing I was trying to find. So I tried to change that tag:

Daves-MBP:~ dkitabji$ exiftool '-CreationDate-und-US<CreationDate'  /Users/dkitabji/Dropbox/test-MODIFIED.mov
Warning: Tag 'creationdate' does not support alternate languages - /Users/dkitabji/Dropbox/test-MODIFIED.mov
Warning: No writable tags set from /Users/dkitabji/Dropbox/test-MODIFIED.mov
    0 image files updated
    1 image files unchanged


So I'm concluding from this reply from Phil that this means I can't edit this tag:

  https://exiftool.org/forum/index.php?topic=5511.0

So this would appear to leave me with no idea of how to proceed. Any ideas??

reggoboy

Quote from: Alan Clifford on December 13, 2016, 08:14:17 AM
Can I suggest that the first think you do after the Lifeflix stage is to preserve the date into the file itself rather than just on the filesystem. .mov files can contain xmp tags so I would copy the correct date from creation date (or modification date) to xmp:datetimeoriginal.

This probably won't solve the photo application problem but your will have preserved the date.

Thanks, Alan. This sounds like an excellent practice.

Hayo Baan

Quote from: reggoboy on December 13, 2016, 09:42:03 PM
Quote from: Hayo Baan on December 13, 2016, 01:48:05 AM
File modification datetime is always one of the worst date fields to use as it changes each time you touch the file.

Agreed. I'm in conversation with the LifeFlix developer with some feedback, but not sure how likely that is to change.
Let's hope they are willing to change this (note: this is why there are e.g. datetimeoriginal and datatimedigitized tags).

Quote from: reggoboy on December 13, 2016, 09:42:03 PM
Quote from: Hayo Baan on December 13, 2016, 01:48:05 AM
In your exiftool change step, you can preserve it by using the -P option, but as you found it probably isn't the tag that is used by photos anyway.

Aha, good tip. Thanks! Correct that it won't solve my problem, but that will definitely be a good practice.

Quote from: Hayo Baan on December 13, 2016, 01:48:05 AM
The likeliest tag is, I think, the media create date. It depends on the format of the file, whether or not you can change it with exiftool. If not, I could look into extending my matchDateTime script to cater for your situation. Just send me an email with a small sample file and I will have a look.

Well thanks, I had already tried both the Media* and Track* attributes, using ExifTool to change them to the right value, but none of them affected Photos view of the footage date.
Hmm, I need to look into this and try to figure out what tag they are using. Can you send me a small sample movie?

Quote from: reggoboy on December 13, 2016, 09:42:03 PM
Quote from: Hayo Baan on December 13, 2016, 01:48:05 AM
I don't know the (und-US) version of the datetime but if you want to know the tag name you could use to change it, add -s to exiftool, that will show you the name of the tag instead of a description.

Aha, thanks. Another thing I was trying to find. So I tried to change that tag:

Daves-MBP:~ dkitabji$ exiftool '-CreationDate-und-US<CreationDate'  /Users/dkitabji/Dropbox/test-MODIFIED.mov
Warning: Tag 'creationdate' does not support alternate languages - /Users/dkitabji/Dropbox/test-MODIFIED.mov
Warning: No writable tags set from /Users/dkitabji/Dropbox/test-MODIFIED.mov
    0 image files updated
    1 image files unchanged


So I'm concluding from this reply from Phil that this means I can't edit this tag:

  https://exiftool.org/forum/index.php?topic=5511.0

So this would appear to leave me with no idea of how to proceed. Any ideas??

Looks indeed like exiftool is not yet able to write these CreationDate-und-US like tags. If this is indeed the tag that needs to be changed, I might be able to alter my matchDateTime script to allow updating it. If you can send me a sample, I'll sure have a look.
Hayo Baan – Photography
Web: www.hayobaan.nl

reggoboy

Thanks, Hayo.

I PM'd you a Dropbox link to a small video file with the same properties as the one discussed so far.

I'll be very interested to see what you discover!

Meanwhile, where can I learn/read what "CreationDate-und-US" really represents and how, e.g., it differs from "CreationDate" and "CreateDate", which I have all of?

reggoboy

I will add a few more notes:

1) Photos is clearly using QuickTime:CreationDate-und-US since that is the only tag on the file prior to import matching the Date/Time shown in the clip's properties after import to Photos

2) ExifTool will not allow me to modify QuickTime:CreationDate-und-US, nor to delete it, nor even to delete the entire QuickTime group.

3) I thought maybe I could fool Photos by creating an XMP:CreationDate-und-US tag and putting the correct date in there, but ExifTool doesn't permit that

I feel that I know how to fix the problem, I just don't have the tool to get the job done.

Hayo, I will wait for you! Thanks!

Hayo Baan

I had a look at the file you sent me and did some digging and playing around with Photos (I don't use that application myself). After some playing I found out where Photos takes the date from: Photos takes the date from the "Birth" date of the file (aka. the file creation date).

To be honest this is too ridiculous to be true, but it is. First of all, that date does not get shown in Finder, nor with any "normal" command-line tools (e.g. ls). Moreover there is no good and reliable way to set that date, and to make things even worse, if you create a copy of the file, the "Birth" time normally gets set to the current time. A real mess!

To get the Birth time of a file you need to use the stat command. With just files as arguments the stat command gives you a whole bunch of file info, including four (!) different types of file dates (access, modification, inode change, birth). You can specify the output format of the stat command quite flexibly, e.g. to just get the birth date and the name of the file, use stat -f "%SB %N" FILES.

You can change the file's birth time using the touch command to change the file's modification date. If you use this command to set a modification time in the past, the birth time gets set as well (the reasoning being that you can not modify a file before it exists). As touch uses a different datetime format than is usually used by exiftool, you need to have exiftool show the date in a different format in order to be able to use it directly (-d "%Y%m%d%H%M.%S" gives the right format).

Use touch -t YYYYMMDDhhmm.ss FILE to set the file modification date (and the birth time, if it is a date in the past).

So, to solve your problem with Photos showing the wrong dates you need to set the file's birth time to the correct date/time. On top of that I would strongly suggest also setting the creation date in the metadata of the file (QuickTime:CreateDate and QuickTime:CreationDate seems most logical to me). If you have the date set this way, you can always fall back to these dates and reset the birth time of your files as outlined above. The following will do this automatically:
for f in *.mov; do touch -t `exiftool -T -d "%Y%m%d%H%M.%S" -CreationDate "$f"` "$f"; done

Note: you may also want to use "-API QuickTimeUTC" to tell exiftool that the quicktime datetimes are in UTC, not local time (not necessary for CreationDate as that already has timezone information).
Hayo Baan – Photography
Web: www.hayobaan.nl

Alan Clifford

Hi Hayo

Quote from: Hayo Baan on December 15, 2016, 04:04:48 AM

To be honest this is too ridiculous to be true, but it is. First of all, that date does not get shown in Finder, nor with any "normal" command-line tools (e.g. ls). Moreover there is no good and reliable way to set that date, and to make things even worse, if you create a copy of the file, the "Birth" time normally gets set to the current time. A real mess!

I've just spent half an hour playing about with stat and touch (decided not to go play golf today anyway)!

ls  -lTU filename

will give you the create date

In finder, you can show "the date created"


After a final "touch" to update everything except the create date, I get


egremont:temp alan$ touch ahc_7957.jpg
egremont:temp alan$ stat -t "%n%F %T"  ahc_7957.jpg
16777220 4347211 -rw-r--r-- 1 alan staff 0 134442 "
2016-12-15 11:42:51" "
2016-12-15 11:42:50" "
2016-12-15 11:42:50" "
2016-02-02 02:02:00" 4096 264 0 ahc_7957.jpg
egremont:temp alan$ ls  -lTU ahc_7957.jpg
-rw-r--r--@ 1 alan  staff  134442  2 Feb 02:02:00 2016 ahc_7957.jpg
egremont:temp alan$


and the February date shows up in Finder under "Date Created".

Hayo Baan

Quote from: Alan Clifford on December 15, 2016, 10:52:42 AM
Hi Hayo

Quote from: Hayo Baan on December 15, 2016, 04:04:48 AM

To be honest this is too ridiculous to be true, but it is. First of all, that date does not get shown in Finder, nor with any "normal" command-line tools (e.g. ls). Moreover there is no good and reliable way to set that date, and to make things even worse, if you create a copy of the file, the "Birth" time normally gets set to the current time. A real mess!

I've just spent half an hour playing about with stat and touch (decided not to go play golf today anyway)!

ls  -lTU filename

will give you the create date

In finder, you can show "the date created"
Ah, Alan, good to know, I somehow overlooked the fact that you could use -U to get the creation date with ls. Good find! But I think you do agree using the creation date is still quite ridiculous, especially since e.g. movie files contain metadata that is much more applicable... (I was actually surprised that even with a file from an iPhone it uses the create date and not the metadata :o)
Hayo Baan – Photography
Web: www.hayobaan.nl

Alan Clifford

Quote from: Hayo Baan on December 15, 2016, 11:53:28 AM
But I think you do agree using the creation date is still quite ridiculous.

I do agree.  The creation date relates to a particular instance of the file on a single file system rather than to the file itself.

reggoboy

I had demonstrated "ls -lU" in my original post ;-)

Alan Clifford

Quote from: reggoboy on December 15, 2016, 06:54:00 PM
I had demonstrated "ls -lU" in my original post ;-)

That was too far back in the thread!  :-)

reggoboy

First of all, thanks a TON to you guys for all your input and time spent on this so far.

Now, for some questions.

Are you guys working on Macs like me? Because your command line syntax and the resulting output and results seems quite different than mine. In particular, let me show you how Hayo's clever suggestion worked for me:

(Note that I'm now using a much smaller file in this post with different dates, but otherwise the same issues as previously)

Daves-MBP:DV dkitabji$ stat -x small-MODIFIED.mov
  File: "small-MODIFIED.mov"
  Size: 22149457     FileType: Regular File
  Mode: (0644/-rw-r--r--)         Uid: (  501/dkitabji)  Gid: (   20/   staff)
Device: 1,4   Inode: 2634297    Links: 1
Access: Wed Dec 14 23:48:41 2016
Modify: Thu Nov 30 13:42:00 2006
Change: Wed Dec 14 23:46:17 2016

(note the -x to get Linux style multi-line output). Note also the Modify date set in the past, the way this thread started. Finally, note that there's no Birth/Create date listed here.

Next I confirmed that the exiftool portion of Hayo's command would give us the the historic date output as expected, and that looks good:

Daves-MBP:DV dkitabji$ exiftool -T -d "%Y%m%d%H%M.%S" -CreationDate small-MODIFIED.mov
200611301342.00


Next, I tried Hayo's touch command on just this one file:

Daves-MBP:DV dkitabji$ touch -t `exiftool -T -d "%Y%m%d%H%M.%S" -CreationDate "small-MODIFIED.mov"` "small-MODIFIED.mov"
Daves-MBP:DV dkitabji$ stat -x small-MODIFIED.mov
  File: "small-MODIFIED.mov"
  Size: 22149457     FileType: Regular File
  Mode: (0644/-rw-r--r--)         Uid: (  501/dkitabji)  Gid: (   20/   staff)
Device: 1,4   Inode: 2634297    Links: 1
Access: Thu Dec 15 19:06:21 2016
Modify: Thu Nov 30 13:42:00 2006
Change: Thu Dec 15 19:06:20 2016


But since there's no Birth/CreateDate displayed, everything looks the same as before. But both the following commands show our understanding of file creation date set to the proper historic value:

Daves-MBP:DV dkitabji$ stat -f "%SB %N" small-MODIFIED.mov
Nov 30 13:42:00 2006 small-MODIFIED.mov
Daves-MBP:DV dkitabji$ ls -lU small-MODIFIED.mov
-rw-r--r--@ 1 dkitabji  staff  22149457 Nov 30  2006 small-MODIFIED.mov


But then recall from my original post that ls -U showed this historic date back then, too (though I don't remember what stat said).

And so then I dragged the clip into Photos, and sure enough, I get the same result as before: Photos sees the date as CreationDate-und-US: 2016:12:11 17:37:56:


Daves-MBP:DV dkitabji$ exiftool -a -G -s small-MODIFIED.mov | grep 'Date' | sort | uniq
[File]          FileAccessDate                  : 2016:12:15 20:06:29-05:00
[File]          FileInodeChangeDate             : 2016:12:15 19:06:20-05:00
[File]          FileModifyDate                  : 2006:11:30 13:42:00-05:00
[QuickTime]     CreateDate                      : 2016:12:11 22:49:02
[QuickTime]     CreationDate-und-US             : 2016:12:11 17:37:56-05:00
[QuickTime]     MediaCreateDate                 : 2016:12:11 22:49:02
[QuickTime]     MediaModifyDate                 : 2016:12:11 22:49:08
[QuickTime]     ModifyDate                      : 2016:12:11 22:49:08
[QuickTime]     TrackCreateDate                 : 2016:12:11 22:49:02
[QuickTime]     TrackModifyDate                 : 2016:12:11 22:49:08
[XMP]           CreationDate                    : 2006:11:30 13:42:00-05:00
[XMP]           DateTimeOriginal                : 2006:11:30 13:42:00-05:00


So I'm curious, Hayo, what OS are you working on? I'm on macOS Sierra 10.12.1. I'm trying to figure out why your results differ from what I'm seeing? It still seems like I need to find a way to modify QuickTime:CreationDate-und-US in order to have hope here.

Thoughts??

Thanks!