News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Copying a Live Photo still, and its accompanying mov

Started by bodacious, November 17, 2019, 05:49:58 PM

Previous topic - Next topic

bodacious

I have a large collection of Live Photos created on iOS. When the original files are exported from the Photos app on macOS, you are presented with the Live Photo's two parts, a jpg or heic file, and its live element, a mov file. If you drag the two parts into a Library, they combine again.

I would like to copy the still files, and their accompanying video files, from their current location to a new folder, and automatically sort them into year/month/date folders. Both parts of the Live Photo have the same filename, and I would prefer not to modify the files in any way, just their locations.

I think I've got a handle on copying the still files, but I'm unsure how to send off the video files to the same folder. I'm unlikely to be the first to want to do it, so does anyone have any experience doing this?

Thanks!

StarGeek

Try something like
exiftool -o . -d '/path/to/new/directory/%Y/%m/%d' '-directory<DateTimeOriginal' '-directory<CreateDate' <FileOrDir>

Depending upon your time zone and if the time stamps in the .mov files are written correctly or not, you may have to add -api QuickTimeUTC to the command as well.  To double check, run
exiftool -DateTimeOriginal -CreateDate File.jpg File.mov
on two matching files (replace File with the path/name of the file).  If the two results are different (off by a time zone), then add the -api QuickTimeUTC option.

The time stamps in a mov file are supposed to be set to UTC, which means they would differ from the jpegs (which are supposed to be set to local time) by the time zone.  Not all cameras will write the mov file time stamps properly, though.  If they are different then they were written properly and need the QuickTimeUTC option to adjust the output correctly.

* 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).

bodacious

Thank you very much. As far as I can tell, that did the trick.

bodacious

Is there a way to organise files that were not moved—for example photos that have been sent to me via messenging apps, where the EXIF data has been stripped—to a directory of my choosing, in the same pass?

Phil Harvey

Sure:

exiftool -o . -d '/path/to/new/directory/%Y/%m/%d' '-directory=DIRECTORY_OF_YOUR_CHOOSING' '-directory<DateTimeOriginal' '-directory<CreateDate' <FileOrDir>

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

Rowan1002

Hi - I have a very similar issue so rather than starting a new thread, I thought better to add to this one.

I have a folder with Live Photos which I have extracted from Mac Photos, and they have indeed been split into the JPG and MOV file. When a JPG and MOV relate to the same Live Photo, they have been extracted with the same number in their filename, eg. IMG - 4.JPG and IMG - 4.MOV.

Issue is:

1. The order of the file sequence is totally random, so if you sort the folder by name, while the MOV and JPG files (for each Live Photo) are together, the order of files is not following any sort of date order.

2. The folder contains Live Photos from various holidays and timezones (where the MOV has a different TimeZone to the accompanying JPG), and other Live Photos in another TimeZones.

3. There are some .Mov files which are just videos taken i.e. not Live Photos.

The ideal outcome would be to name the files with the date and time taken, so I can sort by filename and they are in the proper order - but also making sure the JPG and MOV for one Live Photo are together in the order, which is hard because (1) MOV files having a diff timezone to the associated JPG and therefore end up further on or behind in the sequence (2) lots of Live photos in same folder taken in various timezones (3) Mov files that are not live photos but are just videos taken on the Iphone so don't want to really change any metadata for these.

Below are a couple of examples:

Example 1:

