[Bug report] Mapillary_tools commit 1f9cfb6 cannot process GoPro videos

Describe the problem you’re having:

mapillary_tools fail to process GoPro videos sucessfully and throws error message

If possible include steps to reproduce the problem:

  • run mapillary_tools to process multiple GoPro videos with GPS coordinates

Expected behaviour:

  • program should create GPS data in EXIF section of each extracted JPEG file

Observed behaviour:

  • with realease 0.7.2 an error message for each image file was given: “Warning, geotag process failed for image …”

  • after updating to commit 1f9cfb6 the above mentioned warning disappeared and a bunch of multiple error was shown:

Running geotag_process for 2212 images, skipping 0 images.
Traceback (most recent call last):
  File "/usr/local/bin/mapillary_tools", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/__main__.py", line 93, in main
    command.run(args)
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/commands/video_process.py", line 416, in run
    process_geotag_properties(
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/process_geotag_properties.py", line 111, in process_geotag_properties
    geotag_properties = processing.geotag_from_gopro_video(
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/processing.py", line 215, in geotag_from_gopro_video
    gpx_path = gpx_from_gopro(gopro_video)
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/gpx_from_gopro.py", line 73, in gpx_from_gopro
    gopro_data = get_points_from_gpmf(gopro_video)
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/gpx_from_gopro.py", line 44, in get_points_from_gpmf
    gpmf_data = parse_bin(bin_path)
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/gpmf.py", line 113, in parse_bin
    data: bytes = f.read(val_size)
ValueError: read length must be non-negative or -1

Used hardware and software:

  • GoPro Hero 8 Black: capturing FullHD video (1920x1080)
  • mapillary_tools commit 1f9cfb6 running on macOS 10.14
  • used command: mapillary_tools video_process --import_path "IMAGE-PATH" --video_import_path "VIDEO-PATH" --user_name "macsico" --advanced --geotag_source "gopro_videos" --geotag_source_path "VIDEO-PATH" --interpolate_directions --video_sample_interval 1 --overwrite_EXIF_gps_tag

Please provide any additional information below:

  • EXIFTOOL was able to sucessfully extract GPS data from each of the affected MP4 video files into a GPX file. Therefore GPS data is definitely present in each file.

Thanks for your time and your support in advance.

1 Like

Hey @Macsico pushed a fix here fix: unpack bytes at wrong location · mapillary/mapillary_tools@2692b09 · GitHub

Could you update tools with:

python3 -m pip install --upgrade --force-reinstall git+https://github.com/mapillary/mapillary_tools

and then retry again?

Thanks for reporting.

Hey @tao - thanks for the fresh commit.

MTools updated with your command, and retried processing. Sorry, failed again, but with different error message at the end:

Running geotag_process for 2212 images, skipping 0 images.
Traceback (most recent call last):
  File "/usr/local/bin/mapillary_tools", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/__main__.py", line 93, in main
    command.run(args)
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/commands/video_process.py", line 416, in run
    process_geotag_properties(
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/process_geotag_properties.py", line 111, in process_geotag_properties
    geotag_properties = processing.geotag_from_gopro_video(
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/processing.py", line 215, in geotag_from_gopro_video
    gpx_path = gpx_from_gopro(gopro_video)
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/gpx_from_gopro.py", line 73, in gpx_from_gopro
    gopro_data = get_points_from_gpmf(gopro_video)
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/gpx_from_gopro.py", line 44, in get_points_from_gpmf
    gpmf_data = parse_bin(bin_path)
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/gpmf.py", line 116, in parse_bin
    methods[label](data, d, s)
  File "/usr/local/lib/python3.9/site-packages/mapillary_tools/gpmf.py", line 27, in parse_time
    datetime_object = datetime.datetime.strptime(str(toparse), "%y%m%d%H%M%S.%f")
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data "b'210704133929.450'" does not match format '%y%m%d%H%M%S.%f'

Thanks for dealing with the issue.

1 Like

Should be fixed. Let’s follow up here Mapillary_tools cannot process GoPro videos and throws errors · Issue #424 · mapillary/mapillary_tools · GitHub