nvtk_mp42gpx.py revisited – now with TS support

It appears that not only my quick hack of a script is popular but also that the dashcam manufacturers keep changing things.

In this case the biggest change (beyond utterly stupid data obfuscation) is the switch to the TS format.

In retrospect TS format is an obvious choice for something like dashcam as it is very resilient to crashes (no pun intended).

TS format unlike the MP4/MOV format is very simple, it is pretty much made up of fixed 188 byte segments which have ASCII ‘G’ as a header. The actual payload lives in last 184 bytes while the first 4 bytes are reserved for header (of course this is all simplified).

The biggest difficulty of adding TS functionality is that Blueskysea B4K camera was engineered by sadists and they split the payload into two packets (arbitrary cutting off at the seconds 4 bytes). If you are the person at the BlueSkysea who made this obfuscation – fuck you.

In anyway this update is massive rewrite.
Just to make it easy here is the script: nvtk_mp42gpx.py

2020 update of the nvtk_mp42gpx.py script

Surprisingly to me the script that I haphazardly put together turned out to be very popular.
I decided to quickly update it (after multiple feature and bug fixes requests)…

The highlights are:

  • Automatic finding of the correct position of the data block (more on that below).
  • Introduction of -m flag, which creates separete GPX file per input file (default behaviour is a single GPX output file for multiple input files).
  • More robust argument parsing (now it should always display help if wrong arguments are used)
  • Introduction of -d flag, which allows to de-obfuscate GPS coordinates.
Continue reading 2020 update of the nvtk_mp42gpx.py script

Extracting GPS data from Viofo A119 and other Novatek powered cameras

The script.
nvtk_mp42gpx.py
Here it is: nvtk_mp42gpx.py
Alternative version: nvtk_mp42gpx_older.py

What does it do?

This script will attempt to extract GPS data from Novatek MP4 file and output it in GPX format.

Usage: ./nvtk_mp42gpx.py -i<inputfile> -o<outfile> [-f]
        -i input file (will quit if does not exist)
        -o output file (will quit if exists unless overriden)
        -f force (optional, will overwrite output file)

In short: it takes Novatek encoded MP4 file (with embedded GPS data) and extract GPS data in GPX format (as separate file). Note; it does not modify the original MP4 file.

In long:

Continue reading Extracting GPS data from Viofo A119 and other Novatek powered cameras