Extracting coordinates from group of mp4-files

Started by Vmjs, June 30, 2020, 02:57:34 AM

Previous topic - Next topic

Vmjs

Hi,
Ok the problem I'm having is that I have a numerous folders that contain numerous mp4-files and I want to extract latitude and longitude from each of the mp4-files.
I know that its possible with exiftool or at least using exiftool by perl. So if I'm honest the real problem is that I'm not smart enough to do it myself :)

So what I would like to do is extract the information from one folder at a time. For example folded is named "February 2020" and it contains mp4-files that are named 20200210.mp4, 20200214.mp4, 20200215.mp4... and so on
And as a result I need a text file or csv from each of the mp4-files that has information in columns.
Or one csv-file that has the information from all of the mp4-files in the folder and the columns would be: Filename, latitude, longitude.

I have tried example this in exiftool: exiftool -ee -api -largefilesupport=1 -n -filename -gpslatitude -gpslongitude 20200604 > out.csv
But It doesn't work. It prints the infromation in rows and it does it maybe for one file and then it's out of memory.
I have read from some thread that the out of memory problem could be avoided by using Perl but I barely know how to use exiftool so....

And the reason for all of this is that I want to check that all of my videos has the coordinates, plus when I get the coordinates out of the files a can draw gps lines from them in Qgis and make a shape or geoadatabase out of it.
I belive that this is quite simple for some one who knows how to use exiftool and perl and I would appreciate highly if some one could help me.

Phil Harvey

#1
Try this:

exiftool -ee -api -largefilesupport=1 -n -p "$filename,$gpslatitude,$gpslongitude" -w %d%f.csv -ext mp4 20200604

- Phil

Edit: Added missing space before -w
...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 ($).

Vmjs

That doesn't work. First it gives "Error: File not found - %d%f.csv"
and then it gives these "Warning: [Minor] Tag 'Doc91899:filename' not defined - 20200604/VID_20200604_02.mp4"
and these "Warning: End of processing at large atom (LargeFileSupport not enabled) - 20200604/VID_20200604_32.mp4
Warning: [Minor] Tag 'gpslatitude' not defined - 20200604/VID_20200604_32.mp4
Warning: End of processing at large atom (LargeFileSupport not enabled) - 20200604/VID_20200604_47.mp4
Warning: [Minor] Tag 'gpslatitude' not defined - 20200604/VID_20200604_47.mp4"

and in the end "Out of memory!"

And I tried to do that the exiftool.exe is at folder "videos" and the mp4-files are in dir "videos\20200604"

Phil Harvey

Sorry.  Somehow I missed a space before -w.  I've edited my post to fix this.

The warnings can be ignored, and the out-of-memory problem should be fixed by running the 64-bit version of the alternate Windows exe.

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

Vmjs

No go yet.
When to code is running I can se a csv-file by the video name on the folder and then it does many lines of those minor warnings "Warning: [Minor] Tag 'Doc99997:filename' not defined - 20200604/VID_20200604_111.mp4
Warning: [Minor] Tag 'Doc99998:filename' not defined - 20200604/VID_20200604_111"

And after that the csv-file disappears
And in the end it does these. The largesupportfile should be enabled so I don't understand that warning at least..?
Warning: End of processing at large atom (LargeFileSupport not enabled) - 20200604/VID_20200604_131.mp4
Warning: [Minor] Tag 'gpslatitude' not defined - 20200604/VID_20200604_131.mp4
Warning: End of processing at large atom (LargeFileSupport not enabled) - 20200604/VID_20200604_135.mp4
Warning: [Minor] Tag 'gpslatitude' not defined - 20200604/VID_20200604_135.mp4


But the "Out of memory" doesn't come any more, so something good at least :)

Phil Harvey

Wow. 100k documents.  That's extreme.

And right, Filename is only in the main document, so you should use: -p "$main:filename,$gpslatitude,$gpslongitude"

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

Vmjs

Now it does it to some of the videos but it seems that when the filesize is over 4gt it doesn't work.
Can this be solved?

obetz

Quote from: Vmjs on July 02, 2020, 01:32:45 AM
Now it does it to some of the videos but it seems that when the filesize is over 4gt it doesn't work.

Did you use my 64 bit version Phil mentioned above?

What is the exact error message?

Vmjs

Hi, I forgot to write an update about this. I got it working with the config-file that is in this post: https://exiftool.org/forum/index.php?topic=3916.0
my full command that worked is:
exiftool -config mp4.config -ee -api -largefilesupport=1 -n -p "$main:filename,$gpslatitude,$gpslongitude" -w %d%f.csv -ext mp4 20200604

So HUGE thanks to Phil for the advice!