extract GPS from Pittasoft Blackvue dashcam?

Started by fmp2a, April 16, 2019, 06:31:10 PM

Previous topic - Next topic

fmp2a

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.

Phil Harvey

I'll take a look at this first thing tomorrow and post back here after I have looked at it.

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

fmp2a

Great!
The leading timestamp seems to be the unix epoch in ms.
Waiting for your next version...
Thanks

Phil Harvey

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! :)
...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

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

fmp2a

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.

Phil Harvey

OK, great.  I'll also extract speed and heading since they are in the RMC sentence.

- 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

ExifTool 11.37 is now available.

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

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


BrackoNe

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:
  • 20220905_104129_AF.mp4
  • 20220905_104225_EF.mp4
  • 20220905_104321_EF.mp4
  • etc.

Thank you in advance!

Phil Harvey

The command should be:

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

And here is the gpx.fmt file that you will need.

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

StarGeek

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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

BrackoNe

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?

Phil Harvey

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