"IF" function or Tags priority

Started by ahnernoch, February 16, 2021, 01:57:45 PM

Previous topic - Next topic

ahnernoch

Like the topic already says, I am a newbie. So far I almost got resolved what I want to do.

This code is to be used for video files MP4 and MOV.

I want to read the DateTimeOriginal and write to all date tags. If there is not DateTimeOriginal in the file, it should use instead the Track1:CreateDate

thats the code so far I got, but I cant figure out to give a tag priority or use an if function. Really appriciate if somebody could help me out.

exiftool "-AllDates<datetimeoriginal" "-FileModifyDate<DateTimeOriginal" *.mp4

Phil Harvey

You do it by setting both, and subsequent assignments (if successful) override earlier ones on the command line:

exiftool "-AllDates<track1:createdate" "-FileModifyDate<track1:createdate""-AllDates<datetimeoriginal" "-FileModifyDate<DateTimeOriginal" -ext mp4 .

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

ahnernoch

Thanks Phil. Actually logic solution ;-)

I modiefied it a little bit to my needs.

exiftool "-overwrite_original_in_place" "-AllDates<track1:trackcreatedate" "-FileModifyDate<track1:trackcreatedate" "-FileCreateDate<track1:trackcreatedate" "-AllDates<datetimeoriginal" "-FileModifyDate<DateTimeOriginal" "-FileCreateDate<DateTimeOriginal" "-Quicktime:CreateDate<DateTimeOriginal" *.mp4


Only that gets not corrected are the whole Track1 Track2 etc dates.

Luuk2005

#3
Greetings Ahnernoch.  The -AllDates is 'shortcut' for only 3 Tags like saying at top of http://exiftool.org/TagNames/Shortcuts.html
So -AllDates and -Quicktime:CreateDate never conduct any "Track Dates", so instead needing something like -QuickTime:Time:All.

Edit: If to conduct only "Track Dates", maybe something like -QuickTime:Track*Date
Windows8.1-64bit, exiftool-v12.11(standalone), sed-v4.0.7

Phil Harvey

Quote from: Luuk2005 on February 17, 2021, 10:59:08 AM
Edit: If to conduct only "Track Dates", maybe something like -QuickTime:Track*Date

Unfortunately this won't work.  ExifTool doesn't allow wildcards in group names.

Your other idea works though.

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

Luuk2005

Yes, sorry for the poor explanations.. At first, Im trying -QuickTime:Time:All to present a test-file like...
CreateDate                   : 0000:00:00 00:00:00
ModifyDate                    : 0000:00:00 00:00:00
TrackCreateDate           : 0000:00:00 00:00:00
TrackModifyDate            : 0000:00:00 00:00:00
MediaCreateDate          : 0000:00:00 00:00:00
MediaModifyDate           : 0000:00:00 00:00:00

So then trying to filter for "Track Dates" experimenting with wildcards like Group*Name:Tag, but never conducted properly!
So then I give up with -QuickTime:Track*Date for $TrackCreate/ModifyDate, but not knowing if he has more, because the explanation "Track1 Track2 etc dates"?

Im thinking it can be a great enhancement for wildcards in the GroupNames, but maybe hard inside the programming.
Again, many thanks for such a great tool, and helping the people to learn using it!
Windows8.1-64bit, exiftool-v12.11(standalone), sed-v4.0.7