Condition Testing on -p Flag

Started by Invindicator, November 08, 2018, 06:54:37 AM

Previous topic - Next topic

Invindicator

Hi all,

Is it possible to print a default value where a tag doesnt exist when using the -p flag
For example the subsectimeoriginal tag doesnt exist in mp4 files, so when running my script I would like exiftool to print a 000 in place of the subsectimeoriginal tag

Here is one thing I tried, not sure if on the right track or there is an easier way to do this or not
exiftool -m -p "${subsectimeoriginal;s//0000/}" "vid0000.mp4"

Regards,
Nick

Phil Harvey

Hi Nick,

The advanced formatting expression isn't evaluated for a missing tag.

But you can set a value to be used for all missing tags, something like this:

exiftool -m -f -api missingtagvalue=0000 -p "$subsectimeoriginal" FILE

To quote the -p option documentation:

            If a specified tag does not exist, a minor warning is issued and
            the line with the missing tag is not printed.  However, the -f
            option may be used to set the value of missing tags to '-' (but
            this may be configured via the MissingTagValue API option), or the
            -m option may be used to ignore minor warnings and leave the
            missing values empty.


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

Invindicator

Thanks Phil

Is there any way to insert different default values for different tags however if, say for example, there werre multiple missing tages in the one -p statement

Thanks
Nick

Phil Harvey

Hi Nick,

For this you could go to a user-defined Composite tag which is based on all of the tags you want extracted.  This is a bit more complex but you would have complete control of the output formatting.

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

Invindicator