using exif tool to ONLY copy "Date modified" without +8hours from .mov to .mp4

Started by esdoublelef, December 20, 2022, 09:33:35 PM

Previous topic - Next topic

esdoublelef

Posting here because I think this is beyond my understanding

Overall process - i shoot in .mov and .jpg. i use ffmpeg to compress my jpg and compress+convert my .mov to .mp4 and i change the filename for sorting purposes. I will delete the .mov and keep the .mp4. (family videos not professional)

This is my code:
@echo ON
@For %%A In (*.mov)Do @(
    ffmpeg -i "%%A" -vf unsharp=7:7:0.8:7:7:0.4 -c:v libx265 -crf 23 -tag:v hvc1 -y "2022 12 17 %%~nA.mp4"
)
@echo ON
exiftool -overwrite_Original -TagsFromFile %%.11f.mov -time:all -s --orientation -ext mp4 .
pause


My question - how do I use EXIFTOOL to copy only "Date modified" from the original .mov into my mp4?



This is my issue:

I use a Fujifilm XH1. On windows explorer the "date modified" and the "media created" differs by +8hours.
I believe this is because of the timezone issue.
The correct time for this file is 2022:12:18 10:58:36
but windows explorer (and online photo albums) recognizes it as 18:59 (6.59pm)

explorer details
exif1.jpeg

the correct time "date modified"
exif2.jpeg 


This is the cmd info using exiftool
Quoteexiftool -time:all -a -s -G1 XH1F3944.mov
[System]        FileModifyDate                  : 2022:12:18 10:58:36+08:00
[System]        FileAccessDate                  : 2022:12:21 10:00:28+08:00
[System]        FileCreateDate                  : 2022:12:20 23:51:16+08:00
[QuickTime]     CreateDate                      : 2022:12:18 10:59:00
[QuickTime]     ModifyDate                      : 2022:12:18 10:59:00
[Track1]        TrackCreateDate                 : 2022:12:18 10:59:00
[Track1]        TrackModifyDate                 : 2022:12:18 10:59:00
[Track1]        MediaCreateDate                 : 2022:12:18 10:59:00
[Track1]        MediaModifyDate                 : 2022:12:18 10:59:00
[Track2]        TrackCreateDate                 : 2022:12:18 10:59:00
[Track2]        TrackModifyDate                 : 2022:12:18 10:59:00
[Track2]        MediaCreateDate                 : 2022:12:18 10:59:00
[Track2]        MediaModifyDate                 : 2022:12:18 10:59:00
[IFD0]          ModifyDate                      : 2022:12:18 10:58:31
[ExifIFD]       DateTimeOriginal                : 2022:12:18 10:58:31
[ExifIFD]       CreateDate                      : 2022:12:18 10:58:31


esdoublelef

i think i answered my own question. i run exiftool the first time to keep the original created date, then i run it AFTER to fill in the EXIF data again!

for JPG compression using FFMPEG + EXIFTOOL to amend dates and keep original created date

@ECHO ON

exiftool "-FileModifyDate<DateTimeOriginal" -ext jpg .
exiftool "-FileCreateDate<DateTimeOriginal" -ext jpg .

  FOR %%a in (*.jpg) DO (ffmpeg -i "%%a" -q:v 6 -vf unsharp=5:5:1.0:5:5:0.0 "2022 12 21 %%~na".jpg)

@ECHO ON

exiftool -overwrite_Original -TagsFromFile %%.11f.jpg -all:all -FileModifyDate  --orientation -ext JPG .


PAUSE




for MOV compression+remux to MP4 using FFMPEG + EXIFTOOL to amend dates and keep original created date

@echo ON

exiftool "-FileModifyDate<DateTimeOriginal" -ext mov .

@For %%A In (*.mov)Do @(
    ffmpeg -i "%%A" -vf unsharp=7:7:0.8:7:7:0.4 -c:v libx265 -crf 23 -tag:v hvc1 -y "2022 12 21 %%~nA.mp4")

@echo ON

exiftool -overwrite_Original -TagsFromFile %%.11f.mov -FileModifyDate --orientation -ext mp4 .

pause

Phil Harvey

Just one quick observation.  These 2 commands:

exiftool "-FileModifyDate<DateTimeOriginal" -ext jpg .
exiftool "-FileCreateDate<DateTimeOriginal" -ext jpg .

May be more efficiently executed together:

exiftool "-FileModifyDate<DateTimeOriginal" "-FileCreateDate<DateTimeOriginal" -ext jpg .
- 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 ($).

wywh

With movies I always use '-api QuickTimeUTC=1'.

'QuickTime' movie time stamps are stored as UTC and programs should adjust them to the local time. If you add the '-api QuickTimeUTC=1' option to exiftool, it will convert to/from UTC based upon the current time zone of the computer with DST adjustment.

- Matti

esdoublelef

Hi Matti,

thank you for the suggestion, but as I'm not great with code, where should I add '-api QuickTimeUTC=1' to my suggested code? Thank you!!


Quote from: wywh on December 21, 2022, 10:19:33 AMWith movies I always use '-api QuickTimeUTC=1'.

'QuickTime' movie time stamps are stored as UTC and programs should adjust them to the local time. If you add the '-api QuickTimeUTC=1' option to exiftool, it will convert to/from UTC based upon the current time zone of the computer with DST adjustment.

- Matti

esdoublelef

Thank you Phil!!


Quote from: Phil Harvey on December 21, 2022, 09:34:52 AMJust one quick observation.  These 2 commands:

exiftool "-FileModifyDate<DateTimeOriginal" -ext jpg .
exiftool "-FileCreateDate<DateTimeOriginal" -ext jpg .

May be more efficiently executed together:

exiftool "-FileModifyDate<DateTimeOriginal" "-FileCreateDate<DateTimeOriginal" -ext jpg .
- Phil

wywh

Quote from: esdoublelef on December 21, 2022, 11:42:49 AMwhere should I add '-api QuickTimeUTC=1'

To check movie times converted from UTC to the local computer's time (works for images as well):

exiftool -a -G1 -s -api QuickTimeUTC=1 -Time:All movie.mp4
To set just the main movie 'QuickTime:CreateDate' time tag:

exiftool -m -overwrite_original_in_place -api QuickTimeUTC=1 '-QuickTime:CreateDate=1988:06:01 12:00:00+00' movie.mp4
To set also some other dates (-wm w to not create new UserData or XMP dates):

exiftool -m -overwrite_original_in_place -wm w -api QuickTimeUTC=1 '-AllDates=1988:06:01 12:00:00' movie.mp4
To set movie dates to 'Keys', 'UserData', 'QuickTime', 'FileCreateDate' and 'FileModifyDate' from the YYYY-MMDD-hhmm-ss -like FileName (and not create any extra new date tags. 2020-0101-1200-00.mp4 for example):

exiftool -api QuickTimeUTC=1 '-AllDates<FileName' '-Track*Date<FileName' '-Media*Date<FileName' '-Keys:CreationDate<FileName' -execute '-FileCreateDate<FileName' '-FileModifyDate<FileName' -common_args -m -P -overwrite_original_in_place -wm w .
Or copy all tags from the original .mov to a same name newly encoded .mp4 in the same folder and set file dates (all Track*Date, Media*Date, Keys might not be updated if they do not exist in the source):

exiftool -TagsFromFile '%-.0f.mov' -All:All *.mp4 -execute '-FileCreateDate<QuickTime:CreateDate' '-FileModifyDate<QuickTime:CreateDate' -common_args -m -P -overwrite_original_in_place .
- Matti