ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: jusw on March 18, 2016, 11:10:38 AM

Title: Inverse geotagging from NextBase dashcam footage
Post by: jusw on March 18, 2016, 11:10:38 AM
Hi Phil - would it be possible to add support for inverse geotagging (http://www.exiftool.org/geotag.html#GPX (http://www.exiftool.org/geotag.html#GPX)) from the NextBase range of dashcams (which are widely used in the UK)?  The model I use is the Nextbase 402G, which creates output in quicktime format (QTFF).  The tool gives me this:
$ exiftool -ee -p gpx.fmt 11500008.MOV > gpx.out
Warning: [Minor] Tag 'gpslatitude' not defined - 11500008.MOV
Warning: [Minor] Tag 'gpsaltitude' not defined - 11500008.MOV
Warning: [Minor] Tag 'gpsdatetime' not defined - 11500008.MOV
$


Basic tag data is:
$ exiftool 11500008.MOV
ExifTool Version Number         : 9.46
File Name                       : 11500008.MOV
Directory                       : .
File Size                       : 595 MB
File Modification Date/Time     : 2015:08:24 12:55:58+01:00
File Access Date/Time           : 2016:03:18 14:47:30+00:00
File Inode Change Date/Time     : 2015:12:26 11:56:07+00:00
File Permissions                : r--r--r--
File Type                       : MOV
MIME Type                       : video/quicktime
Major Brand                     : Apple QuickTime (.MOV/QT)
Minor Version                   : 0.0.0
Compatible Brands               : qt
Thumbnail Image                 : (Binary data 17608 bytes, use -b option to extract)
Movie Data Size                 : 624114456
Movie Data Offset               : 17648
Movie Header Version            : 0
Create Date                     : 2004:01:01 00:00:00
Modify Date                     : 2004:01:01 00:00:00
Time Scale                      : 30000
Duration                        : 0:05:00
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 3
Track Header Version            : 0
Track Create Date               : 2004:01:01 00:00:00
Track Modify Date               : 2004:01:01 00:00:00
Track ID                        : 1
Track Duration                  : 0:05:00
Track Layer                     : 0
Track Volume                    : 0.00%
Image Width                     : 1920
Image Height                    : 1080
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : avc1
Source Image Width              : 1920
Source Image Height             : 1080
X Resolution                    : 72
Y Resolution                    : 72
Compressor Name                 : h264
Bit Depth                       : 24
Video Frame Rate                : 30
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 2004:01:01 00:00:00
Media Modify Date               : 2004:01:01 00:00:00
Media Time Scale                : 32000
Media Duration                  : 0:05:00
Balance                         : 0
Handler Class                   : Data Handler
Handler Type                    : URL
Handler Description             : DataHandler
Audio Format                    : sowt
Audio Channels                  : 1
Audio Bits Per Sample           : 16
Audio Sample Rate               : 32000
Avg Bitrate                     : 16.6 Mbps
Image Size                      : 1920x1080
Rotation                        : 0
$


I can't find any info about which QTFF atoms the GPS data is embedded in the .MOV file but I was hoping there would be a way of extending exiftool to handle it? Could you let me know if this is on your road map, or perhaps we could discuss how to achieve it as I have example footage and coding experience (although not with QTFF)?

Thanks for the excellent piece of software.

Regards,
Justin
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on March 18, 2016, 11:23:01 AM
Hi Justin,

Adding the ability to extract GPS from MOV video streams has been on my to-do list for a while, but my first attempt failed and I haven't found the time to get back to it again.  Video formats in general are a real pain, but I have already decoded the GPS from the H264 video stream of M2TS files, and hoped that the H264 stream of MOV/MP4 files would be similar enough to make it easy to decode, but unfortunately this wasn't the case.  So it may be a while before this feature is added.

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on January 04, 2018, 04:36:28 PM
ExifTool 10.72 (just released) has the ability to extract GPS from MOV/MP4 videos using the -ee option.  Please send me a sample if it doesn't extract it for your camera (philharvey66 at gmail.com).

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Gelunox on September 30, 2018, 11:56:04 AM
Hi, I found this page while searching for a way to decode Nextbase dashcam gps information. I'd like to add that on my device, the NextBase 512GW, gps data is stored in a tag called GPSDataList. Other than that the video file also has G-force acceleration data in it somewhere, but I wasn't able to figure out which tag that's under.

I'm posting this here should more people find it, Exiftool can only do part of the work and I can't for the love of me figure out how to interpret this data.

I ran with exiftool.exe -ee -u -b -GPSDataList dashcamfile.MOV > gps.txt and got the following output (converted to HEX because it's unreadable gibberish as normal text)

00 00 01 01 00 00 00 B4 00 42 4C 50 00 00 80 00 00 81 E5 C4 00 00 80 00 00 C1 F3 B4 00 00 80 00
01 01 A6 70 00 00 80 00 01 43 48 24 00 00 80 00 01 83 92 DC 00 00 80 00 01 C4 C5 34 00 00 80 00
02 03 7C 3C 00 00 80 00 02 42 C4 A8 00 00 80 00 02 85 0C 98 00 00 80 00 02 C2 2B 40 00 00 80 00
03 03 FD BC 00 00 80 00 03 44 C9 7C 00 00 80 00 03 84 73 6C 00 00 80 00 03 C4 08 10 00 00 80 00
04 03 76 28 00 00 80 00 04 42 E1 18 00 00 80 00 04 83 9A 20 00 00 80 00 04 C2 82 A8 00 00 80 00
05 02 30 10 00 00 80 00 05 41 4D 20 00 00 80 00 05 80 F7 24 00 00 80 00 05 C3 1C 8C 00 00 80 00
06 02 55 18 00 00 80 00 06 42 D9 58 00 00 80 00 06 82 06 50 00 00 80 00 06 C3 F7 B8 00 00 80 00
07 04 E4 B8 00 00 80 00 07 44 16 E0 00 00 80 00 07 82 1A 58 00 00 80 00 07 C3 3D A4 00 00 80 00
08 04 92 B8 00 00 80 00 08 43 81 1C 00 00 80 00 08 84 81 18 00 00 80 00 08 C4 77 50 00 00 80 00
09 04 E2 40 00 00 80 00 09 46 95 E4 00 00 80 00 09 84 01 B8 00 00 80 00 09 C3 CC DC 00 00 80 00
0A 05 97 78 00 00 80 00 0A 48 FC F0 00 00 80 00 0A 89 F8 7C 00 00 80 00 0A C8 43 CC 00 00 80 00
0B 06 A6 CC 00 00 80 00 0B 47 CB 10 00 00 80 00 0B 89 61 88 00 00 80 00 0B C7 89 10 00 00 80 00
0C 07 F4 A4 00 00 80 00 0C 45 03 EC 00 00 80 00 0C 89 20 1C 00 00 80 00 0C C9 19 BC 00 00 80 00
0D 09 5A 00 00 00 80 00 0D 48 69 5C 00 00 80 00 0D 88 93 A4 00 00 80 00 0D C9 E9 CC 00 00 80 00
0E 08 25 CC 00 00 80 00 0E 47 CC 04 00 00 80 00 0E 88 8C 00 00 00 80 00 0E C9 B9 50 00 00 80 00
0F 08 E3 B0 00 00 80 00 0F 4A 54 18 00 00 80 00 0F 89 3E BC 00 00 80 00 0F C9 5F 5C 00 00 80 00
10 09 86 C8 00 00 80 00 10 4A 03 AC 00 00 80 00 10 8A 44 B8 00 00 80 00 10 CA AA A4 00 00 80 00
11 0A F8 54 00 00 80 00 11 49 1B 7C 00 00 80 00 11 89 DF 80 00 00 80 00 11 CB 96 78 00 00 80 00
12 09 A0 BC 00 00 80 00 12 49 E9 80 00 00 80 00 12 8B 9E B4 00 00 80 00 12 CC 45 A4 00 00 80 00
13 0A B0 94 00 00 80 00 13 49 37 44 00 00 80 00 13 89 6A 80 00 00 80 00 13 CA 1B 60 00 00 80 00
14 09 9C 08 00 00 80 00 14 4B F4 80 00 00 80 00 14 8C A3 7C 00 00 80 00 14 CA 0C 08 00 00 80 00
15 0C ED A4 00 00 80 00 15 4B 99 70 00 00 80 00 15 8D 0A 1C 00 00 80 00 15 CC 7E 10 00 00 80 00
16 09 F9 40 00 00 80 00 16 4B 21 4C 00 00 80 00 16 8A CF 44 00 00 80 00 16 CD 59 F0 00 00 80 00
17 0C 66 58 00 00 80 00 17 4E BF F0 00 00 80 00 17 8E AD 10 00 00 80 00 17 CD 08 34 00 00 80 00
18 0D 94 14 00 00 80 00 18 4C 2D 08 00 00 80 00 18 8E 23 EC 00 00 80 00 18 CE 10 08 00 00 80 00
19 0D AC 80 00 00 80 00 19 4D 0B A0 00 00 80 00 19 8D 85 8C 00 00 80 00 19 CC D5 00 00 00 80 00
1A 0D 9C 44 00 00 80 00 1A 4E 0E 04 00 00 80 00 1A 8D 61 D0 00 00 80 00 1A CC A5 88 00 00 80 00
1B 0B 9D 60 00 00 80 00 1B 49 2C F4 00 00 80 00 1B 8C 28 F8 00 00 80 00 1B CA BE E8 00 00 80 00
1C 0B 64 60 00 00 80 00 1C 4B 81 1C 00 00 80 00 1C 8B 58 84 00 00 80 00 1C CB 00 A4 00 00 80 00
1D 0B 2C 10 00 00 80 00 1D 49 E2 58 00 00 80 00 1D 8A C8 D0 00 00 80 00 1D CB 42 EC 00 00 80 00
1E 0C A8 80 00 00 80 00 1E 4B 7E D8 00 00 80 00 1E 8B 1F 2C 00 00 80 00 1E CA B1 A8 00 00 80 00
1F 0C A9 C8 00 00 80 00 1F 4C 26 38 00 00 80 00 1F 8D AC 6C 00 00 80 00 1F CC A9 B8 00 00 80 00
20 0C A4 64 00 00 80 00 20 4D 93 A4 00 00 80 00 20 8E 1A CC 00 00 80 00 20 CE FC 6C 00 00 80 00
21 0F 46 BC 00 00 80 00 21 4E 2F A4 00 00 80 00 21 8E A6 78 00 00 80 00 21 CE DB FC 00 00 80 00
22 0D E8 5C 00 00 80 00 22 4E 11 F8 00 00 80 00 22 8D 3A CC 00 00 80 00 22 CD 60 6C 00 00 80 00
23 0C D6 EC 00 00 80 00 23 4F 83 18 00 00 80 00 23 8E AF C4 00 00 80 00 23 D0 8A 90 00 00 80 00
24 12 16 A4 00 00 80 00 24 52 3D EC 00 00 80 00 24 91 35 C8 00 00 80 00 24 D1 BB 2C 00 00 80 00
25 13 31 6C 00 00 80 00 25 52 E2 90 00 00 80 00 25 92 6A CC 00 00 80 00 25 D5 12 B0 00 00 80 00
26 11 57 4C 00 00 80 00 26 51 9D C8 00 00 80 00 26 94 1D 00 00 00 80 00 26 D2 65 74 00 00 80 00
27 10 E9 FC 00 00 80 00 27 54 46 24 00 00 80 00 27 94 2C 48 00 00 80 00 27 D4 04 3C 00 00 80 00
28 13 44 FC 00 00 80 00 28 53 22 D8 00 00 80 00 28 91 FC C4 00 00 80 00 28 D3 20 44 00 00 80 00
29 12 9D 6C 00 00 80 00 29 52 43 D8 00 00 80 00 29 95 4A 44 00 00 80 00 29 D3 80 F0 00 00 80 00
2A 13 AE BC 00 00 80 00 2A 55 82 E8 00 00 80 00 2A 94 D2 80 00 00 80 00 2A D5 B0 B0 00 00 80 00
2B 14 18 7C 00 00 80 00 2B 54 0B A4 00 00 80 00 2B 93 EC FC 00 00 80 00 2B D4 DE 20 00 00 80 00
2C 15 50 DC 00 00 80 00 2C 56 6D 3C 00 00 80 00 2C 94 0E 74 00 00 80 00 2C D4 C2 B8 00 00 80 00
2D 14 96 7C 00 00 80 00


First few coordinates + timestamp (I have it so they're also printed on screen, which is how I know):

Hope this helps anyone.
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on September 30, 2018, 02:09:24 PM
Could you email me a (small) sample?  philharvey66 at gmail.com

I should be able to add support for this.  I don't remember now how I knew to name that tag GPSDataList, but since it isn't decoded I probably never had a sample.  It looks to me like a list of offsets and sizes for the GPS data, but once extracted they would need decoding as well.

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on September 30, 2018, 04:50:39 PM
Yes.  This is different than I have seen before.  ExifTool 11.12 will extract the GPS from this file.  It is stored as an NMEA-formatted string that you can see with exiftool -ee -v4.

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Gelunox on October 01, 2018, 01:56:08 PM
That's awesome!

I see an extract embedded with Type='gps ', Sample 1 of 180 (179 more of those) and also an extract embedded + [GPS directory, 32768 bytes] (also 180 times)

How would I go about extracting this data RAW? The documentation sadly isn't making me any wiser on how to do this.
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on October 01, 2018, 02:03:54 PM
ExifTool 11.12 will extract and decode this information.

To extract it in raw form, you would have to decode the GPSDataList table, which is a table of unsigned 32-bit big-endian integers of starting offsets and lengths for the "freeGPS" data blocks.  Alternatively you could do a brute-force scan of the movie data for the "freeGPS" strings at the beginning of each block.

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Gelunox on October 01, 2018, 03:30:03 PM
Allright, supercool, I've written this small prototype script in Java to extract all the gps coordinates from the video after extracting the GPSDataList with exiftool, still figuring out how to read this metadata directly with Java:

Code (Java) Select
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;

public class Reader {
public static void main(String[] args) throws IOException {
File movie = new File("E:\\Exiftool\\gps.MOV");
File pointers = new File("E:\\Exiftool\\GPSDataList.txt");

List<Long> data = new ArrayList<>();


//read the GPSDataList data containing all the pointers
try(FileInputStream fin = new FileInputStream(pointers))
{
fin.skip(16); //skip the first two numbers, not relevant

while(fin.available() > 0)
{
data.add(readUIntAsLong(fin));
}
}

List<String> gpsData = new ArrayList<>();

long skipped = 0;

try(FileInputStream fin = new FileInputStream(movie))
{
for(int i=0; i<data.size(); i+=2)
{
long skip = data.get(i);
int read = data.get(i+1).intValue();

long skipsize = skip - skipped;

fin.skip(skipsize);
skipped += skipsize + read;

byte[] buff = new byte[read];

fin.read(buff, 0, buff.length);

gpsData.add(new String(buff, StandardCharsets.UTF_8));
}
}

//cleanup data and print to console
gpsData.stream()
.map(s -> s.replaceAll("\\x0d\\x0a", " "))
.map(s -> s.replaceAll("[^\\x20-\\x7E]+", ""))
.forEach(System.out::println);
}

public static long readUIntAsLong(InputStream i) throws IOException
{
return 0
| ((i.read() & 0xFF) << 24)
| ((i.read() & 0xFF) << 16)
| ((i.read() & 0xFF) << 8)
| (i.read() & 0xFF);
}
}
Title: tags
Post by: Phil Harvey on October 01, 2018, 03:54:09 PM
In case it helps, here is my Perl code to decode this block (pointed to by $dataPt):


    my ($hr,$min,$sec,$yr,$mon,$day,$stat,$latRef,$lonRef,$lat,$lon,$spd,$trk,$alt,$lbl,@acc,@xtra);
    if ($$dataPt =~ /^.{52}(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/) {
        # decode NMEA-format GPS data (NextBase 512GW dashcam, ref PH)
        push @xtra, CameraDateTime => "$1:$2:$3 $4:$5:$6";
        if ($$dataPt =~ /\$[A-Z]{2}RMC,(\d{2})(\d{2})(\d+(\.\d*)?),A?,(\d+\.\d+),([NS]),(\d+\.\d+),([EW]),(\d*\.?\d*),(\d*\.?\d*),(\d{2})(\d{2})(\d+)/s) {
            ($lat,$latRef,$lon,$lonRef) = ($5,$6,$7,$8);
            $yr = $13 + ($13 >= 70 ? 1900 : 2000);
            ($mon,$day,$hr,$min,$sec) = ($12,$11,$1,$2,$3);
            $spd = $9 * $knotsToKph if length $9;
            $trk = $10 if length $10;
        }
        if ($$dataPt =~ /\$[A-Z]{2}GGA,(\d{2})(\d{2})(\d+(\.\d*)?),(\d+\.\d+),([NS]),(\d+\.\d+),([EW]),[1-6]?,(\d+)?,(\.\d+|\d+\.?\d*)?,(-?\d+\.?\d*)?,M?/s) {
            ($hr,$min,$sec,$lat,$latRef,$lon,$lonRef) = ($1,$2,$3,$5,$6,$7,$8) unless defined $yr;
            $alt = $11;
            unshift @xtra, GPSSatellites => $9;
            unshift @xtra, GPSDOP => $10;
        }
        if (defined $lat) {
            # extract accelerometer readings if GPS was valid
            @acc = unpack('x68V3', $$dataPt);
            # change to signed integer and divide by 256
            map { $_ = $_ - 4294967296 if $_ >= 2147483648; $_ /= 256 } @acc;
        }
    }


- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on October 02, 2018, 10:36:42 AM
ExifTool 11.12 is now available.

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: zubairlk on October 07, 2018, 11:31:12 AM
Hi,

I have a Nextbase 512G. (not GW).
I tried to use exiftool to extract gps data from a video using

./exiftool -ee -v4 ../2018_1007_085054_198.MOV > gps.txt

And I do see it. In the 2 minute clip, the gps.txt file contains 120 mentions of freeGPS like the following


---- Extract Embedded ----                                                                                                                                                               
  + [GPS directory, 32768 bytes]                                                                                                                                                         
  |   210000: 00 00 80 00 66 72 65 65 47 50 53 20 78 01 00 00 [....freeGPS x...]                                                                                                         
  |   210010: 78 2e 78 78 00 00 00 00 00 00 00 00 00 00 00 00 [x.xx............]                                                                                                         
  |   210020: 30 30 30 30 30 00 00 00 00 00 00 00 00 00 00 00 [00000...........]                                                                                                         
  |   210030: 24 53 03 a2 2e 29 07 e2 0a 07 08 32 02 22 02 20 [$S...).....2.". ]                                                                                                         
  |   210040: 10 56 68 ff 10 f8 59 10 00 00 00 00 00 00 00 00 [.Vh...Y.........]                                                                                                         
  |   210050: 24 53 03 79 2d d2 07 e2 0a 07 08 32 02 23 02 20 [$S.y-......2.#. ]                                                                                                         
  |   210060: 10 56 49 ff 10 f8 d1 10 00 00 00 00 00 00 00 00 [.VI.............]                                                                                                         
  |   210070: 24 53 03 85 2d 9d 07 e2 0a 07 08 32 02 24 02 20 [$S..-......2.$. ]                                                                                                         
  |   210080: 10 56 28 ff 10 f9 4b 10 00 00 00 00 00 00 00 00 [.V(...K.........]                                                                                                         
  |   210090: 24 53 03 77 2d 47 07 e2 0a 07 08 32 02 25 02 20 [$S.w-G.....2.%. ]                                                                                                         
  |   2100a0: 10 56 0a ff 10 f9 c4 10 00 00 00 00 00 00 00 00 [.V..............]                                                                                                         
  |   2100b0: 24 53 03 73 2d 1e 07 e2 0a 07 08 32 02 26 02 20 [$S.s-......2.&. ]                                                                                                         
  |   2100c0: 10 55 eb ff 10 fa 3e 10 00 00 00 00 00 00 00 00 [.U....>.........]                                                                                                         
  |   2100d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]                                                                                                         
  |   2100e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]                                                                                                         
  |   2100f0: 24 53 03 51 2b 82 07 e2 0a 07 08 32 02 2a 02 20 [$S.Q+......2.*. ]                                                                                                         
  |   210100: 10 55 a4 ff 10 fc 2e 10 00 00 00 00 00 00 00 00 [.U..............]                                                                                                         
  |   210110: 24 53 03 3b 2b 18 07 e2 0a 07 08 32 02 2b 02 20 [$S.;+......2.+. ]                                                                                                         
  |   210120: 10 55 9a ff 10 fc ac 10 00 00 00 00 00 00 00 00 [.U..............]                                                                                                         
  |   210130: 24 53 03 4d 2a 96 07 e2 0a 07 08 32 02 2c 02 20 [$S.M*......2.,. ]                                                                                                         
  |   210140: 10 55 90 ff 10 fd 26 10 00 00 00 00 00 00 00 00 [.U....&.........]                                                                                                         
  |   210150: 24 53 03 3b 2a 05 07 e2 0a 07 08 32 02 2d 02 20 [$S.;*......2.-. ]                                                                                                         
  |   210160: 10 55 88 ff 10 fd a0 10 00 00 00 00 00 00 00 00 [.U..............]                                                                                                         
  |   210170: fb 00 00 00 ee 00 00 00 01 00 00 00 00 00 00 00 [................]                                                                                                         
  |   210180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]                                                                                                         
  |   210190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]                                                                                                         
  |   2101a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]                                                                                                         
  |   2101b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]                                                                                                         
  |   2101c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]                                                                                                         
  |   2101d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................] 


