Need some advice on advanced features regarding GPS times and track files

Started by fxstein, October 30, 2021, 06:52:02 PM

Previous topic - Next topic

fxstein

Hi,

First of all thank you for this amazing tool. Have started using it recently and found almost everything I needed in the dock or here on the forums. It takes a lot of time and effort to create the tool, but also to structure questions and answers in a way other can find it easy e.g. via google.

A little background:

I am working with a bunch of GoPro cameras of various models and have captured some 20,000 media files (images and videos) just this year. I am primarily a Mac user and like to leverage that ecosystem to the max. Only then iPhones & iPads are effective tools when on the road. That means that in addition to a discrete files library as well as GoPro cloud I also leverage Apple Photos whenever possible to be able to quickly browse and search across all types of media I am interested in.

Needless to say both GoPros and Apple Photos have their very bad sides. But there are ways to deal with that and it allows me to quickly pull something up on the iPhone 1000 miles away from my computer.

I have used ExifTool to extract and manipulate media files and have recently put the most common things together into a tiny wrapper for ExifTool to share with others.

If needed you can take a look at some of the work or background here: https://github.com/fxstein/GoProExif

Already the tool does 95% of what I needed to accomplish and I am approaching the wilder side of things I'd like to add. In particular I need to deal with missing or incorrect information for some of the files I am processing. For example when a GoPro sits on the shelf for a bit too long with its battery running out, it will loose its date time and e.g. a GoPro Max will start over in the year 2016. Different models ... different defaults.

I'd like to apply a simple model based logic to automatically detect 'impossible' dates (from before the cameras where released) and correct them by applying the GPS timestamp available. I fully realize the issue with timezones and will get to that separately.

1. question: How do I create some lookup structure or nested ifs by model and cutoff date? So for example GoPro_Max 20190101 and if the CreateDate is before that leverage the GPSDate instead for both the rewritten exif tag as well as the filename?

2. question: I happen to have GPS track files for every day of recordings. As a fallback I'd like to apply GPS coordinates and times from the GPS tracks to images that are missing their GPS information?

Both of which I'd like to perform in the same single run I am already executing as part of the little helper I created.

3. question: Is there a simple way to drop a file with certain exiftool options into any given source directory I am ingesting that exiftool can pickup as it recursively walks the directory tree and applies them to the current set of parameters - but just for that directory and anything under it?

I'd appreciate any architectural and coding advice you can point me to.

If needed I can break them out as separate threads.

Kindest regards,

Oliver

If you want to help fix GoPro and related EXIF metadata please check out: https://github.com/fxstein/GoProX

StarGeek

Quote from: fxstein on October 30, 2021, 06:52:02 PM
1. question: How do I create some lookup structure or nested ifs by model and cutoff date? So for example GoPro_Max 20190101 and if the CreateDate is before that leverage the GPSDate instead for both the rewritten exif tag as well as the filename?

At the simplest level, you would use the -if option and use parentheses, AND, and OR to string things together.  For example
exiftool -if "($Model=~/Camera 1/ and $DateTimeOriginal lt '2016:03:15') or ($Model=~/Camera 2/ and $DateTimeOriginal lt '2019:09:01')" <rest of command>

Quote2. question: I happen to have GPS track files for every day of recordings. As a fallback I'd like to apply GPS coordinates and times from the GPS tracks to images that are missing their GPS information?

You would check to see if there was one of the GPS tags, for example
-if "not $GPSLatitude"
and then use exiftool's geotagging commands.

QuoteBoth of which I'd like to perform in the same single run I am already executing as part of the little helper I created.

They would probably be best run as separate commands.

Quote3. question: Is there a simple way to drop a file with certain exiftool options into any given source directory I am ingesting that exiftool can pickup as it recursively walks the directory tree and applies them to the current set of parameters - but just for that directory and anything under it?

Exiftool can't monitor a directory.  You would have to script/automate something.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

fxstein

@StarGeek,

Thank you very much for your quick answer!

Quote from: StarGeek on October 30, 2021, 08:40:56 PM
They would probably be best run as separate commands.

I was afraid you would say that. Got it thanks!

Quote from: StarGeek on October 30, 2021, 08:40:56 PM
Quote3. question: Is there a simple way to drop a file with certain exiftool options into any given source directory I am ingesting that exiftool can pickup as it recursively walks the directory tree and applies them to the current set of parameters - but just for that directory and anything under it?

Exiftool can't monitor a directory.  You would have to script/automate something.

Let me clarify:

Not asking to monitor a directory.

Let's say I have a directory with 40 media files in it. I'd like to add a file like exiftool.options and put in certain commands or settings and have exiftool pick it up when it gets to that directory for processing. I'd like to have that file stay there forever and whenever I need to run over that directory it would get picked up.
That would allow me to put certain options/fixes into subdirectories that I know have an issue and apply the logic only to that directory even though I might be running against the parent directory which contains another 1000 directories that are all being processed with a single -r run. Hope that makes more sense.
If you want to help fix GoPro and related EXIF metadata please check out: https://github.com/fxstein/GoProX

StarGeek

You probably want to create an args file.  See  the -@ (Argfile) option.  And you can search these forums for lots of examples.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

fxstein

Yes an argfile per source directory is what I am after. But not the way it is done per documentation today.

Lets say I have the following source directory tree. I'd like to put args files (or anything similar) into a few select directories. Basically just as an override to default behavior.


Root Directory
    - Camera 1 Directory
        - Date 1
        - Date 2
            args file
        - Date 3
        - Date 4
        - Date 5
    - Camera 2 Directory
        - Date 1
        - Date 2
        - Date 5
        - Date 6
        - Date 7
    - Camera 3 Directory
        - Date 10
        - Date 11
        - Date 12
            args file
        - Date 13
        - Date 14
    ...
    - Camera n Directory


Then I want to run exiftool


exiftool -r ... 'Root Directory'


... and have the tool pick up the args files when it gets to images of that particular folder. it would even be ok if I had to specify a default argsfile for the overall run. Unfortunately there does not seem an option to pickup local args files from within the recursive tree structure and keep the scope of that argsfile local to that directory.

I can script around that if I break up the exiftool run into multiple runs and skip directories with argsfile from the default run and then run them one at a time with the individual args files.
If you want to help fix GoPro and related EXIF metadata please check out: https://github.com/fxstein/GoProX

Phil Harvey

Correct.  There is no facility to use a different argfile for each directory that is scanned.  I don't even know how that would work because the arguments need to be parsed before ExifTool can decide which directories to process.

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