Rowans-MBP:~ james$ exiftool -a -G1 -s -time:all /Users/james/Pictures/2017\ Exports/IMG\ -\ 529.JPG /Users/james/Pictures/2017\ Exports/IMG\ -\ 529.mov
======== /Users/james/Pictures/2017 Exports/IMG - 529.JPG
[System]        FileModifyDate                  : 2017:04:28 18:09:48+01:00
[System]        FileAccessDate                  : 2020:05:24 13:49:23+01:00
[System]        FileInodeChangeDate             : 2020:05:24 03:13:42+01:00
[IFD0]          ModifyDate                      : 2017:04:28 18:09:48
[ExifIFD]       DateTimeOriginal                : 2017:04:28 18:09:48
[ExifIFD]       CreateDate                      : 2017:04:28 18:09:48
[ExifIFD]       SubSecTimeOriginal              : 208
[ExifIFD]       SubSecTimeDigitized             : 208
[GPS]           GPSTimeStamp                    : 16:09:47.83
[GPS]           GPSDateStamp                    : 2017:04:28
[Composite]     SubSecCreateDate                : 2017:04:28 18:09:48.208
[Composite]     SubSecDateTimeOriginal          : 2017:04:28 18:09:48.208
[Composite]     GPSDateTime                     : 2017:04:28 16:09:47.83Z
======== /Users/james/Pictures/2017 Exports/IMG - 529.mov
[System]        FileModifyDate                  : 2017:04:28 17:09:48+01:00
[System]        FileAccessDate                  : 2020:05:24 13:49:21+01:00
[System]        FileInodeChangeDate             : 2020:05:24 03:13:42+01:00
[QuickTime]     CreateDate                      : 2017:04:28 16:09:50
[QuickTime]     ModifyDate                      : 2017:04:28 16:09:51
[Track1]        TrackCreateDate                 : 2017:04:28 16:09:50
[Track1]        TrackModifyDate                 : 2017:04:28 16:09:51
[Track1]        MediaCreateDate                 : 2017:04:28 16:09:50
[Track1]        MediaModifyDate                 : 2017:04:28 16:09:51
[Track2]        TrackCreateDate                 : 2017:04:28 16:09:50
[Track2]        TrackModifyDate                 : 2017:04:28 16:09:51
[Track2]        MediaCreateDate                 : 2017:04:28 16:09:50
[Track2]        MediaModifyDate                 : 2017:04:28 16:09:51
[Track3]        TrackCreateDate                 : 2017:04:28 16:09:50
[Track3]        TrackModifyDate                 : 2017:04:28 16:09:51
[Track3]        MediaCreateDate                 : 2017:04:28 16:09:50
[Track3]        MediaModifyDate                 : 2017:04:28 16:09:51
[Keys]          CreationDate                    : 2017:04:28 18:09:48+02:00
    2 image files read

Example 2

Rowans-MBP:~ james$ exiftool -a -G1 -s -time:all /Users/james/Pictures/2017\ Exports/IMG\ -\ 2392.JPG /Users/james/Pictures/2017\ Exports/IMG\ -\ 2392.mov
======== /Users/james/Pictures/2017 Exports/IMG - 2392.JPG
[System]        FileModifyDate                  : 2017:04:23 16:45:22+01:00
[System]        FileAccessDate                  : 2020:05:24 13:58:04+01:00
[System]        FileInodeChangeDate             : 2020:05:24 03:13:42+01:00
[IFD0]          ModifyDate                      : 2017:04:23 16:45:22
[ExifIFD]       DateTimeOriginal                : 2017:04:23 16:45:22
[ExifIFD]       CreateDate                      : 2017:04:23 16:45:22
[ExifIFD]       SubSecTimeOriginal              : 007
[ExifIFD]       SubSecTimeDigitized             : 007
[GPS]           GPSTimeStamp                    : 15:45:18.68
[GPS]           GPSDateStamp                    : 2017:04:23
[Composite]     SubSecCreateDate                : 2017:04:23 16:45:22.007
[Composite]     SubSecDateTimeOriginal          : 2017:04:23 16:45:22.007
[Composite]     GPSDateTime                     : 2017:04:23 15:45:18.68Z
======== /Users/james/Pictures/2017 Exports/IMG - 2392.mov
[System]        FileModifyDate                  : 2017:04:23 16:45:22+01:00
[System]        FileAccessDate                  : 2020:05:24 13:58:03+01:00
[System]        FileInodeChangeDate             : 2020:05:24 03:13:42+01:00
[QuickTime]     CreateDate                      : 2017:04:23 15:45:24
[QuickTime]     ModifyDate                      : 2017:04:23 15:45:24
[Track1]        TrackCreateDate                 : 2017:04:23 15:45:24
[Track1]        TrackModifyDate                 : 2017:04:23 15:45:24
[Track1]        MediaCreateDate                 : 2017:04:23 15:45:24
[Track1]        MediaModifyDate                 : 2017:04:23 15:45:24
[Track2]        TrackCreateDate                 : 2017:04:23 15:45:24
[Track2]        TrackModifyDate                 : 2017:04:23 15:45:24
[Track2]        MediaCreateDate                 : 2017:04:23 15:45:24
[Track2]        MediaModifyDate                 : 2017:04:23 15:45:24
[Track3]        TrackCreateDate                 : 2017:04:23 15:45:24
[Track3]        TrackModifyDate                 : 2017:04:23 15:45:24
[Track3]        MediaCreateDate                 : 2017:04:23 15:45:24
[Track3]        MediaModifyDate                 : 2017:04:23 15:45:24
[Keys]          CreationDate                    : 2017:04:23 16:45:21+01:00



