Extracting GPS Metadata from Parrot Anafi

Started by rab4280, October 14, 2021, 06:36:02 PM

Previous topic - Next topic

rab4280


I want to extract latitude and longitude metadata from every frame in drone video captured with a Parrot Anafi [https://exiftool.org/TagNames/Parrot.html]. I have been successful in getting this and dumping it to a text file with exiftool:

exiftool -ee3 Misc_1.MP4 > out.txt

There are thousands of lines describing the metadata for every frame:
Flying State                    : Flying
Animation                       : 0
Piloting Mode                   : Flight Plan
Time Stamp                      : 378.93484
GPS Framing Latitude            : 500
GPS Framing Longitude           : 500
GPS Framing Altitude            : 500
GPS Dest Latitude               : 500
GPS Dest Longitude              : 500
GPS Dest Altitude               : 500
Automation Animation            : None
Automation Flags                : (none)
Sample Time                     : 0.08 s
Sample Duration                 : 0.04 s
Elevation                       : 24.343 m
GPS Latitude                    : 29 deg 52' 1.54" N
GPS Longitude                   : 93 deg 56' 12.92" W
GPS Altitude                    : 21.680 m
GPS Satellites                  : 15
GPS Velocity North              : -1.21875
GPS Velocity East               : 4.953125
GPS Velocity Down               : 0.015625
Drone Quaternion                : 0.53997802734375 0.02398681640625 -0.03851318359375 0.84039306640625
Frame Base View                 : 0.540283203125 0 0 0.8414306640625
Frame View                      : 0.5386962890625 0.066162109375 -0.04248046875 0.83880615234375
Exposure Time                   : 1/785
ISO                             : 100
Red Balance                     : 2.277099609375
Blue Balance                    : 1.381103515625
Field Of View                   : 69 39.84375
Link Goodput                    : 10000 kbit/s
Link Quality                    : 4
Wifi RSSI                       : -56 dBm
Battery                         : 74 %
Binning                         : 0

I want to know if I can generate a kml file from this information using exiftools. I tried exiftool -ee -p kml.fmt Misc_1.MP4 > out.kml but it did not generate a valid kml file. I feel like I'm probably missing several steps in between but can't figure it out what's possible.

StarGeek

If the resulting file was just kml.fmt repeated over and over, then you either haven't downloaded the kml.fmt file or you need to provide the full path to the file.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

rab4280

Thanks for the tips. I put the fmt_files in the same folder as the exiftool executable. Now I get multiple warnings about dummy_atribute not defined. Any ideas of what I need to do?

exiftool -ee -p kml.fmt Misc_1.MP4 > out.kml

Warning: [Minor] Tag 'Doc498:opt_dummy_attribute' not defined - Misc_1.MP4
Warning: [Minor] Tag 'Doc498:filename' not defined - Misc_1.MP4
Warning: [Minor] Tag 'Doc499:opt_dummy_attribute' not defined - Misc_1.MP4
Warning: [Minor] Tag 'Doc499:filename' not defined - Misc_1.MP4
Warning: [Minor] Tag 'Doc500:opt_dummy_attribute' not defined - Misc_1.MP4

StarGeek

Check the resulting KML file to see if it's valid.

Those warnings are new ones to me, but they are just that, warnings.  Exiftool should still have created the KML file if it was possible.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

rab4280

It created a kml file, but it is not valid.

StarGeek

Can you share a short sample file through something like Dropbox/Google Drive?
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

rab4280

Here is a short 20 second clip from the Parrot. Let me know if there is any trouble sharing the file.


https://drive.google.com/file/d/1hYBwaXEu85RSncut6bKgO5SNw7fOgz6W/view?usp=sharing

StarGeek

Here's what I get from that file (linked to PasteBin).  Nearly 6,000 lines.  And Google maps accepted it when I uploaded it.

What appears to be wrong with the output you got?
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

rab4280

Yeah, I have no problem getting the metadata to output to a plain text file with.

exiftool -ee Misc_1.MP4 > out.txt

I would like, if possible, to automatically create an kml file from this metadata. I have tried the following. (I added the format files to the same folder as the exiftool executable.)

exiftool -ee -p kml.fmt Misc_1.MP4 > out.kml

If you got the kml output to work, please let me know if the command I'm using is incorrect. Mine gets created but is invalid for Google Earth.

rab4280

Ok, I tracked down my issue. My format files were all messed up. I went to "Save link as..." and downloaded each file but they were all corrupted and filled with bogus stuff that was wrong. I ended up manually copying and pasting the correct text for each format file into a new files and that worked. Thanks for helping, I know it was an silly mistake but knowing it was probably a user error helped me find the problem much faster!

StarGeek

Ah, sorry.  To get the correct file you have to click the link and view and save the raw code.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Kajuna

Hi. Does anyone know how the components of the Drone Quaternion data are sorted? Is it w, x, y, z? Maybe x, y, z, w? I'm not finding a good correlation with what I see in the video. Thanks

Phil Harvey

I've noted W,X,Y,Z in the code.

And that is what it says in the parrot documentation.

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