ExifTool Forum

General => Metadata => Topic started by: Peter S. on June 14, 2025, 02:24:39 AM

Title: Correcting the Date & Time tags for movie files to suit Apple Photos App
Post by: Peter S. on June 14, 2025, 02:24:39 AM
The Apple Photos App (MacOS/iOS/iPadOS) uses different Date & Time meta tag(s) for determining the local time of movies, e.g. MOV or MP4 files, compared to the tag(s) it uses when processing still images, e.g. JPG, JEPG, or HEIC files.

Of course the Date & Time tags added to a movie created on an Apple device are set to suit the Apple Photos App. Here is an example of Date & Time meta data in a movie from an Apple iPhone 15:

% exiftool -g -s -a --file:all -time:all -ver IMG_2176.MOV

13.27
---- QuickTime ----
CreateDate                      : 2025:06:14 05:24:39
ModifyDate                      : 2025:06:14 05:24:44
TrackCreateDate                 : 2025:06:14 05:24:39
TrackModifyDate                 : 2025:06:14 05:24:44
MediaCreateDate                 : 2025:06:14 05:24:39
MediaModifyDate                 : 2025:06:14 05:24:44
TrackCreateDate                 : 2025:06:14 05:24:39
TrackModifyDate                 : 2025:06:14 05:24:44
MediaCreateDate                 : 2025:06:14 05:24:39
MediaModifyDate                 : 2025:06:14 05:24:44
CreationDate                    : 2025:06:14 15:24:39+10:00
The QuickTime:CreationDate tag is the local time when the video was created. It is the tag that must be right for the Photos App. In the above case the local time was 15:24:39, or about 3:30pm. The "+10:00" means the local time is 10 hours ahead of UTC, i.e. East coast of Australia. All the other Date & Time tags are in the QuickTime group and are UTC times, which is as they should be according to the Quick Time standard.

Now imagine you have a movie file from some camera that puts the local time in all the above Date & Time tags and doesn't include any timezone offset. And maybe doesn't even include the QuickTime:CreationDate tag. In addition imagine that the local time recorded in the tags is NOT the same as the local time on your computer, i.e. you took the movie in one timezone and then are processing it on a computer in a different timezone. The question is how to use exiftool to correct the Date & Time tags so that the the movie file is ordered correctly by the Photos App.

For this example imagine that the movie was taken in New York when daylight savings did not apply, i.e. winter. The local time in New York is 5 hours behind UTC. Here is a command that will work on your MacOS computer:

TZ=America/New_York exiftool -QuickTime:CreateDate+=5 -QuickTime:ModifyDate+=5 '-Track*Date+=5' '-Media*Date+=5' -execute -if '$OK' -api QuickTimeUTC '-QuickTime:CreationDate<$CreateDate' -common_args -ext mov .

In this command:

The list of valid TZ values can be found as follows:
% cd /usr/share/zoneinfo
% ls -xFR
+VERSION Africa/ America/ Antarctica/ Arctic/ Asia/ Atlantic/ Australia/
Brazil/ Canada/ CET Chile/ CST6CDT Cuba EET Egypt
Eire EST EST5EDT Etc/ Europe/ Factory GB GB-Eire
GMT GMT-0 GMT+0 GMT0 Greenwich Hongkong HST Iceland
Indian/ Iran iso3166.tab Israel Jamaica Japan Kwajalein leapseconds
Libya MET Mexico/ MST MST7MDT Navajo NZ NZ-CHAT
Pacific/ Poland Portugal posixrules PRC PST8PDT ROC ROK
Singapore Turkey tzdata.zi UCT Universal US/ UTC W-SU
WET zone.tab Zulu