Rowan1002

Thinking this through I think I need a command that will do the below?

If filename of JPG and MOV includes same number sequence ie. IMG - 4.jpg and IMG - 4.mov
then change JPG filename to createdate of JPG and change MOV filename to createdate of the associated JPG


Thanks, Rowan

StarGeek

The reason there is a difference between the time stamps of the video and jpgs is because they hold their time stamps in different ways.  The jpg timestamps are supposed to be in the local time of the location they were taken.  Video timestamps are in UTC.  That accounts for the 1-2 hour difference.

if you add the -api QuickTimeUTC option to you command, then the video time stamps will be adjusted to the local time of the computer. You could then rename using any -d (dateFormat) option example you want.

The only problem would be files taken outside the CET/CEST(?) time zones.
* 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).

Rowan1002

Hi StarGeek,

Ok I'm with you so I can use -api QuickTimeUTC to resolve the times, question though, I saw the below as a solution on another post:

exiftool -tagsfromfile %d%f.JPG

Would this work?

Thanks, R

StarGeek

If you add the -api QuickTimeUTC option, you wouldn't need to use -TagsFromFile as long as the time zone was the same as in the computer you were processing. You could just use something like this with both
exiftool -d '/path/to/new/directory/%Y/%m/%d' '-directory<CreateDate' /path/to/files/

If the video was in a different time zone, then yes, you could use the -TagsFromFile option, but you would probably have to use the -FileOrder option to make sure that the video files were processed before the image files, because if the image files where processed first, then they would not be available when -TagsFromFile tried to access them.
* 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).

Rowan1002

Hi StarGeek,

Ok cool so just so I'm clear, do I run the below ie. merge the two commands that you said?

exiftool -d '/path/to/new/directory/%Y/%m/%d' '-directory<CreateDate' -api QuickTimeUTC  /path/to/files/

Sorry I don't think I understood correctly what that would do. Are you saying that will change the time stamp of just the video's that are linked to a Live Photo JPG to the same date as the JPG?

Thanks, R

StarGeek

As long as you are in the same time zone that the videos were taken, the -api call will adjust the time to the local time, which should match the jpgs.  You don't have to worry about Summer/Winter adjustments, those are taken care of automatically.

I am assuming that the time values are going to match, except for the time zone difference.  They appear to match in your example output.

Anyway, I just noticed that it really shouldn't matter.  You're only sorting into a Year/Month/Day directory, so unless you took one of the shot/video in the 11pm to midnight range, they should sort into the same directory with or without the -api call.

But if you want to double check to be absolutely, run this command first and compare
exiftool -d '/path/to/new/directory/%Y/%m/%d/%F' '-TestName<CreateDate' -api QuickTimeUTC  /path/to/files/
Testname will display what the new file path/names will be without actually changing anything.
* 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).

Rowan1002

Hi StarGeek,

So I ran the command on a set of Live Photos which have split into HEIC or JPG files and the associated Mov Files, but it seems to have errored? Also some of the photos in the folder were taken in UK while other pictures in the folder are from other time zones (From holidays I have been on), so its really a mix, and my laptop / I am currently in the UK...so not sure if it will work based on what you said about being in the same time zone as where the photos were taken...?

See some example errors below:

