Author Topic: Extracting coordinates from group of mp4-files  (Read 105 times)

Vmjs

  • Newbie
  • *
  • Posts: 4
Extracting coordinates from group of mp4-files
« on: June 30, 2020, 02:57:34 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16502
    • ExifTool Home Page
Re: Extracting coordinates from group of mp4-files
« Reply #1 on: June 30, 2020, 05:33:09 AM »
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
« Last Edit: June 30, 2020, 09:39:08 AM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Vmjs

  • Newbie
  • *
  • Posts: 4
Re: Extracting coordinates from group of mp4-files
« Reply #2 on: June 30, 2020, 07:50:52 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16502
    • ExifTool Home Page
Re: Extracting coordinates from group of mp4-files
« Reply #3 on: June 30, 2020, 09:38:46 AM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Vmjs

  • Newbie
  • *
  • Posts: 4
Re: Extracting coordinates from group of mp4-files
« Reply #4 on: July 01, 2020, 01:04:03 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16502
    • ExifTool Home Page
Re: Extracting coordinates from group of mp4-files
« Reply #5 on: July 01, 2020, 07:44:44 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Vmjs

  • Newbie
  • *
  • Posts: 4
Re: Extracting coordinates from group of mp4-files
« Reply #6 on: Today at 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.
Can this be solved?