ExifTool Forum

ExifTool => Newbies => Topic started by: metalhead on October 31, 2019, 11:24:04 PM

Title: Is it possible to combine both these commands into one?
Post by: metalhead on October 31, 2019, 11:24:04 PM
I've written two commands that appear to work fine.  Is it possible to combine them into a single command?

Output before changes:
exiftool -G1 -a -s -time:all -api QuickTimeUTC ".\MK.mp4"
[System]        FileModifyDate                  : 2013:05:10 12:17:10+01:00
[System]        FileAccessDate                  : 2019:10:31 14:16:16+00:00
[System]        FileCreateDate                  : 2019:10:31 14:15:20+00:00
[QuickTime]     CreateDate                      : 2013:05:10 21:05:25+01:00
[QuickTime]     ModifyDate                      : 2013:05:10 21:05:25+01:00
[Track1]        TrackCreateDate                 : 2013:05:10 21:05:25+01:00
[Track1]        TrackModifyDate                 : 2013:05:10 21:05:25+01:00
[Track1]        MediaCreateDate                 : 2013:05:10 21:05:25+01:00
[Track1]        MediaModifyDate                 : 2013:05:10 21:05:25+01:00
[Track2]        TrackCreateDate                 : 2013:05:10 21:05:25+01:00
[Track2]        TrackModifyDate                 : 2013:05:10 21:05:25+01:00
[Track2]        MediaCreateDate                 : 2013:05:10 21:05:25+01:00
[Track2]        MediaModifyDate                 : 2013:05:10 21:05:25+01:00


exiftool -CreateDate-=1 -MediaCreateDate-=1 -TrackCreateDate-=1 -FileModifyDate+="0:0:0 8:00:0" -P ".\MK.mp4"
exiftool -api QuickTimeUTC "-QuickTime:ModifyDate<FileModifyDate" "-MediaModifyDate<FileModifyDate" "-TrackModifyDate<FileModifyDate" -P ".\MK.mp4"

Output after changes:
[System]        FileModifyDate                  : 2013:05:10 20:17:10+01:00
[System]        FileAccessDate                  : 2013:05:10 20:17:10+01:00
[System]        FileCreateDate                  : 2019:10:31 14:15:20+00:00
[QuickTime]     CreateDate                      : 2013:05:10 20:05:25+01:00
[QuickTime]     ModifyDate                      : 2013:05:10 20:17:10+01:00
[Track1]        TrackCreateDate                 : 2013:05:10 20:05:25+01:00
[Track1]        TrackModifyDate                 : 2013:05:10 20:17:10+01:00
[Track1]        MediaCreateDate                 : 2013:05:10 20:05:25+01:00
[Track1]        MediaModifyDate                 : 2013:05:10 20:17:10+01:00
[Track2]        TrackCreateDate                 : 2013:05:10 20:05:25+01:00
[Track2]        TrackModifyDate                 : 2013:05:10 20:17:10+01:00
[Track2]        MediaCreateDate                 : 2013:05:10 20:05:25+01:00
[Track2]        MediaModifyDate                 : 2013:05:10 20:17:10+01:00


Title: Re: Is it possible to combine both these commands into one?
Post by: StarGeek on November 01, 2019, 12:52:57 AM
They can be combined with the -execute option (https://exiftool.org/exiftool_pod.html#execute-NUM), but it will still take two passes over the files.

exiftool -CreateDate-=1 -MediaCreateDate-=1 -TrackCreateDate-=1 -FileModifyDate+="0:0:0 8:00:0" -execute -api QuickTimeUTC "-QuickTime:ModifyDate<FileModifyDate" "-MediaModifyDate<FileModifyDate" "-TrackModifyDate<FileModifyDate" -common_args -P ".\MK.mp4"
Title: Re: Is it possible to combine both these commands into one?
Post by: Phil Harvey on November 01, 2019, 07:07:33 AM
I think this can be done in one pass using the -globalTimeShift option:

exiftool -CreateDate-=1 -MediaCreateDate-=1 -TrackCreateDate-=1 -globaltimeshift 8 "-filemodifydate<filemodifydate" -api QuickTimeUTC "-QuickTime:ModifyDate<FileModifyDate" "-MediaModifyDate<FileModifyDate" "-TrackModifyDate<FileModifyDate" ".\MK.mp4"

- Phil
Title: Re: Is it possible to combine both these commands into one?
Post by: StarGeek on November 01, 2019, 11:17:55 AM
Ah, better.  GlobalTimeShift crossed my mind but since there were two different time values being shifted, I didn't give it further thought.
Title: Re: Is it possible to combine both these commands into one?
Post by: metalhead on November 01, 2019, 06:38:42 PM
Thank you.  That works great!