./Africa:
Abidjan Accra Addis_Ababa Algiers Asmara Asmera Bamako Bangui
Banjul Bissau Blantyre Brazzaville Bujumbura Cairo Casablanca Ceuta
Conakry Dakar Dar_es_Salaam Djibouti Douala El_Aaiun Freetown Gaborone
Harare Johannesburg Juba Kampala Khartoum Kigali Kinshasa Lagos
Libreville Lome Luanda Lubumbashi Lusaka Malabo Maputo Maseru
Mbabane Mogadishu Monrovia Nairobi Ndjamena Niamey Nouakchott Ouagadougou
Porto-Novo Sao_Tome Timbuktu Tripoli Tunis Windhoek

./America:
Adak Anchorage Anguilla Antigua Araguaina Argentina/ Aruba Asuncion
Atikokan Atka Bahia Bahia_Banderas Barbados Belem Belize Blanc-Sablon
Boa_Vista Bogota Boise Buenos_Aires Cambridge_Bay Campo_Grande Cancun Caracas
Catamarca Cayenne Cayman Chicago Chihuahua Ciudad_Juarez Coral_Harbour Cordoba
Costa_Rica Coyhaique Creston Cuiaba Curacao Danmarkshavn Dawson Dawson_Creek
Denver Detroit Dominica Edmonton Eirunepe El_Salvador Ensenada Fort_Nelson
Fort_Wayne Fortaleza Glace_Bay Godthab Goose_Bay Grand_Turk Grenada Guadeloupe
Guatemala Guayaquil Guyana Halifax Havana Hermosillo Indiana/ Indianapolis
Inuvik Iqaluit Jamaica Jujuy Juneau Kentucky/ Knox_IN Kralendijk
La_Paz Lima Los_Angeles Louisville Lower_Princes Maceio Managua Manaus
Marigot Martinique Matamoros Mazatlan Mendoza Menominee Merida Metlakatla
Mexico_City Miquelon Moncton Monterrey Montevideo Montreal Montserrat Nassau
New_York Nipigon Nome Noronha North_Dakota/ Nuuk Ojinaga Panama
Pangnirtung Paramaribo Phoenix Port_of_Spain Port-au-Prince Porto_Acre Porto_Velho Puerto_Rico
Punta_Arenas Rainy_River Rankin_Inlet Recife Regina Resolute Rio_Branco Rosario
Santa_Isabel Santarem Santiago Santo_Domingo Sao_Paulo Scoresbysund Shiprock Sitka
St_Barthelemy St_Johns St_Kitts St_Lucia St_Thomas St_Vincent Swift_Current Tegucigalpa
Thule Thunder_Bay Tijuana Toronto Tortola Vancouver Virgin Whitehorse
Winnipeg Yakutat Yellowknife

./America/Argentina:
Buenos_Aires Catamarca ComodRivadavia Cordoba Jujuy La_Rioja Mendoza Rio_Gallegos
Salta San_Juan San_Luis Tucuman Ushuaia

./America/Indiana:
Indianapolis Knox Marengo Petersburg Tell_City Vevay Vincennes Winamac

./America/Kentucky:
Louisville Monticello

./America/North_Dakota:
Beulah Center New_Salem

./Antarctica:
Casey Davis DumontDUrville Macquarie Mawson McMurdo Palmer Rothera
South_Pole Syowa Troll Vostok

./Arctic:
Longyearbyen

./Asia:
Aden Almaty Amman Anadyr Aqtau Aqtobe Ashgabat Ashkhabad
Atyrau Baghdad Bahrain Baku Bangkok Barnaul Beirut Bishkek
Brunei Calcutta Chita Choibalsan Chongqing Chungking Colombo Dacca
Damascus Dhaka Dili Dubai Dushanbe Famagusta Gaza Harbin
Hebron Ho_Chi_Minh Hong_Kong Hovd Irkutsk Istanbul Jakarta Jayapura
Jerusalem Kabul Kamchatka Karachi Kashgar Kathmandu Katmandu Khandyga
Kolkata Krasnoyarsk Kuala_Lumpur Kuching Kuwait Macao Macau Magadan
Makassar Manila Muscat Nicosia Novokuznetsk Novosibirsk Omsk Oral
Phnom_Penh Pontianak Pyongyang Qatar Qostanay Qyzylorda Rangoon Riyadh
Saigon Sakhalin Samarkand Seoul Shanghai Singapore Srednekolymsk Taipei
Tashkent Tbilisi Tehran Tel_Aviv Thimbu Thimphu Tokyo Tomsk
Ujung_Pandang Ulaanbaatar Ulan_Bator Urumqi Ust-Nera Vientiane Vladivostok Yakutsk
Yangon Yekaterinburg Yerevan

