mapillary_tools: errors processing Blackvue videos

MacOS 11.2.3 Python 3.8.1 (inside a python virtual environment) mapillary_tools 0.6.0 Blackvue DR900S-1CH (i believe it has custom Mapillary firmware installed)

I have a folder of 36 .mp4 files from a Blackvue camera in /Users/danbjoseph/Desktop/Record and /Users/danbjoseph/Desktop/Record/images is an empty folder, I want to process locally so that I can use the sampled and geotagged images elsewhere. I realize local sampling is deprecated, but it would be nice to still have it as an option. I run:

mapillary_tools video_process --import_path "/Users/danbjoseph/Desktop/Record/images" \
   --video_import_path "/Users/danbjoseph/Desktop/Record" --user_name "danbjoseph" \
   --advanced --geotag_source "blackvue_videos" --geotag_source_path "/Users/danbjoseph/Desktop/Record" \
   --use_gps_start_time --interpolate_directions --video_sample_interval 0.2 \
   --device_make "Blackvue" --device_model "DR900S-1CH" --overwrite_EXIF_gps_tag

It extracts the video frames and the logs the following error

Extracting video frames:  97%|█████████████████▌| 35/36 [06:18<00:10,  0.09it/s]Video sampling path set to /Users/danbjoseph/Desktop/Record/images/mapillary_sampled_video_frames/20210502_053746_NF
Running user_process for 10320 images, skipping 0 images.                                 
Sub process ended                                                                         
Running import_meta_data_process for 10320 images, skipping 0 images.
Processing image import properties:   0%|                       | 0/10320 [00:00<?, ?it/s]Traceback (most recent call last):
  File "/Users/danbjoseph/Desktop/mapillary_tools/venv/bin/mapillary_tools", line 8, in <module>
    sys.exit(main())
  File "/Users/danbjoseph/Desktop/mapillary_tools/venv/lib/python3.8/site-packages/mapillary_tools/__main__.py", line 93, in main
    command.run(args)
  File "/Users/danbjoseph/Desktop/mapillary_tools/venv/lib/python3.8/site-packages/mapillary_tools/commands/video_process.py", line 406, in run
    process_import_meta_properties(
  File "/Users/danbjoseph/Desktop/mapillary_tools/venv/lib/python3.8/site-packages/mapillary_tools/process_import_meta_properties.py", line 224, in process_import_meta_properties
    finalize_import_properties_process(
  File "/Users/danbjoseph/Desktop/mapillary_tools/venv/lib/python3.8/site-packages/mapillary_tools/process_import_meta_properties.py", line 117, in finalize_import_properties_process
    processing.create_and_log_process(
  File "/Users/danbjoseph/Desktop/mapillary_tools/venv/lib/python3.8/site-packages/mapillary_tools/processing.py", line 1010, in create_and_log_process
    save_json(mapillary_description, log_MAPJson)
  File "/Users/danbjoseph/Desktop/mapillary_tools/venv/lib/python3.8/site-packages/mapillary_tools/processing.py", line 753, in save_json
    f.write(json.dumps(data, indent=4).encode("utf-8"))
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/__init__.py", line 234, in dumps
    return cls(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 201, in encode
    chunks = list(chunks)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

Trying again with a different command:

mapillary_tools process --advanced --import_path "/Users/danbjoseph/Desktop/Record/images" \
   --user_name "danbjoseph" \
   --geotag_source "blackvue_videos" \
   --geotag_source_path "/Users/danbjoseph/Desktop/Record" \
   --overwrite_EXIF_gps_tag
Running user_process for 0 images, skipping 10320 images.
No images to run user process
If the images have already been processed and not yet uploaded, they can be processed again, by passing the argument --rerun
Sub process ended          
Running import_meta_data_process for 10320 images, skipping 0 images.
Sub process ended                                                                                                                                                                                
Running geotag_process for 10320 images, skipping 0 images.
Warning, could not extract gps from video /Users/danbjoseph/Desktop/Record/20210502_033137_NF.mp4 due to a bytes-like object is required, not 'str', video will be skipped...
Error, failed extracting data from blackvue geotag source path /Users/danbjoseph/Desktop/Record/20210502_033137_NF.mp4 due to list index out of range, exiting...
Traceback (most recent call last):
  File "/Users/danbjoseph/Desktop/mapillary_tools/venv/bin/mapillary_tools", line 8, in <module>
    sys.exit(main())
  File "/Users/danbjoseph/Desktop/mapillary_tools/venv/lib/python3.8/site-packages/mapillary_tools/__main__.py", line 93, in main
    command.run(args)
  File "/Users/danbjoseph/Desktop/mapillary_tools/venv/lib/python3.8/site-packages/mapillary_tools/commands/process.py", line 389, in run
    process_geotag_properties(
  File "/Users/danbjoseph/Desktop/mapillary_tools/venv/lib/python3.8/site-packages/mapillary_tools/process_geotag_properties.py", line 121, in process_geotag_properties
    geotag_properties = processing.geotag_from_blackvue_video(
  File "/Users/danbjoseph/Desktop/mapillary_tools/venv/lib/python3.8/site-packages/mapillary_tools/processing.py", line 277, in geotag_from_blackvue_video
    if is_stationary_video:
UnboundLocalError: local variable 'is_stationary_video' referenced before assignment

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments