Extracting GPS data from video created with a BlueSkySea DV688 device

Started by [Art], August 23, 2019, 10:33:26 AM

Previous topic - Next topic

[Art]

This is yet another traffic camera (for motorcycle this one) with a weird storage of the GPS data. There was no way I was going to install unsigned software from an unknown developer on any of my computers, so I spend some time reverse engineering the data in the video. The MP4 from the device have three tracks: video, sound and a text track. I've extracted the data, and despite being labelled as a text track the content is all binary. I was unable to read the data with any of the tools I tried.

A sample video and the output of exiftool --ee sample.mp4 are available for download at https://drive.google.com/open?id=140YsTjfDC_iCW0a4UbTBjOwSRxc0psqj.

After looking at the data for a while, and with help from some friends, we found out that the first part of the data is simply xored with 0xaa. Once this is done the data appear as a string with a bunch of zeros thrown in. there is more data in there I don't know what it's for, but here is some quick and dirty python code decoding it:


#!/usr/bin/env python
import sys

for line in sys.stdin:
    # cleanup the line
    # Fist by removing the prefix and the carriage return
    line = line[40:-1]
   
    # For some reason the data is not directly readable.
    line = "".join(chr(ord(c)^ 0xaa)  for c in line)
   
    # Extract known data, avoiding the wrath of zeros all over the place.
    date = line[0:14]
    location = line[30:49]
    maybe_compass = line[54:57]
    no_clue = line[165:177]
       
    print date, location, maybe_compass, no_clue


Here is the output I got:


20190820075157 N48515873E002197769 031 -008-019+074
20190820075158 N48515928E002197833 034 -020-026+102
20190820075159 N48515986E002197880 036 -006-025+094
20190820075200 N48516048E002197939 037 -023-025+095
...


First is a timestamp, followed by the position in decimal minutes, then the bearing and finally what I suppose is the accelerometer data.

I was wondering if it would be interesting to integrate this decoder (probably used by other devices) in exiftool. I haven't checked the photos taken by the device yet, I'm wondering how those are tagged.

Phil Harvey

Try the attached config file with this command:

exiftool -config blueskysea.config -ee -G3 --text FILE

There are a bunch of floating point values that start at offset 0xba.  I'm decoding these as "AccelerometerData".  The first value is 0, and the next 3 match the strings of the tag I'm decoding as "Accelerometer", but these look more like angular accelerations to me.  Then another 0 followed by 3 numbers that look very similar to these accelerations.  Then a bunch more that I haven't looked at in detail.  If you figure out any of these, let me know.

- Phil

Edit:  Here is a plot of the 3 text accelerometer readings divided by 100, plus the first 8 of the floating-point values.  Note that you series 1,2,3 (the accelerometer text) lie exactly underneath the series 5,6,7 lines of the floating point values 2,3,4.

...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

Here are the floating point numbers (AccelerometerData values) plotted in groups of 3.  The first plot shows values 2-4, then 6-8, 10-12, 14-16 and 18-20.  I'm guessing that the accelerometer is sampled at 5 Hz, and these are all x,y,z accelerations in units of g.  I haven't looked at values 22-24 yet.



- 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

OK, here are values 22-24.  I've plotted these using points instead of lines because there are a lot of zero values (buy why?).  They are definitely related to the accelerations, but I don't know how.



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

[Art]

Thanks a lot for the config file, very useful to reconstitute a GPX file.

This device tags video when it detects some impact event on the accelerometer. I suppose the values are storing how the device decides what constitute a relevant impact. Plus in that particular video there was no hard acceleration or braking, so everything is probably quite smooth.