Am I missing a flag to make this output slightly more human readable?
Attached to whole txt file if it helps.

Thanks

Regards
ZubairLK

p.s. awesome tool btw.
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on October 08, 2018, 08:27:49 PM
... yet another different "freeGPS" format.  Please send me a (small) sample video from a moving camera and I'll see about decoding this too (philharvey66 at gmail.com).  There seems to be no standardization at all in these formats. :(

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on October 09, 2018, 09:12:44 AM
OK.  I can decode date/time, lat, lon and speed, but there is one value that I don't understand.  Here is the extracted value with timestamps as hex, unsigned and signed integer.  Any ideas what this could be?

2018:10:08 06:42:46.0 d60c 54796 -10740
2018:10:08 06:42:46.0 d60c 54796 -10740
2018:10:08 06:42:47.0 d2f1 54001 -11535
2018:10:08 06:42:46.0 d60c 54796 -10740
2018:10:08 06:42:48.0 d223 53795 -11741
2018:10:08 06:42:49.0 d221 53793 -11743
2018:10:08 06:42:50.0 d1be 53694 -11842
2018:10:08 06:42:51.0 d1e3 53731 -11805
2018:10:08 06:42:52.0 d1be 53694 -11842
2018:10:08 06:42:53.0 d1ff 53759 -11777
2018:10:08 06:42:54.0 d2d9 53977 -11559
2018:10:08 06:42:55.0 d963 55651 -9885
2018:10:08 06:42:56.0 e3f5 58357 -7179
2018:10:08 06:42:57.0 eee3 61155 -4381
2018:10:08 06:42:58.0 f55a 62810 -2726
2018:10:08 06:42:59.0 f675 63093 -2443
2018:10:08 06:43:00.0 f65a 63066 -2470
2018:10:08 06:43:01.0 f591 62865 -2671
2018:10:08 06:43:02.0 f49c 62620 -2916
2018:10:08 06:43:03.0 f42f 62511 -3025
2018:10:08 06:43:04.0 f504 62724 -2812
2018:10:08 06:43:05.0 f5fe 62974 -2562
2018:10:08 06:43:06.0 f71e 63262 -2274
2018:10:08 06:43:07.0 f560 62816 -2720
2018:10:08 06:43:08.0 f8a2 63650 -1886
2018:10:08 06:43:09.0 f8a2 63650 -1886
2018:10:08 06:43:10.0 f8a2 63650 -1886
2018:10:08 06:43:11.0 f8a2 63650 -1886
2018:10:08 06:43:12.0 f8a2 63650 -1886
2018:10:08 06:43:13.0 f8a2 63650 -1886
2018:10:08 06:43:14.0 f8a2 63650 -1886
2018:10:08 06:43:15.0 f8a2 63650 -1886
2018:10:08 06:43:16.0 f8a2 63650 -1886
2018:10:08 06:43:17.0 f8a2 63650 -1886
2018:10:08 06:43:18.0 f8a2 63650 -1886
2018:10:08 06:43:19.0 f8a2 63650 -1886
2018:10:08 06:43:20.0 f8a2 63650 -1886
2018:10:08 06:43:21.0 f8a2 63650 -1886
2018:10:08 06:43:22.0 f8a2 63650 -1886
2018:10:08 06:43:23.0 f8a2 63650 -1886
2018:10:08 06:43:24.0 f8a2 63650 -1886
2018:10:08 06:43:25.0 f8a2 63650 -1886
2018:10:08 06:43:26.0 f8a2 63650 -1886
2018:10:08 06:43:27.0 f8a2 63650 -1886
2018:10:08 06:43:28.0 f8a2 63650 -1886
2018:10:08 06:43:29.0 f8a2 63650 -1886
2018:10:08 06:43:30.0 f8a2 63650 -1886
2018:10:08 06:43:31.0 f8a2 63650 -1886
2018:10:08 06:43:32.0 f8a2 63650 -1886
2018:10:08 06:43:33.0 f8a2 63650 -1886
2018:10:08 06:43:34.0 f8a2 63650 -1886
2018:10:08 06:43:35.0 f8a2 63650 -1886
2018:10:08 06:43:36.0 f8a2 63650 -1886
2018:10:08 06:43:37.0 f514 62740 -2796
2018:10:08 06:43:38.0 f57d 62845 -2691
2018:10:08 06:43:39.0 f62f 63023 -2513
2018:10:08 06:43:40.0 f8e8 63720 -1816
2018:10:08 06:43:41.0 fed0 65232 -304
2018:10:08 06:43:42.0 037e 894 894
2018:10:08 06:43:43.0 0b33 2867 2867
2018:10:08 06:43:44.0 0dcc 3532 3532
2018:10:08 06:43:45.0 0eec 3820 3820
2018:10:08 06:43:46.0 0f09 3849 3849
2018:10:08 06:43:47.0 0f4f 3919 3919
2018:10:08 06:43:48.0 0ee7 3815 3815
2018:10:08 06:43:49.0 0ef2 3826 3826
2018:10:08 06:43:50.0 0ebd 3773 3773
2018:10:08 06:43:51.0 0f31 3889 3889
2018:10:08 06:43:52.0 0f63 3939 3939
2018:10:08 06:43:53.0 0e32 3634 3634
2018:10:08 06:43:54.0 06b6 1718 1718
2018:10:08 06:43:55.0 fab9 64185 -1351
2018:10:08 06:43:56.0 ed97 60823 -4713
2018:10:08 06:43:57.0 ea8b 60043 -5493
2018:10:08 06:43:58.0 eb94 60308 -5228
2018:10:08 06:43:59.0 ec9d 60573 -4963
2018:10:08 06:44:00.0 ed93 60819 -4717
2018:10:08 06:44:01.0 ec59 60505 -5031
2018:10:08 06:44:02.0 ec3e 60478 -5058
2018:10:08 06:44:03.0 ef90 61328 -4208
2018:10:08 06:44:04.0 f4fe 62718 -2818
2018:10:08 06:44:05.0 f9af 63919 -1617
2018:10:08 06:44:06.0 0478 1144 1144
2018:10:08 06:44:07.0 0c87 3207 3207
2018:10:08 06:44:08.0 0e30 3632 3632
2018:10:08 06:44:09.0 0e66 3686 3686
2018:10:08 06:44:10.0 0d54 3412 3412
2018:10:08 06:44:11.0 0b66 2918 2918
2018:10:08 06:44:12.0 08ba 2234 2234
2018:10:08 06:44:13.0 0630 1584 1584
2018:10:08 06:44:14.0 02fa 762 762
2018:10:08 06:44:15.0 fa7a 64122 -1414
2018:10:08 06:44:16.0 ef29 61225 -4311
2018:10:08 06:44:17.0 e88f 59535 -6001
2018:10:08 06:44:18.0 e6f6 59126 -6410
2018:10:08 06:44:19.0 e642 58946 -6590
2018:10:08 06:44:20.0 e5ef 58863 -6673
2018:10:08 06:44:21.0 e5e6 58854 -6682
2018:10:08 06:44:22.0 e5e6 58854 -6682
2018:10:08 06:44:23.0 e5f3 58867 -6669
2018:10:08 06:44:24.0 e556 58710 -6826
2018:10:08 06:44:25.0 e4f5 58613 -6923
2018:10:08 06:44:26.0 e431 58417 -7119
2018:10:08 06:44:27.0 e3ea 58346 -7190
2018:10:08 06:44:28.0 e3e4 58340 -7196
2018:10:08 06:44:29.0 e2de 58078 -7458
2018:10:08 06:44:30.0 e1c2 57794 -7742
2018:10:08 06:44:31.0 e0ec 57580 -7956
2018:10:08 06:44:32.0 df54 57172 -8364
2018:10:08 06:44:33.0 de47 56903 -8633
2018:10:08 06:44:34.0 dda4 56740 -8796
2018:10:08 06:44:35.0 dc9e 56478 -9058
2018:10:08 06:44:36.0 dbb6 56246 -9290
2018:10:08 06:44:37.0 da6a 55914 -9622
2018:10:08 06:44:38.0 d9c9 55753 -9783
2018:10:08 06:44:39.0 d8fe 55550 -9986
2018:10:08 06:44:40.0 d7f1 55281 -10255
2018:10:08 06:44:41.0 d5fc 54780 -10756
2018:10:08 06:44:42.0 d4ad 54445 -11091
2018:10:08 06:44:43.0 d45d 54365 -11171
2018:10:08 06:44:44.0 d3c0 54208 -11328


