Getting the GPS track from video file.

Started by MarshMello, December 16, 2021, 04:37:49 AM

Previous topic - Next topic

MarshMello

I bought an iiwey s1 dashcam at the start of this year and recently I thought would it be possible to extract the GPS points into a file. After some searching around I found about this cool tool but it outputs this warning `GPSLatitude/Longitude encryption is not yet known, so these will be wrong` and using other dashcam viewers nothing can output the correct GPS point apart from the recommended software.

Is there anything I can do to help decrypt the GPS points from this [sample video](https://drive.google.com/file/d/1xRpZQ46BybiSRRsAuy9zYD2PIDR6cqti/view?usp=sharing)?

Thank you

Phil Harvey

I've been trying for the last hour to get the GPSPlayer.app to work so I can try to reverse engineer this, but some security update on the Mac has broken this app for me.  What is the "recommended software" you are using?  Is there a Mac version that I can download?

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

MarshMello

GPSPlayer from gpsplayer.net was sadly the recommended software.

I had also tried to reverse engineer the software to just write it all to a text file but the most I managed to change was button text. Just not too fluent in how electron apps work.

Phil Harvey

I'll try downloading the most recent version of GPSPlayer from gpsplayer.net when I get a chance.  Is this the best place to download this software?

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

MarshMello

Yes. After a bit of searching around the source code, it seems both https://dvplayer.net and http://gpsplayer.net are the same application. So assuming they both have the exact same version of the software on each site, any one of the two should be good.

Phil Harvey

I've got the GPSPlayer working again, which is a first step.  Now I need to find a large block of time to be able to work on this.

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

cs98jrb

Hi Phil

I too have a iiway s1 dual dash cam. In the Google Drive folder are the front and rear videos .mp4 and the output of exiftool.exe -ee -V3 FILE

exiftool appears to recognise some GPS info as the output contains:
  + [GPS directory, 16384 bytes]
  |   dd1490: 00 00 40 00 66 72 65 65 47 50 53 20 f0 03 00 00 [..@.freeGPS ....]
  |   dd14a0: 4c 49 47 4f 47 50 53 49 4e 46 4f 00 00 00 00 05 [LIGOGPSINFO.....]
  |   dd14b0: 0a 00 00 00 23 23 23 23 6b 00 00 00 c0 30 20 20 [....####k....0  ]
  |   dd14c0: 20 f0 12 10 12 22 e1 0e 10 12 2f 90 10 13 02 f2 [ ...."..../.....]
  |   dd14d0: 12 18 12 20 bc 1a 11 00 f6 6e 18 11 22 f0 0e 11 [... .....n.."...]
  |     [snip 17176 bytes]
  + [GPS directory, 16384 bytes]
  |   ea1220: 00 00 40 00 66 72 65 65 47 50 53 20 f0 03 00 00 [..@.freeGPS ....]
  |   ea1230: 4c 49 47 4f 47 50 53 49 4e 46 4f 00 00 00 00 05 [LIGOGPSINFO.....]
  |   ea1240: 0a 00 00 00 23 23 23 23 69 00 00 00 c1 30 20 20 [....####i....0  ]
  |   ea1250: 20 f0 12 10 12 22 e1 0e 10 12 2f 90 10 13 02 f2 [ ...."..../.....]
  |   ea1260: 12 18 12 20 bc 1a 11 01 f6 6e 18 11 22 f0 0e 11 [... .....n.."...]
  |     [snip 17800 bytes]


For reference this video was stationary and the location is approximately 52.711, -3.258

Also the GPSPlayer for windows asks for a registration of 9.99 USD to view the GPS data.

Phil Harvey

I think this is a new one for me, although the format does look a bit familiar.  After the initial 40-byte header, there is a size word (0x0000006b in the first GPS directory of your example) that gives the size of the data to follow.  In the files you sent, this size varies from 102 to 109 bytes.  I stared at the data for a while but can't make sense of it.  The data itself looks like it could be compressed somehow.  I have tried to expand it using 3 different techniques without success.  I'm not getting any closer to decoding this.

Also, I tried viewing the files in GPSPlayer, and it didn't seem to extract the GPS from these.

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

cs98jrb

There is a mobile app for android and Apple, Witcam Pro. It can decode the GPS data.
I don't know if that would be of any help.

cs98jrb

I've added some java files extracted from the app to the Google drive folder.
They look like they might be of help. I don't really know what I'm looking at though.  :)

Phil Harvey

It looks like all of the decoding is done in a SunGpsInterface object.  Do you have the code for this?

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

cs98jrb

This appears to be an included compiled c++ resource. libsungps.so. I cant find anything about it by googling.
I've added it to the folder.

cs98jrb

@MarshMello, What setting are you using on the iiway s1? Also is it the product in the image below?
When I run exiftool.exe -ee -V3 FILE
I get almost valid data. The lat Long are wrong but the speed looks right for Kph. I've added the extracted data to the Google Folder as 20211216081802_001314A
also in the Witcam Pro. app my manual said to use I don't get any GPS info displayed for your file.

yuzhongh

Thanks for the discussion. I use the compiled libsungps.so and write a simple android app to decrypt the GPS log. It works!

See my github: https://github.com/YuzhongHuangCS/GPSParser
Sample files: https://github.com/YuzhongHuangCS/GPSParser/tree/main/example
Link to apk: https://github.com/YuzhongHuangCS/GPSParser/raw/main/apk/mygps.apk

MarshMello

Decompiled "Witcam Pro" and here is a text version of that interface so it doesn't get lost in a google drive folder getting deleted.

SunGpsInterface.java
package SunGps;

public class SunGpsInterface {
    public native int MakeEncryptDataBlock(int i, byte[] bArr, int i2, byte[] bArr2);

    public native int MakeEncryptDataBlockII(byte[] bArr, int i, byte[] bArr2);

    public native int MakeHeader(byte[] bArr, int i);

    public native int MakeRawDataBlock(int i, byte[] bArr, int i2, byte[] bArr2);

    public native void SunDecodeInfo(byte[] bArr);

    public native int SunDecrypt(byte[] bArr, int i, byte[] bArr2, byte[] bArr3, int i2);

    public native int SunEncrypt(byte[] bArr, int i, byte[] bArr2, byte[] bArr3);

    public native int SunGetEncType();

    public native int SunGetEyeFishID();

    public native int SunGetFileType();

    public native int SunSetEncType(int i);

    public native void SunSetFileInfo(byte[] bArr, int i, int i2);

    public native String sunGpsDecode(String str, int i);

    public native void sunGpsExit();

    public native int[] sunGpsGetSunTimer(float f, float f2, int i, int i2, int i3, int i4);

    public native void sunGpsInit();

    public native void sunGpsReadCallBack(IHttpReadCallback iHttpReadCallback);

    public native void sunGpsSetDecodeType(int i);

    static {
        System.loadLibrary("sungps");
    }
}

I do want to continue looking into this and seeing if I could add this into ExifTool but time is always a struggle.