juanmcasillas / gopro2gpx

Parse the gpmd stream for GOPRO moov track (MP4) and extract the GPS info into a GPX (and kml) file.
GNU General Public License v3.0
181 stars 50 forks source link

KeyError: 'VPTS' #2

Closed realchrisolin closed 3 years ago

realchrisolin commented 4 years ago
Traceback (most recent call last):
  File "gopro2gpx.py", line 144, in <module>
    data = parser.readFromMP4()
  File "/mnt/c/Users/Chris Olin/gopro2gpx/gpmf.py", line 59, in readFromMP4
    metadata = self.parseStream(metadata_raw)
  File "/mnt/c/Users/Chris Olin/gopro2gpx/gpmf.py", line 98, in parseStream
    klv = KLVData(data,offset)
  File "/mnt/c/Users/Chris Olin/gopro2gpx/klvdata.py", line 32, in __init__
    self.data = fourCC.Manage(self)
  File "/mnt/c/Users/Chris Olin/gopro2gpx/fourCC.py", line 355, in Manage
    return labels[klvdata.fourCC]().Build(klvdata)
KeyError: 'VPTS'

The video used is from the new GoPro MAX, which added a couple new keys to the GPMF spec. VPTS is one, then there's IORI, CORI, and one more I can't remember. I'm pressed for time and can't give much detail. I'll try troubleshooting this and putting in a PR soon if you don't get to it first. GoPro's GPMF repo has details on the new keys.

wolfxl commented 4 years ago

Hi I have the same problem with my gopro 8 black, firmware 1.6. Do you have an update to the code? Really appreciate your great work on this

wavemaking commented 3 years ago

I am a dummy at these libraries. However, just to ignore these errors, and get some output, one can replace:

klv = KLVData(data,offset)

in gpmf.py with

import struct
try:
klv = KLVData(data,offset)
except KeyError:
    print('Could not parse with offset %s', offset)
except struct.error:
    print('Could not parse with offset %s', offset)
except UnicodeDecodeError:
    print('Could not parse with offset %s', offset)
BorisAnthony commented 3 years ago

Hello!

  1. Same issue.
  2. @wavemaking where is "gpmf.py" ?

tia

juanmcasillas commented 3 years ago

Added a fix to handle unknown Labels