Help setting up mapillary_tools on Windows

Hello,
As the legacy video uploader is not working I’m trying to use mapillary_tools to upload videos. I’ve downloaded the Windows executable mapillary_tools.exe from GitHub and the checked out the sandbox. When I execute I get the next error. What am I missing?

Traceback (most recent call last):
File “mapillary_tools”, line 6, in
from mapillary_tools import commands
File “c:\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 627, in exec_module
File “mapillary_tools_init_.py”, line 1, in
ModuleNotFoundError: No module named ‘geo’
[10600] Failed to execute script mapillary_tools

2 Likes

Ok, I’ve just seen that you need Python 2.7.x installed and it doesn’t work with more recent versions (I was trying with 3.7.3).

But now I have another question.

When sampling a video --video_sample_interval defines how often get a picture, but, is there any way to sample the video based on distance instead of time? That’s how the legacy video uploader worked and I find it much more interesting for mapping cycling tracks.

No, it uses ffmpeg (sub-process) to decode, which is a time/frame based video processor. Once the jpeg frames exist they are geoencoded and can have duplicate flags set if less than a given distance exists. IME this works well in (say) stop start traffic.

1 Like

So I made mapillary_tools work but now I have another problem. The tool extracts the images from the video correctly, but then it fails to geotag them.

E:\GoPro\2018-09-08\HERO4 Session 1>mapillary_tools video_process --video_import_path GP012756.MP4 --user_name mikelo --advanced --geotag_source gpx --geotag_source_path Move.gpx --use_gps_start_time --offset_time 2  --device_make GoPro --device_model Session4
Extracting video frames:   0%|          | 0/1 [00:00<?, ?it/s]Video sampling path set to E:\GoPro\2018-09-08\HERO4 Session 1\mapillary_sampled_video_frames\GP012756
Traceback (most recent call last):
  File "mapillary_tools", line 76, in <module>
  File "mapillary_tools\commands\video_process.py", line 146, in run
  File "mapillary_tools\process_video.py", line 96, in sample_video
  File "mapillary_tools\process_video.py", line 140, in extract_frames
  File "mapillary_tools\process_video.py", line 214, in get_video_start_time
  File "mapillary_tools\process_video.py", line 158, in get_video_duration
IndexError: list index out of range
[45584] Failed to execute script mapillary_tools

I think the mapillary_tools, at the current state, shouldn’t be recommended to the average user.

I remember seeing issues when I specified an actual file rather than a path spec for the gpx data. I also remember seeing a github enhancement to allow individual naming of mp4 etc files. ie the tools were written to parse entire directories, not individual files.

The help readme,md does say “path/to/xxx”, so maybe put the gpx file in a subfolder?

–geotag_source_path "E:\GoPro\2018-09-08\gpx\

I also tend to leave spaces out of path and file names as they can be seen as command or list delimiters if the script/command being run doesn’t allow for them.

I also note that the GoPro command line spec in the README.md says;

mapillary_tools video_process --import_path “path/to/images” --video_import_path “path/to/videos” --user_name “mapillary_user” --advanced --geotag_source “gopro_videos” --geotag_source_path “path/to/videos” --interpolate_directions --video_sample_interval 0.5 --overwrite_EXIF_gps_tag

I guess reading the gps data from the actual video file? Sorry I dont know GoPro models and their capabilities.

Hello Bob,
I tried putting the files in a directory without spaces and writing the command with it’s path. I get exactly the same error (File “mapillary_tools\process_video.py”, line 158, in get_video_duration). The GoPro Session that I use doesn’t have a GPS, that’s why I have to geotag the photos with a gpx file.
I guess the problem has something to do with ffmpeg. I checked manually that ffprobe extracts all the info from the video correctly, but the python script fails somehow (process_video.py, line 158):

return float(FFProbe(video_file).video[0].duration)

Thank you for your help.

Doubt the following is helpful, but here is;

(I am using Linux)

My ffprobe -show_streams gives maybe 50 lines to stderr and 102 lines to stdout. The duration line reads;

duration=60.092000

for one of my BlackVue vids

The ffprobe function seems quite simple. I wonder if the video filename (argument) is getting through okay?

Is --import_path required?

After decoding the video to jpg’s it writes a single date/time entry to the EXIF. It does the geo-encode after that. Are you seeing the log directories created? Something like E:\GoPro\2018-09-08\HERO4 Session 1\mapillary_sampled_video_frames\GP01275.mapillary\logs\ If so they may add to the debugging info. (.mapillary may have hidden attribute in Windows)

Cheers