./Atlantic:
Azores Bermuda Canary Cape_Verde Faeroe Faroe Jan_Mayen Madeira
Reykjavik South_Georgia St_Helena Stanley

./Australia:
ACT Adelaide Brisbane Broken_Hill Canberra Currie Darwin Eucla
Hobart LHI Lindeman Lord_Howe Melbourne North NSW Perth
Queensland South Sydney Tasmania Victoria West Yancowinna

./Brazil:
Acre DeNoronha East West

./Canada:
Atlantic Central Eastern Mountain Newfoundland Pacific Saskatchewan Yukon

./Chile:
Continental EasterIsland

./Etc:
GMT GMT-0 GMT-1 GMT-10 GMT-11 GMT-12 GMT-13 GMT-14
GMT-2 GMT-3 GMT-4 GMT-5 GMT-6 GMT-7 GMT-8 GMT-9
GMT+0 GMT+1 GMT+10 GMT+11 GMT+12 GMT+2 GMT+3 GMT+4
GMT+5 GMT+6 GMT+7 GMT+8 GMT+9 GMT0 Greenwich UCT
Universal UTC Zulu

./Europe:
Amsterdam Andorra Astrakhan Athens Belfast Belgrade Berlin Bratislava
Brussels Bucharest Budapest Busingen Chisinau Copenhagen Dublin Gibraltar
Guernsey Helsinki Isle_of_Man Istanbul Jersey Kaliningrad Kiev Kirov
Kyiv Lisbon Ljubljana London Luxembourg Madrid Malta Mariehamn
Minsk Monaco Moscow Nicosia Oslo Paris Podgorica Prague
Riga Rome Samara San_Marino Sarajevo Saratov Simferopol Skopje
Sofia Stockholm Tallinn Tirane Tiraspol Ulyanovsk Uzhgorod Vaduz
Vatican Vienna Vilnius Volgograd Warsaw Zagreb Zaporozhye Zurich

./Indian:
Antananarivo Chagos Christmas Cocos Comoro Kerguelen Mahe Maldives
Mauritius Mayotte Reunion

./Mexico:
BajaNorte BajaSur General

./Pacific:
Apia Auckland Bougainville Chatham Chuuk Easter Efate Enderbury
Fakaofo Fiji Funafuti Galapagos Gambier Guadalcanal Guam Honolulu
Johnston Kanton Kiritimati Kosrae Kwajalein Majuro Marquesas Midway
Nauru Niue Norfolk Noumea Pago_Pago Palau Pitcairn Pohnpei
Ponape Port_Moresby Rarotonga Saipan Samoa Tahiti Tarawa Tongatapu
Truk Wake Wallis Yap

./US:
Alaska Aleutian Arizona Central East-Indiana Eastern Hawaii Indiana-Starke
Michigan Mountain Pacific Samoa
Title: Re: Correcting the Date & Time tags for movie files to suit Apple Photos App
Post by: Phil Harvey on June 15, 2025, 06:19:28 AM
Quote from: Peter S. on June 14, 2025, 02:24:39 AM
  • the "TZ=America/New_York" prefix to the exiftool command sets the TimeZone for the execution of exiftool to something different to the time zone of the computer

I don't have time right now to read your whole post, but I will comment on this.

This command structure only works in a bourne shell as far as I can tell.  Using the ExifTool API TimeZone option would be more portable:

eg. exiftool -api TimeZone=America/New_York ...

but in Windows only numerical time zones are supported.

- Phil