I've recently bought Garmin Dash Cam 35, hoping that format will be similar. Well, it isn't.
First of all: files are MP4, not AVI. GPS data seems to be stored in 22 bytes of SEI message. I was able to extract it using mp4parser in scala:
import com.coremedia.iso.IsoFile
import com.googlecode.mp4parser.authoring.samples.DefaultMp4SampleList
/**
* Created by matemaciek on 01/09/2016.
*/
def decode(track: String) {
val GPS_TRACK_IDX = 3
val iso = new IsoFile(track)
val samples: DefaultMp4SampleList = new DefaultMp4SampleList(GPS_TRACK_IDX, iso)
val csv = (0 until samples.size).map(samples.get).map(
sample => (
(0 until sample.getSize.toInt).map("%02X" format sample.asByteBuffer.get(_)).mkString,
sample.asByteBuffer.getShort(10),
sample.asByteBuffer.getInt(14),
sample.asByteBuffer.getInt(18),
sample.asByteBuffer.getInt(14) / 11930464.711111112,
sample.asByteBuffer.getInt(18) / 11930464.711111112)
).map(_.productIterator.mkString(",")).mkString("\n")
println(csv)
}
decode("E:\\DCIM\\103UNSVD\\GRMN0845.MP4")
I'm trying to reverse engineer what is where - Results so far:
bytes |type |description
------+--------+----------------------------
0-9 |Unknown |Unknown (always 00 14 50 4E 44 4D 00 00 00 00)
10-11 |int16 |Speed in Km/h
12-13 |Unknown |Unknow (usually 01 00, in case of event 01 01 - some kind of flags?)
14-17 |int32 |Longitude
18-21 |int32 |Latitude
------+--------+----------------------------
Coordinates are in same format as in Dash Cam 20, I've adjusted dividing factor so when GPS signal is lost it returns exactly -180 (as Garmin's software do).