Rowans-MBP:~ james$ exiftool -d '//Users/james/Pictures/TEST\ INPUT /%Y/%m/%d/%F' '-TestName<CreateDate' -api QuickTimeUTC  /Users/james/Pictures/TEST\ INPUT
'/Users/james/Pictures/TEST INPUT/IMG - 960.HEIC' --> '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14'
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 937.HEIC

Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 954.mov
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 940.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 940.mov
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 968.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 968.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/05/28/2019-05-28' would exist - /Users/james/Pictures/TEST INPUT/IMG - 977.HEIC
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 952.HEIC
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 912.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 912.mov
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 913.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 913.mov
Warning: No writable tags set from /Users/james/Pictures/TEST INPUT/IMG - 945.PNG
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 968.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 948.HEIC
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 911.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 911.mov
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 939.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 939.mov
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 938.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 938.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 964.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 965.HEIC
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 928.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 928.mov
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 914.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 914.mov
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 915.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 915.mov
Warning: No writable tags set from /Users/james/Pictures/TEST INPUT/IMG - 943.PNG
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 949.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 969.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/05/28/2019-05-28' would exist - /Users/james/Pictures/TEST INPUT/IMG - 986.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 928.HEIC
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 917.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 917.mov
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 916.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 916.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 953.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 912.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 958.HEIC
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 965.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 965.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 933.jpg
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 959.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 959.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/05/28/2019-05-28' would exist - /Users/james/Pictures/TEST INPUT/IMG - 974.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 926.jpg
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 932.jpg
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 958.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 958.mov
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 964.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 964.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 935.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 910.mp4
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 962.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 915.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 942.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 954.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 924.jpg
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 930.jpg
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 931.jpg
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 925.jpg
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 967.MOV
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 967.MOV
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 919.jpg
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/05/28/2019-05-28' would exist - /Users/james/Pictures/TEST INPUT/IMG - 978.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 939.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/05/28/2019-05-28' would exist - /Users/james/Pictures/TEST INPUT/IMG - 980.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 938.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/05/28/2019-05-28' would exist - /Users/james/Pictures/TEST INPUT/IMG - 979.HEIC
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 921.jpg
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 963.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 963.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 908.JPG
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /Users/james/Pictures/TEST INPUT/IMG - 962.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 962.mov
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG - 920.jpg
Warning: File '//Users/james/Pictures/TEST/ INPUT /2019/07/14/2019-07-14' would exist - /Users/james/Pictures/TEST INPUT/IMG -
    1 directories scanned
    0 image files updated
  120 image files unchanged

StarGeek

Quote from: Rowan1002 on May 27, 2020, 11:04:47 AM
So I ran the command on a set of Live Photos which have split into HEIC or JPG files and the associated Mov Files, but it seems to have errored?

The command is trying to rename all the files with a single name, 2019-07-14.  The problem is the %F.  Remember, when you use any of the filename tokens (%f, %c, %e, %d) inside a -d (dateFormat) formatting string, they need to be doubled.  Or you can remove them from the date format string and put them in the main copy section. 

Additionally, I think you have too many slashes in the date format string.  You don't need to escape a space when it is enclosed by quotes.  I'm not sure about the double slash at the beginning as well.  And a space at the end of TEST INPUT might be a problem

So either
-d '/Users/james/Pictures/TEST INPUT/%Y/%m/%d/%%F' '-TestName<CreateDate'
or
-d '/Users/james/Pictures/TEST INPUT/%Y/%m/%d/' '-TestName<$CreateDate%F'

QuoteAlso some of the photos in the folder were taken in UK while other pictures in the folder are from other time zones (From holidays I have been on), so its really a mix, and my laptop / I am currently in the UK...so not sure if it will work based on what you said about being in the same time zone as where the photos were taken...?

Yes, for files that are not in the same time zone as the computer, the -api QuickTimeUTC will return the incorrect time.  Though you don't have to worry if the difference is only Summer/Standard time, the computer treats that as the same time zone.  Your best bet is to try and separate and process them by themselves using either the GlobalTimeShift option or the TagsFromFile option as I mentioned above


* 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).

Rowan1002

Ok cool, running the below which is the tags from file with your suggestion to add in fileorder

exiftool -fileorder -tagsfromfile %d%f.HEIC

After I do this for HEIC do I then run the exact same for JPG straight after?

Updated: It just finished the HEIC command above and I think it's just read files, but not done anything:

    1 directories scanned
10252 image files read
    1 files could not be read

StarGeek

Sorry I didn't give an example for the -FileOrder option.  That option needs a tag name to sort on. Additionally, the sort needs to be reversed so that HEIC/Jpg files are processed after the mov files, which is done by adding a dash before the tag name.
exiftool -fileorder -filename -tagsfromfile %d%f.HEIC <OtherCommandsHere> /path/to/files/

Replace the <OtherCommandsHere> with your actual rename commands.

* 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).

Rowan1002

Ok great, about to run that command, just before I do...

To check - that command will sort out the HEIC files, and then do I run the identical command (replacing the .HEIC with .JPG) after this command has completed to pick up the JPG's ?

StarGeek

That would be best.  While it's possible to combine the two, it makes it more complex.  Better to keep it simple.

Make sure and test with TestName first.
* 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).

Rowan1002

Ok, so I ran the below:

exiftool -fileorder -filename -tagsfromfile %d%f.HEIC -d '%Y%m%d-%H%M%S%%-03.c.%%e' /Users/james/Pictures/2019\ Revised

Result: 

- The files names have not changed.
- There is now a duplicate HEIC and MOV for each file in the folder.
- The weirdest thing is that all of the MOV files are rotated upside down?

Result Extract:

1 directories scanned
7696 image files updated
2508 image files unchanged

Extract Example:

Rowans-MBP:~ james$ exiftool -a -G1 -s -time:all /Users/james/Pictures/2019\ Originals/IMG\ -\ 6959.HEIC /Users/james/Pictures/2019\ Originals/IMG\ -\ 6959.mov
======== /Users/james/Pictures/2019 Originals/IMG - 6959.HEIC
[System]        FileModifyDate                  : 2020:01:18 15:52:42+00:00
[System]        FileAccessDate                  : 2020:05:27 21:50:55+01:00
[System]        FileInodeChangeDate             : 2020:05:27 17:48:17+01:00
[IFD0]          ModifyDate                      : 2019:07:01 09:13:16
[ExifIFD]       DateTimeOriginal                : 2019:07:01 09:13:16
[ExifIFD]       CreateDate                      : 2019:07:01 09:13:16
[ExifIFD]       SubSecTimeOriginal              : 266
[ExifIFD]       SubSecTimeDigitized             : 266
[GPS]           GPSTimeStamp                    : 08:13:09.94
[GPS]           GPSDateStamp                    : 2019:07:01
[ICC-header]    ProfileDateTime                 : 2017:07:07 13:22:32
[ICC-header2]   ProfileDateTime                 : 2017:07:07 13:22:32
[Composite]     SubSecCreateDate                : 2019:07:01 09:13:16.266
[Composite]     SubSecDateTimeOriginal          : 2019:07:01 09:13:16.266
[Composite]     GPSDateTime                     : 2019:07:01 08:13:09.94Z
======== /Users/james/Pictures/2019 Originals/IMG - 6959.mov
[System]        FileModifyDate                  : 2020:01:18 15:52:42+00:00
[System]        FileAccessDate                  : 2020:01:18 15:52:42+00:00
[System]        FileInodeChangeDate             : 2020:05:27 17:48:17+01:00
[QuickTime]     CreateDate                      : 2019:07:01 08:13:15
[QuickTime]     ModifyDate                      : 2019:07:01 08:13:17
[Track1]        TrackCreateDate                 : 2019:07:01 08:13:15
[Track1]        TrackModifyDate                 : 2019:07:01 08:13:17
[Track1]        MediaCreateDate                 : 2019:07:01 08:13:15
[Track1]        MediaModifyDate                 : 2019:07:01 08:13:17
[Track2]        TrackCreateDate                 : 2019:07:01 08:13:15
[Track2]        TrackModifyDate                 : 2019:07:01 08:13:17
[Track2]        MediaCreateDate                 : 2019:07:01 08:13:15
[Track2]        MediaModifyDate                 : 2019:07:01 08:13:17
[Track3]        TrackCreateDate                 : 2019:07:01 08:13:15
[Track3]        TrackModifyDate                 : 2019:07:01 08:13:17
[Track3]        MediaCreateDate                 : 2019:07:01 08:13:15
[Track3]        MediaModifyDate                 : 2019:07:01 08:13:17
[Track4]        TrackCreateDate                 : 2019:07:01 08:13:15
[Track4]        TrackModifyDate                 : 2019:07:01 08:13:17
[Track4]        MediaCreateDate                 : 2019:07:01 08:13:15
[Track4]        MediaModifyDate                 : 2019:07:01 08:13:17
[Keys]          CreationDate                    : 2019:07:01 09:13:15+01:00
    2 image files read