Also, does the video start at 06:42 local time, or UTC?

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: zubairlk on October 09, 2018, 09:28:18 AM
I took a look at the video sample at the timestamps that jump. e.g. 06:43:42.0 06:43:55.0
The car is turning. So I guess this could be compass data.

Should I try to decipher what north is based on the footage for a calibration?

Thanks!

Regards
ZubairLK
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on October 09, 2018, 09:32:56 AM
North should be 0 if this is compass data.  I thought about direction, but it didn't make sense because you made some 90 degree turns and I don't see changes in this number that reflect this.

Also, is this local time or UTC?

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: zubairlk on October 09, 2018, 09:42:11 AM
Quote from: Phil Harvey on October 09, 2018, 09:12:44 AM

Also, does the video start at 06:42 local time, or UTC?

This is from the UK so local time is the same as UTC.
The actual time of footage was 07:42 cause of daylight saving.
But the camera hasn't picked that from the GPS and remains at GMT +0.

Regards
ZubairLK
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on October 09, 2018, 09:43:54 AM
Thanks.  I'll just assume UTC and add "Z" to the date/time values like I do with the NextBase 512GW (although the 512G format is VERY different!).

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on October 09, 2018, 09:56:13 AM
Actually, I think you are right about the compass data.  Could the signed value be degrees * 100?  (in the range -180 to 180 degrees?)

