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
197 stars 50 forks source link

"TypeError: cannot unpack non-iterable NoneType object" with GoPro 5 videos #25

Closed coldacid closed 1 year ago

coldacid commented 2 years ago

This is happening with all the videos I recorded with my GP5:

Traceback (most recent call last):
  File "C:\Users\chris\AppData\Roaming\Python\Python310\Scripts\gopro2gpx-script.py", line 33, in <module>
    sys.exit(load_entry_point('gopro2gpx==0.1', 'console_scripts', 'gopro2gpx')())
  File "C:\Users\chris\AppData\Roaming\Python\Python310\Scripts\gopro2gpx-script.py", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "C:\Python38\lib\importlib\metadata\__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "C:\Python38\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\gopro2gpx\__main__.py", line 3, in <module>
    main()
  File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\gopro2gpx\gopro2gpx.py", line 148, in main
    data = parser.readFromMP4()
  File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\gopro2gpx\gpmf.py", line 43, in readFromMP4
    track_number, lineinfo = self.ffmtools.getMetadataTrack(self.file)
TypeError: cannot unpack non-iterable NoneType object

Using Python 3.10.4 on Windows 10 21H2 (build 19044.1645), installed gopro2gpx via pip and it grabbed commit dc512cc2544cead643f8a01b442609004ba00f43

clipped-ham commented 2 years ago

Can you run ffprobe on one of your videos and look for the gpmd stream?

I encountered a similar issue as the regex in getMetadataTrack() of ffmpegtools.py wasn't capturing the output ffprobe.

Mine is similar to:

Stream #0:2[0x3](eng): Data: bin_data (gpmd / 0x646D7067), 23 kb/s (default)

A fix may be updating the regex to:

'Stream #\d:(\d)(?:\[0x\d\])?\(.+\): Data: \w+ \(gpmd'

coldacid commented 2 years ago

I had to merge the GPMD streams of multiple videos so I ended up using ffmpeg to produce raw binary files for the GPMD streams and pass those through with the -b option.

juanmcasillas commented 1 year ago

Issue closed.