Rowans-MBP:~ james$ exiftool -a -G1 -s -time:all /Users/james/Pictures/2019\ Revised/IMG\ -\ 6959.HEIC /Users/james/Pictures/2019\ Revised/IMG\ -\ 6959.HEIC_original /Users/james/Pictures/2019\ Revised/IMG\ -\ 6959.mov /Users/james/Pictures/2019\ Revised/IMG\ -\ 6959.mov_original
======== /Users/james/Pictures/2019 Revised/IMG - 6959.HEIC
[System]        FileModifyDate                  : 2020:05:27 20:03:27+01:00
[System]        FileAccessDate                  : 2020:05:27 21:51:19+01:00
[System]        FileInodeChangeDate             : 2020:05:27 20:03:27+01:00
[IFD0]          ModifyDate                      : 2019:07:01 09:13:16
[ExifIFD]       DateTimeOriginal                : 2019:07:01 09:13:16
[ExifIFD]       CreateDate                      : 2019:07:01 09:13:16
[GPS]           GPSTimeStamp                    : 08:13:09.94
[GPS]           GPSDateStamp                    : 2019:07:01
[XMP-exif]      DateTimeOriginal                : 2019:07:01 09:13:16
[XMP-exif]      GPSDateTime                     : 2019:07:01 08:13:09
[XMP-xmp]       CreateDate                      : 2019:07:01 09:13:16
[XMP-xmp]       ModifyDate                      : 2019:07:01 09:13:16
[ICC-header]    ProfileDateTime                 : 2017:07:07 13:22:32
[ICC-header2]   ProfileDateTime                 : 2017:07:07 13:22:32
[Composite]     GPSDateTime                     : 2019:07:01 08:13:09.94Z
======== /Users/james/Pictures/2019 Revised/IMG - 6959.HEIC_original
[System]        FileModifyDate                  : 2020:01:18 15:52:42+00:00
[System]        FileAccessDate                  : 2020:05:27 21:51:30+01:00
[System]        FileInodeChangeDate             : 2020:05:27 20:03:27+01:00
[IFD0]          ModifyDate                      : 2019:07:01 09:13:16
[ExifIFD]       DateTimeOriginal                : 2019:07:01 09:13:16
[ExifIFD]       CreateDate                      : 2019:07:01 09:13:16
[ExifIFD]       SubSecTimeOriginal              : 266
[ExifIFD]       SubSecTimeDigitized             : 266
[GPS]           GPSTimeStamp                    : 08:13:09.94
[GPS]           GPSDateStamp                    : 2019:07:01
[ICC-header]    ProfileDateTime                 : 2017:07:07 13:22:32
[ICC-header2]   ProfileDateTime                 : 2017:07:07 13:22:32
[Composite]     SubSecCreateDate                : 2019:07:01 09:13:16.266
[Composite]     SubSecDateTimeOriginal          : 2019:07:01 09:13:16.266
[Composite]     GPSDateTime                     : 2019:07:01 08:13:09.94Z
======== /Users/james/Pictures/2019 Revised/IMG - 6959.mov
[System]        FileModifyDate                  : 2020:05:27 20:03:26+01:00
[System]        FileAccessDate                  : 2020:05:27 21:51:19+01:00
[System]        FileInodeChangeDate             : 2020:05:27 20:03:26+01:00
[QuickTime]     CreateDate                      : 2019:07:01 09:13:16
[QuickTime]     ModifyDate                      : 2019:07:01 09:13:16
[Track1]        TrackCreateDate                 : 2019:07:01 08:13:15
[Track1]        TrackModifyDate                 : 2019:07:01 08:13:17
[Track1]        MediaCreateDate                 : 2019:07:01 08:13:15
[Track1]        MediaModifyDate                 : 2019:07:01 08:13:17
[Track2]        TrackCreateDate                 : 2019:07:01 08:13:15
[Track2]        TrackModifyDate                 : 2019:07:01 08:13:17
[Track2]        MediaCreateDate                 : 2019:07:01 08:13:15
[Track2]        MediaModifyDate                 : 2019:07:01 08:13:17
[Track3]        TrackCreateDate                 : 2019:07:01 08:13:15
[Track3]        TrackModifyDate                 : 2019:07:01 08:13:17
[Track3]        MediaCreateDate                 : 2019:07:01 08:13:15
[Track3]        MediaModifyDate                 : 2019:07:01 08:13:17
[Track4]        TrackCreateDate                 : 2019:07:01 08:13:15
[Track4]        TrackModifyDate                 : 2019:07:01 08:13:17
[Track4]        MediaCreateDate                 : 2019:07:01 08:13:15
[Track4]        MediaModifyDate                 : 2019:07:01 08:13:17
[Keys]          CreationDate                    : 2019:07:01 09:13:15+01:00
[XMP-exif]      DateTimeOriginal                : 2019:07:01 09:13:16
[XMP-exif]      GPSDateTime                     : 2019:07:01 08:13:09
[XMP-xmp]       CreateDate                      : 2019:07:01 09:13:16
[XMP-xmp]       ModifyDate                      : 2019:07:01 09:13:16
[UserData]      DateTimeOriginal                : 2019:07:01 09:13:16
======== /Users/james/Pictures/2019 Revised/IMG - 6959.mov_original
[System]        FileModifyDate                  : 2020:01:18 15:52:42+00:00
[System]        FileAccessDate                  : 2020:05:27 21:51:18+01:00
[System]        FileInodeChangeDate             : 2020:05:27 20:03:26+01:00
[QuickTime]     CreateDate                      : 2019:07:01 08:13:15
[QuickTime]     ModifyDate                      : 2019:07:01 08:13:17
[Track1]        TrackCreateDate                 : 2019:07:01 08:13:15
[Track1]        TrackModifyDate                 : 2019:07:01 08:13:17
[Track1]        MediaCreateDate                 : 2019:07:01 08:13:15
[Track1]        MediaModifyDate                 : 2019:07:01 08:13:17
[Track2]        TrackCreateDate                 : 2019:07:01 08:13:15
[Track2]        TrackModifyDate                 : 2019:07:01 08:13:17
[Track2]        MediaCreateDate                 : 2019:07:01 08:13:15
[Track2]        MediaModifyDate                 : 2019:07:01 08:13:17
[Track3]        TrackCreateDate                 : 2019:07:01 08:13:15
[Track3]        TrackModifyDate                 : 2019:07:01 08:13:17
[Track3]        MediaCreateDate                 : 2019:07:01 08:13:15
[Track3]        MediaModifyDate                 : 2019:07:01 08:13:17
[Track4]        TrackCreateDate                 : 2019:07:01 08:13:15
[Track4]        TrackModifyDate                 : 2019:07:01 08:13:17
[Track4]        MediaCreateDate                 : 2019:07:01 08:13:15
[Track4]        MediaModifyDate                 : 2019:07:01 08:13:17
[Keys]          CreationDate                    : 2019:07:01 09:13:15+01:00
    4 image files read

