ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: fmp2a on April 16, 2019, 06:31:10 PM

Title: extract GPS from Pittasoft Blackvue dashcam?
Post by: fmp2a on April 16, 2019, 06:31:10 PM
Hi,
I was unable to extract correctly gps data from mp4 movie from my dashcam.
Could you help me?

Here a sample mp4 movie:
https://drive.google.com/open?id=1XtsJQPZMMPsB8BH0hGyrFksW6gLA0Fgc

And here an extract with -v5: exiftool -v5 20190415_121653_EF.mp4
https://drive.google.com/open?id=1laMHLcJq2oAYJ90EZBExMoW806mPwnuZ

We can see some NMEA sentences in tag '-Free': exiftool -U -Free -b 20190415_121653_EF.mp4
https://drive.google.com/open?id=1NXbnSKnJ0vISA9_YP8zMHbsLgMea_Q3k

I would like to extract GPS data and export to a gpx file.

Thanks.
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: Phil Harvey on April 16, 2019, 09:55:41 PM
I'll take a look at this first thing tomorrow and post back here after I have looked at it.

- Phil
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: Phil Harvey on April 17, 2019, 08:12:57 AM
OK, I can see the accelerometer data and GPS log.  The GPS log is text and looks like this (basically an NMEA track log with a leading timestamp of some kind):

[1555330614073]

[1555330614073]$GPGGA,101651.00,4158.08609,N,00845.58707,E,1,07,1.02,142.2,M,46.8,M,,*5E

[1555330614073]$GPGSA,A,3,10,24,12,13,17,19,15,,,,,,1.93,1.02,1.63*02

[1555330614073]$GPGSV,3,1,11,06,02,108,,10,15,293,25,12,54,246,31,13,23,154,25*78

[1555330614073]$GPGSV,3,2,11,15,47,187,34,17,30,051,36,19,45,077,31,20,10,265,16*7C

[1555330614073]$GPGSV,3,3,11,24,76,341,41,25,17,243,,32,01,324,*4C

[1555330614073]$GPGLL,4158.08609,N,00845.58707,E,101651.00,A,A*60

[1555330614073]$GPRMC,101652.00,A,4158.09041,N,00845.58949,E,13.065,26.45,150419,,,A*67

[1555330614073]$GPVTG,26.45,T,,M,13.065,N,24.196,K,A*01[1555330615078]

[1555330615078]$GPGGA,101652.00,4158.09041,N,00845.58949,E,1,08,1.02,142.7,M,46.8,M,,*58

[1555330615078]$GPGSA,A,3,10,20,24,12,13,17,19,15,,,,,1.93,1.02,1.63*00

[1555330615078]$GPGSV,3,1,11,06,02,108,,10,15,293,23,12,54,246,35,13,23,154,25*7A

[1555330615078]$GPGSV,3,2,11,15,47,187,28,17,30,051,39,19,45,077,31,20,10,265,17*7F

[1555330615078]$GPGSV,3,3,11,24,76,341,33,25,17,243,,32,01,324,*49


I can easily extract the whole log in text form, and patch the next version of exiftool to ignore leading garbage before the NMEA sentence so that you can geotag images from this log.  But you would have to use some other utility to convert this to a GPX file unless I do more work to parse this in ExifTool... I'll look into this.

Parsing the accelerometer data is easier, and the result looks like this (excerpt from exiftool -ee -G3 output):

[Doc1]          Time Code                       : 0
[Doc1]          Accelerometer                   : 12.6 1 3.6
[Doc2]          Time Code                       : 0.1
[Doc2]          Accelerometer                   : 11.4 1.6 3.2
[Doc3]          Time Code                       : 0.21
[Doc3]          Accelerometer                   : 13 2.4 3
[Doc4]          Time Code                       : 0.32
[Doc4]          Accelerometer                   : 12 1.8 2.4
...


- Phil
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: fmp2a on April 17, 2019, 08:23:10 AM
Great!
The leading timestamp seems to be the unix epoch in ms.
Waiting for your next version...
Thanks
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: Phil Harvey on April 17, 2019, 08:36:40 AM
Quote from: fmp2a on April 17, 2019, 08:23:10 AM
The leading timestamp seems to be the unix epoch in ms.

Right.  Thanks.  I just figured this out and came back to find that you beat me to it! :)
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: Phil Harvey on April 17, 2019, 08:51:38 AM
I have a working version now that will produce a GPX file with timestamps and lat/lon.  It this good enough?  Extracting stuff like altitude from the other NMEA sentences would be possible, but more work.

- Phil
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: fmp2a on April 17, 2019, 08:59:10 AM
Yes! Gpx with timestamps end lat/long is enough. This is very cool.
Others improvments to handle altitude, heading or accelerometer are welcome but not necessary for now...
Thanks again.
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: Phil Harvey on April 17, 2019, 09:29:03 AM
OK, great.  I'll also extract speed and heading since they are in the RMC sentence.

- Phil
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: Phil Harvey on April 17, 2019, 10:52:44 AM
ExifTool 11.37 is now available.

ExifTool now extracts 27 different formats of streaming GPS from videos.

- Phil
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: fmp2a on April 17, 2019, 01:37:20 PM
works great!
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: BrackoNe on November 16, 2022, 12:37:16 PM
Hi,

I'm new here, and I'm sorry for re-living this thread.

I also have a BlackVue dashcam and downloaded the current 12.50 ExifTool, but I am not sure what command I should type in to get the GPX files from the videos. Can someone help me with that?

Sample file names:

Thank you in advance!
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: Phil Harvey on November 16, 2022, 01:23:24 PM
The command should be:

exiftool -p gpx.fmt -ee FILE > out.gpx

And here is the gpx.fmt file (https://raw.githubusercontent.com/exiftool/exiftool/master/fmt_files/gpx.fmt) that you will need.

- Phil
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: StarGeek on November 16, 2022, 03:51:14 PM
The gpx.fmt needs to be in the current directory or you need to give the full path to the file.  If your gpx file ends up repeating "gpx.fmt" over and over, than you haven't given the correct path to the file.
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: BrackoNe on November 17, 2022, 05:15:44 AM
Quote from: StarGeek on November 16, 2022, 03:51:14 PMThe gpx.fmt needs to be in the current directory or you need to give the full path to the file.  If your gpx file ends up repeating "gpx.fmt" over and over, than you haven't given the correct path to the file.
That is exactly what happened.

Thank you both for your help. I can confirm that I have successfully extracted gpx file. Is it possible to do the batch task, by using *.mp4 for FILE variable?
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: Phil Harvey on November 17, 2022, 07:06:53 AM
Quote from: BrackoNe on November 17, 2022, 05:15:44 AMIs it possible to do the batch task, by using *.mp4 for FILE variable?

Yes.  Or a directory name with -ext mp4 to process only MP4 files in the directory.  And add -r to recursively process subdirectories.

- Phil
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: StarGeek on November 17, 2022, 11:28:59 AM
See Common Mistake #2 (https://exiftool.org/mistakes.html#M2) and the -r (-recurse) option (https://exiftool.org/exiftool_pod.html#r-.--recurse) with regards to wildcards and subdirectories.
Title: Re: extract GPS from Pittasoft Blackvue dashcam?
Post by: BrackoNe on November 17, 2022, 12:32:30 PM
Great! Thank you for your time and help!