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

12 thoughts on “nvtk_mp42gpx.py revisited – now with TS support”

    1. Hey,

      I have fixed the script. The Azdome “support” fell through the cracks after numerous updates to the script.
      I have made it python2/3 agnostic as well (the thing showed its age as the Azdome bit of code was python2 specific).
      It is good to see someone using the thing ;).



  1. Thank you very much for providing this. It worked with my A139 Pro flawlessly. I was interested in how accurate the GPS was in the A139 Pro and your code allowed me to determine that it is actually more accurate than my Garmin Nuvi and Garmin 60CSx.
    I appreciate you breaking the proprietary chain on this as I want the raw data to do what I want to do with it rather than someone elses idea of what they think I may want to do with it. Since I’m a Linux user myself I hate having to depend on Winblows programs or Android apps to just get the job done quickly and efficiently.

  2. Hello,
    I am using AZDOME M27 but I get from you script this error message

    Found the ‘moov’ atom.
    GPS data not found in the ‘out.gpx’!

    Do you know by any change what could be the issue ? Thanks in advance and I would really appreciate if you can help me there.

    1. Hello,

      It could be that Azdome changed the structure/signature of their GPS data thus script does not pick it up.
      Typical anticompetitive obfuscation.
      To figure it out I need a sample.

  3. Hello,
    i’m using azdome m550 pro and it either i used the script wrong or they change it , either way it did not work.
    i did not know what are deobfuscate and del outliers and if it’s important for azdome

    could you please fix the issue

    1. Hi, most likely Azdome changed the structure yet again. I will need a sample to figure out what they done.

  4. Recently my Viofo A129 Pro Duo dashcam outputted a file with a date of “2027-00-4294967295T23:43:48Z” which crashed the script. I wanted to be able to use as much as I could from the file so I updated the script like this so it would skip bad records.

    For the end of the get_gps_data(data, deobfuscate) method:
    currentEpoch = convert_to_epoch(gps[‘DT’][‘DT’])
    if currentEpoch == 0:
    return None;
    gps[‘Epoch’] = currentEpoch

    For the convert_to_epoch(datetime) method:
    epoch = 0
    time_struct = time.strptime(datetime[:-1]+’UTC’, “%Y-%m-%dT%H:%M:%S%Z”)
    epoch = int(time.mktime(time_struct))
    print(“Found bad date: ” + datetime)

Leave a Reply

Your email address will not be published. Required fields are marked *