StarGeek

Quote from: Rowan1002 on May 27, 2020, 05:04:32 PM
Ok, so I ran the below:

exiftool -fileorder -filename -tagsfromfile %d%f.HEIC -d '%Y%m%d-%H%M%S%%-03.c.%%e' /Users/james/Pictures/2019\ Revised

Uh, all you did here was copy ALL data from the HEIC files to the any file with a matching name.  Weren't you trying to rename files? You dropped the renaming part listed earlier.

Run
exiftool -restore_original /Users/james/Pictures/2019\ Revised
to restore from the _original files, which I believe are the duplicate files you mention.
* 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).

Rowan1002

#20
Oh man!

Ok I'm with you, will run the following command:

exiftool -fileorder -filename -tagsfromfile %d%f.HEIC -overwrite_original -d '%Y%m%d-%H%M%S%%-03.c.%%e' '-filename<CreateDate' DIR

Update:

Ran on 2 files, a HEIC files and associated MOV file (a live photos which have different date stamp due to time zone)

Seems to have worked, the HEIC and MOV are now dated and named the same. Will now run a similar command to pick up any JPG files with the same issues.

Rowan1002

#21
Ok so it looks to have worked, but just double checking at the moment. The steps I had to run are below.

StarGeek - what I have done seems a bit long winded, but maybe it's correct? Do you think I have carried out the right steps? I need to do this for like 50,000+ photos in different folders so if there's a way to make it simpler or merge commands (without it getting too complicated) that would be great - if not, I can go with these steps..

