Extracting GPS data from INSV file

Started by SM26, February 13, 2019, 09:41:18 AM

Previous topic - Next topic

martincarlin87

Ah, so it does, I missed that from your original answer - apologies.

Great, makes sense now - thanks again for your help!

Cheers,
Martin

zengcancan

Hi Phil:
Thank you for providing this useful tool! I was trying to extract GPS data from INSV file, and I successfully did it. I use this command to extract it:

exiftool -api largefilesupport -ee -p '${GPSDateTime;DateFmt("%s")} ${gpslatitude#} ${gpslongitude#}' 'VID_20200427_163409_00_044.insv' > gps.txt

the result is something like below:

1587976450 31.2103383080857 121.593486648607
1587976450 31.2103383080857 121.593486648607
1587976450 31.2103383080857 121.593486648607
1587976450 31.2103383080857 121.593486648607
1587976450 31.2103383080857 121.593486648607
1587976450 31.2103383080857 121.593486648607
1587976450 31.2103383080857 121.593486648607
1587976451 31.2103383080857 121.593486648607
1587976451 31.2103383080857 121.593486648607
1587976451 31.2103383080857 121.593486648607
1587976451 31.2103383080857 121.593486648607
1587976451 31.2103383080857 121.593486648607
1587976451 31.2103383080857 121.593486648607
1587976451 31.2103383080857 121.593486648607
1587976451 31.2103383080857 121.593486648607
1587976451 31.2103383080857 121.593486648607
1587976451 31.2103383080857 121.593486648607

I find that the uint of gps timestamp is second, that means the frequency is 1Hz, but actually insta360 provide gps data at about 10Hz, so there is precision lose. And so does to the latitude and longitude precision, the other format of latitude data is 31 deg 12' 35.56" N, this means the accuracy is 0.01", but I gauss that insta360 provide more accurate data, so the output has many duplicated data. Can you fix this or can you give some advice on how I can fix it myself?

Phil Harvey

It will take me a while before I can answer this question.  I need to dig up my INSV sample and do some analysis, but the weather has been nice recently so I've been spending time outside instead of on the computer.

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

zengcancan

Thank you for your reply, Phil! And I can provide you my insv file if you need. Have a good vacation!

Phil Harvey

Sure.  A sample would be helpful.  My email is philharvey66 at gmail.com

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

Phil Harvey

I got the sample, thanks.

Wow, I really need a bigger disk.  This video sample is > 2 GB.  :(

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

zengcancan

Sorry to send you a so big sample, I was going to record a smaller one, but I think that maybe from a bigger video you can see the trajectory and the accuracy problem will be more obvious.

zengcancan


Phil Harvey

Thanks for the reminder.

Maybe I'm missing something, but I don't see any GPS in the file you sent (VID_20200909_144502_00_002.insv).  ie) this command produces no output (only a warning "Truncated '\x00\x00\x00\x00' data"):

exiftool -ee -api largefilesupport "-gps*" FILE

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

zengcancan

Hi Phil, I use the same command exiftool -ee -api largefilesupport "-gps*" FILE to extract GPS data and I succeed. I will email you the output.

How big is the insv file you received, I suspect that the file is incomplete. The file is 2,297,323,736 bytes on my desktop with ubuntu16.04.

Phil Harvey

That new file worked.  I can see what you are talking about.  The GPS is stored at 10 Hz, but the GPS position is only updated every 6-7 seconds, which results in sets of 60-70 identical GPS records in the file.  I've looked at the GPS data in detail (Insta360 record 0x700), and there is no more information to be extracted from this -- the records are truly identical.  It looks like the camera is only updating the GPS position every 6-7 seconds even though it stores the information at 10x per second.

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

zengcancan

Thank you for your help! How confusing they do this, but may be there is something wrong with my camera, I don't know.

zengcancan

Hi Phil,  the insta360 One X support record GPS from mobile phone, or from a remote controller. The file I send you last time is recoreded by mobile phone, and yesterday I bought a remote controller, I find that the data is changing in one second, so you may still promote the time accuracy and gps accuracy(to 0.001'').

Phil Harvey

Quote from: zengcancan on December 08, 2020, 08:33:32 PM
you may still promote the time accuracy and gps accuracy(to 0.001'').

I don't understand.  Is there something you want me to do?

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

Phil_K

Hello.

First of all, I would like to express my thanks to Phil Harvey for this great tool. It has helped me many times. :) Especially in terms of extracting insta360 data.

Because of that, maybe I can add some additional information...

Quote from: zengcancan on December 08, 2020, 08:33:32 PM
Hi Phil,  the insta360 One X support record GPS from mobile phone, or from a remote controller. The file I send you last time is recoreded by mobile phone, and yesterday I bought a remote controller, I find that the data is changing in one second, so you may still promote the time accuracy and gps accuracy(to 0.001'').

The data quality in the insv file of an OneX/R/X2 depends on the GPS signal quality provided by phone / GPS smart remote / Apple or Garmin watch. All three cameras can add GPS data at 10Hz which includes to have 10 different GPS coords per second. But that strongly depends on the device used to get the data and its GPS lock / signal quality. I've done some tests with different devices => https://www.facebook.com/groups/Insta360OneCommunity/permalink/3246276772128895/

Unfortunately for most mobile devices you have to live with having doubled data points in the 10/s.
The best way to deal with it is to use additional tools to to even out the data / to optimize the data to an average...
Like GPSbabel (https://software.frankingermann.de/gpxtrackmap/gtm-documentation/9-joomla-plugins/gpxtrackmap/22-gtm-filtering-gpx-tracks-with-gpsbabel) ...
That's nothing I would see ExifTool in charge.

Coming to "gps accuracy", GPX does not provide a tag for that kind of "accuracy".
There is an element for "extensions" where you could place some own format.
(http://www.topografix.com/GPX/1/1/#type_extensionsType)

There are tags for "Dilution Of Precision" ( https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)  )  for every data point => http://www.topografix.com/GPX/1/1/#type_wptType
but that's not what you have in mind. Those only specify how reliable the data is. So the usage would be, the greater the number of doubles in the 10 data points /s, the greater the DUP value would be.

Quote from: Kajuna on July 30, 2020, 01:55:12 PM
The only tag that I can imagine having that sort of data would be

[Main]          Parameters                      : 1 2576.934 2014.997 1506.038 0.291 -0.115 89.496 4056 3040 1058

Are those parameters known?

Those are a kind of helper data for the stitcher, calibration / lens related data.

Quote from: Kajuna on July 30, 2020, 04:12:20 AM
- The accel data is "timecode" based. The timecode is in seconds but it does not start at zero. I have tried assuming the first samples correspond to the first frame, but there seems to be a slight offset (the data seems a bit delayed, so maybe some data samples before the first video frame are retained). Does anyone know what that timecode is relative to? The video track timecode does start at zero, and I cannot find any tag that resembles that value, to use as a base offset

That time code, as well as the timecode for exposure data, is uptime based.
You wont find an anchor point in the video data to hook up. You have to assume that the first appearance of an accelerator time code is at / near the starting point of the video. Guess you already connected the video tracks time code zero with the first accelerator time code.

Unfortunately due to the way the data is acquired and saved you will face a delay.

Phil.