ExifTool Forum

General => Metadata => Topic started by: rab4280 on October 14, 2021, 06:36:02 PM

Title: Extracting GPS Metadata from Parrot Anafi
Post by: rab4280 on October 14, 2021, 06:36:02 PM

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 (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.
Title: Re: Extracting GPS Metadata from Parrot Anafi
Post by: StarGeek on October 14, 2021, 07:05:18 PM
If the resulting file was just kml.fmt repeated over and over, then you either haven't downloaded the kml.fmt file (https://github.com/exiftool/exiftool/tree/master/fmt_files) or you need to provide the full path to the file.
Title: Re: Extracting GPS Metadata from Parrot Anafi
Post by: rab4280 on October 15, 2021, 09:54:11 AM
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
Title: Re: Extracting GPS Metadata from Parrot Anafi
Post by: StarGeek on October 15, 2021, 12:11:10 PM
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.
Title: Re: Extracting GPS Metadata from Parrot Anafi
Post by: rab4280 on October 15, 2021, 12:25:51 PM
It created a kml file, but it is not valid.
Title: Re: Extracting GPS Metadata from Parrot Anafi
Post by: StarGeek on October 15, 2021, 12:37:17 PM
Can you share a short sample file through something like Dropbox/Google Drive?
Title: Re: Extracting GPS Metadata from Parrot Anafi
Post by: rab4280 on October 15, 2021, 03:00:09 PM
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
Title: Re: Extracting GPS Metadata from Parrot Anafi
Post by: StarGeek on October 15, 2021, 04:45:27 PM
Here's (https://pastebin.com/jgVQJ4m1) 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?
Title: Re: Extracting GPS Metadata from Parrot Anafi
Post by: rab4280 on October 15, 2021, 05:21:34 PM
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.
Title: Re: Extracting GPS Metadata from Parrot Anafi
Post by: rab4280 on October 15, 2021, 05:30:52 PM
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!
Title: Re: Extracting GPS Metadata from Parrot Anafi
Post by: StarGeek on October 15, 2021, 06:00:50 PM
Ah, sorry.  To get the correct file you have to click the link and view and save the raw code.
Title: Re: Extracting GPS Metadata from Parrot Anafi
Post by: Kajuna on June 06, 2023, 06:05:55 PM
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
Title: Re: Extracting GPS Metadata from Parrot Anafi
Post by: Phil Harvey on June 06, 2023, 09:25:03 PM
I've noted W,X,Y,Z in the code.

And that is what it says in the parrot documentation (https://web.archive.org/web/20211026235731/https://developer.parrot.com/docs/pdraw/metadata.html).

- Phil