GPS – How to Extract Information from Garmin Cam 20 Video Files

garmingpsvideo

I just got a Garmin Dash Cam 20 and recorded some videos with it, and also confirmed that Garmin's own player can show the GPS information on a map.

I can't seem to find any technical information on where the GPS information is stored (assuming within the AVI file at this point) in contrast to some other Garmin action cam I have that stores the GPS separately in a GPX file. I need to integrate with a system, so manually using Garmin's player to extract it is not an option.

Does anyone have some pointers on where the GPS information might be stored?

There is also audio on the video, so it do not look like its encoded in the audio stream.

Best Answer

The video files recorded with garmin dash cam 20 are RIFF AVI files . There is a GR20 chunk in the file which contains sequence of 36 byte length binary data. Each 36 byte is about a frame, in this order:

bytes |type    |description
------+--------+----------------------------
0-4   |int32   |Frame number
6-8   |int16   |Speed in Km/h
8-12  |int32   |Longitude (in custom format, see comments)
12-16 |int32   |Latitude (in custom format, see comments)
16-20 |int32   |Time (in unix time format)
20-24 |int32   |traveling direction (0-359)
24-28 |single  |G sensor axis 1
28-32 |single  |G sensor axis 2
32-36 |single  |G sensor axis 3
------+--------+----------------------------

Longitude and latitude in file are in int32 type and they are not real latitude and longitude, you should divide them with 11930464.3017314 floating number to get real lat/long in degrees. for example if you get in value of '612222120' from bytes 8-12, then you should numberically divide it by 11930464.3017314 which result is:

612222120/11930464.3017314 = 51.31586705

Which is longitude in degrees.

After first 36 bytes you should start again for second one and so on untill chunk ends. Chunk length is multiply of 36. I've got the same problem but thanks to jagabo I've got my answer in here (which lead me to here):

Example of parser for finding chunks (including GR02) in RIFF file pragmatically with C# is here

Related Question