Step 1 (replace date in MOV file to that of the HEIC file with the same name, and then rename the files to the createdate stamp).

exiftool -fileorder -filename -tagsfromfile %d%f.HEIC -overwrite_original -d '%Y%m%d-%H%M%S%%-03.c.%%e' '-filename<CreateDate' DIR

Step 2 (replace date in MOV file to that of the JPG file with the same name, and then rename the files to the createdate stamp).

exiftool -fileorder -filename -tagsfromfile %d%f.JPG -overwrite_original -d '%Y%m%d-%H%M%S%%-03.c.%%e' '-filename<CreateDate' DIR

Step 3 - PNG Files (give them a Create Date)

PGN files have a datecreated tag and not a createdate tag. So before we can rename the files with a create date, we need to give the PGN file a create date using the below:

exiftool -if '$filetype eq "PNG"' '-createdate<datecreated' DIR

Should have added -overwrite_original, as when I ran this I got loads of duplicates.

Step 4 - Give JPG's with no MOV associated (ie. a JPG that was not a Live Photo) a create date if they do not have one, so that when we rename to Create Date, they get renamed too.

There are some JPG's that do not have a associated Mov and have no create date - they look like images received on WhatsApp. Therefore we need to use the tag in the file 'filemodifydate' to create a 'createdate' with the below which will then work for the name change.

exiftool -if 'not $createdate' '-createdate<filemodifydate' -P

Should have added -overwrite_original, as when I ran this I got loads of duplicates.

Step 5 - Rename for rest of files (HEIC and MOV already renamed by Step 1)

Really only want the below rename to pick up JPG'S and PNG's as we have already renamed the HEIC and MOV files...but ran on the whole directory.

exiftool -d '%Y%m%d-%H%M%S%%-03.c.%%e' '-filename<CreateDate' DIR

Note - one final note is, when you extract Photos (Unmodified Originals) from Mac Photos app, it seems that photos taken on Iphone in Portrait mode get extracted with an associated AAE Sidecar file - not sure what it does / it's purpose but just for reference. I have just deleted those and it seems like it doesn't affect the main picture file in any way

Rowan1002

#22
Hi,

Argh - I'm stuck again!

So Step 5 actually messes up what step 1 and 2 did.

Step 1 and Step 2 made all the HEIC (or JPG) and MOV files from a Live Photo get the same create data as eachother, and the file name of both became the same, which is the create date. Which was exactly as I wanted.

However, Step 5 messes it up and then they separate out again...and the HEIC and MOV are named based on their timezone again!

But I do need Step 5 because after the previous Step 1 and Step 2 sort the HEIC and Mov files out, Step 3 and 4 sort out the PGN and JPG files which are not related to Live Photos.

After Step 3 and Step 4, they then need renaming to their new CreateDate's....

Thanks, R

Rowan1002


StarGeek

Sorry, but I can't really comment on your problem except what I mentioned about the -api QuickTimeUTC option.  I believe that HEIC files store the date as UTC, but exiftool will extract the time as if the -api QuickTimeUTC was used.  MOV files will extract as UTC unless that option is used.
* 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).