- Phil

Edit: So is the the direction of the camera, or direction of travel?  (ie. GPSTrack, or GPSImgDirection?)
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on October 09, 2018, 12:28:21 PM
I've just released ExifTool 11.13 with the assumption that the direction should be extracted as GPSTrack -- please let me know if you discover otherwise.  It should be GPSTrack for the 512GW because it was stored as an NMEA RMC sentence, and the NMEA specification states that this is the track direction.  I'm hoping the 512G is the same (even though it isn't stored as NMEA).

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: zubairlk on October 10, 2018, 03:44:23 AM
Thank-you so much! I'll check it out over the weekend and let you know.

Regards
ZubairLK
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Watcher on November 12, 2018, 07:53:59 AM
I just happen to be looking at extracting GPS data from nextbase MOV files.
We have a few threads open on this topic at the dashcamtalk forum, for
example https://dashcamtalk.com/forum/threads/next-base-312-gps-format.29175/#post-440026 (https://dashcamtalk.com/forum/threads/next-base-312-gps-format.29175/#post-440026).

The sggps program mentioned there will decode video written by older firmware,
but Nextbase have changed the way they record GPS under more recent firmware.
It now seems to be straight forward  NMEA. I am exploring the go language which is new to me before writing a version to handle, at least, the Nextbase 312GW output. It looks straightforward.

If you compare the old and new versions of the GPS data with the NMEA spec, it ought to be possible to identify all the fields.

Hope this helps.
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on November 12, 2018, 07:55:50 AM
As I mentioned earlier, my 512GW sample stores GPS in NMEA format, and ExifTool can decode that.  If you have any samples that don't work with ExifTool, please send them to me.

Thanks.

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Watcher on March 30, 2019, 05:22:22 PM
I have at last put my program "mov2gpx" onto github at
github.com/clarified/mov2gps (http://github.com/clarified/mov2gps).

It works with Nextbase 312GW and similar cameras. But not (yet) with the other Nextbase models. After it was written, Nextbase sent me samples from their other models that generate MOV rather than mp4. I was surprised that the way that the gps information was recorded was different enough to stop Version1 working. But except for one outlier, it seems to be easy to modify mov2gpx to handle them. That will be Version 2 - but it will have to wait until I have some spare time.

exiftool was useful when writing mov2gpx.
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: mjc-506 on March 17, 2020, 06:38:49 AM
Sorry for the necro-bump...

I have a 522GW, and reverse geocoding nearly works.

'.\exiftool.exe' -n -s -ee .\file.MP4
...
SampleTime                      : 59.7
SampleDuration                  : 0.1
Text                            : 20200312110802.Ç      $GPRMC,110803.700,A,5214.38508,N,00415.90726,W,6.873,138.26,120320,,,A*56...$GPGGA,110803.800,5214.38494,N,00415.90705,W,1,07,1.08,31.5,M,51.9,M,,*5C..
GPSDateTime                     : 2020:03:12 11:08:03Z
GPSLatitude                     : 52.2397513333333
GPSLongitude                    : -4.265121
GPSSpeed                        : 12.728796
GPSSpeedRef                     : K
GPSTrack                        : 6.873
GPSTrackRef                     : T
Text                            : $GPGGA,110803.800,5214.38494,N,00415.90705,W,1,07,1.08,31.5,M,51.9,M,,*5C..
SampleTime                      : 59.8
SampleDuration                  : 0.1
Text                            : 20200312110802Ç.└      $GPRMC,110803.900,A,5214.38480,N,00415.90682,W,7.114,136.44,120320,,,A*55...$GPGGA,110803.900,5214.38480,N,00415.90682,W,1,07,1.08,31.5,M,51.9,M,,*56..
GPSDateTime                     : 2020:03:12 11:08:03Z
GPSLatitude                     : 52.2397466666667
GPSLongitude                    : -4.26511366666667
GPSSpeed                        : 13.175128
GPSSpeedRef                     : K
GPSTrack                        : 7.114
GPSTrackRef                     : T
Text                            : $GPGGA,110803.900,5214.38480,N,00415.90682,W,1,07,1.08,31.5,M,51.9,M,,*56..
SampleTime                      : 59.9
SampleDuration                  : 0.1
Text                            : 20200312110802.Ç   @   $GPRMC,110803.900,A,5214.38480,N,00415.90682,W,7.114,136.44,120320,,,A*55...$GPGGA,110804.000,5214.38465,N,00415.90660,W,1,07,1.08,31.5,M,51.9,M,,*5F..
GPSDateTime                     : 2020:03:12 11:08:03Z
GPSLatitude                     : 52.2397466666667
GPSLongitude                    : -4.26511366666667
GPSSpeed                        : 13.175128
GPSSpeedRef                     : K
GPSTrack                        : 7.114
GPSTrackRef                     : T
Text                            : $GPGGA,110804.000,5214.38465,N,00415.90660,W,1,07,1.08,31.5,M,51.9,M,,*5F..


The 522GW records GPS at 10Hz, but Exiftool reports timestamps only to the nearest second. Also, GPSTrack is taking its values from the wrong $GPRMC field? Elevation is also present in the GPGGA output, but not reported by Exiftool.

I tried to modify the gpx.fmt file to also dump the 'Text' tags into another field (intending to then process this outside Exiftool and update time, altitude and heading) but could only manage to output the second 'Text' tag (which only included the $GPGGA string).

The end goal is to use ffmpeg to split the mp4 into a series of images, and then geotag these using Exiftool.

Is there an (easy?) way to change the $GPRMC/$GPGGA fields read by Exiftool? Alternatively, is there a way of outputting both 'Text' tags to file?

(Exiftool 11.91 Windows executable - no perl)

Many thanks!
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on March 17, 2020, 07:29:49 AM
Could you send me a sample so I can test this myself?  My email is philharvey66 at gmail.com

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: mjc-506 on March 17, 2020, 10:05:05 AM
Thanks Phil, an email with a GDrive link should be on its way to you now.

Edit: Perhaps I'm misunderstanding the GPSTrack tag - I thought this was heading, but it's actually distance travelled? I'm after a bearing so I can tell which way the camera was pointing...
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on March 17, 2020, 11:27:10 AM
This is a bit of a mess.  I can fix reading of the fractional seconds, but the bigger problem is that the GGA sentence in the same Text block as the RMC sentence is actually for the next fix.  Weird.

I think the best thing to do is to extract the raw Text data into a separate file, and work with this:

exiftool -ee -text -b MOVIEFILE > out.txt

Note that there is a binary header before the RMC entries (that likely contains accelerometer readings or some such).  However, this file can be used as-is to tag images like this (provided they have DateTimeOriginal set properly):

exiftool -geotag out.txt IMAGEFILE

To answer your question:  GPSTrack is the compass direction of travel.

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: mjc-506 on March 17, 2020, 11:38:52 AM
You're right, all kinds of strange in there...

Perfect, that will do me for now, thanks. :)
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on March 17, 2020, 11:55:04 AM
ExifTool 11.92 (to be released soon) will extract the subseconds properly in GPSDateTime.  The RMC sentences will be used, and the GGA ignored for the purposes of generating the GPS tags.

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: mjc-506 on March 17, 2020, 12:04:20 PM
Many thanks, insane fix speed!
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on March 17, 2020, 01:02:45 PM
Ah.  I just discovered that ExifTool was decoding GPSTrack improperly for this video with the -ee option.  I'll fix this too in the next release.

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: mjc-506 on March 20, 2020, 07:31:34 AM
11.92 is looking good, thanks.

I was having trouble loading the resulting gpx file into qGis - turns out my version of Powershell was writing in UTF16, upsetting things.

exiftool.exe -p gpx.fmt -ee file.MP4 | out-file -encoding ascii out.gpx

outputs UTF8 without the BOM that results if I use utf8 encoding...

(Powershell 5.1.17134.858, I understand later versions do things a bit better)

edit:

Apologies, just noticed that elevation isn't extracted from the nmea strings. Is this expected?
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: Phil Harvey on March 20, 2020, 09:01:38 AM
...or you could use cmd.exe instead of PowerShell. :)

As I said, ExifTool is only parsing the RMC sentence.  Unfortunately it is the GGA that contains the elevation.

I don't have a plan for how I could parse both because of the complication I mentioned about the corresponding GGA being in a different Text block.  So currently the only way to use ExifTool to geotag with elevation would be to output the raw NMEA and geotag from that.

- Phil
Title: Re: Inverse geotagging from NextBase dashcam footage
Post by: mjc-506 on March 20, 2020, 11:17:26 AM
That'd be far too simple :-)

Ah, gotcha, sorry. No problem, I can dump the $text# (which includes the GGA) and parse that :-)