mapillary / mapillary_tools

Command line tools for processing and uploading Mapillary imagery
BSD 2-Clause "Simplified" License
267 stars 138 forks source link

Import file or directory not found: C:\Users\.....\Downloads\Mapillary Tools\mapillary_sampled_video_frames #596

Closed xdTAGCLAN closed 1 year ago

xdTAGCLAN commented 1 year ago

I am having a problem with geotagging a video with a GPX file

Basic information

Steps to reproduce behavior

I have recorded a video with my Insta360 X3 and I have a .gpx file. Now I am trying to upload it with the command line using this command: mapillary_tools video_process "C:\Users.....\Downloads\Mapillary Tools\VID_20230107_150950_00_235.mp4" --geotag_source "gpx" --geotag_source_path "C:\Users......\Downloads\Mapillary Tools\VID_20230107_150950_00_235.gpx"

Actual behavior

Afterwards I get this error: ERROR - MapillaryFileNotFoundError: Import file or directory not found: C:\Users.....\Downloads\Mapillary Tools\mapillary_sampled_video_frames

Corresponding data

Full Error message: C:\Users.....\Downloads\Mapillary Tools>mapillary_tools video_process "C:\Users.....\Downloads\Mapillary Tools\VID_20230107_150950_00_235.mp4" --geotag_source "gpx" --geotag_source_path "C:\Users.....\Downloads\Mapillary Tools\VID_20230107_150950_00_235.gpx" 2023-02-18 10:44:54,227 - INFO - Extracting video information: ffprobe -print_format json -hide_banner -show_format -show_streams C:\Users.....\Downloads\Mapillary Tools\VID_20230107_150950_00_235.mp4 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users.....e\Downloads\Mapillary Tools\VID_20230107_150950_00_235.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 2023-01-07T14:09:40.000000Z encoder : Lavf58.13.101 Duration: 00:00:56.54, start: 0.000000, bitrate: 121372 kb/s Stream #0:00x1: Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 11520x5760, 121236 kb/s, 24 fps, 24 tbr, 24k tbn (default) Metadata: creation_time : 2023-01-07T14:09:40.000000Z handler_name : VideoHandler vendor_id : [0][0][0][0] Side data: stereo3d: 2D spherical: equirectangular (0.000000/0.000000/0.000000) Stream #0:10x2: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 131 kb/s (default) Metadata: creation_time : 2023-01-07T14:09:40.000000Z handler_name : SoundHandler vendor_id : [0][0][0][0] 2023-02-18 10:44:54,528 - INFO - Extracting video metdata 2023-02-18 10:44:54,530 - WARNING - No GPS data found from the video 2023-02-18 10:44:54,531 - WARNING - Force the option "filetypes" to be "image" to avoid processing and uploading both the video samples and the videos themselves 2023-02-18 10:44:54,531 - WARNING - Since sample geotags have been written in EXIFs when you sampled videos by distance (3.0 meter(s)), so we force the option "geotag_source" to be "exif" to avoid unnecessary geotagging from the videos again 2023-02-18 10:44:54,533 - ERROR - MapillaryFileNotFoundError: Import file or directory not found: C:\Users\gijse\Downloads\Mapillary Tools\mapillary_sampled_video_frames

Does someone know how to fix this?

nickreese commented 1 year ago

I just added the missing folder.

Zaneo commented 1 year ago

@xdTAGCLAN

See #599 I was getting the same error and it was because no frames were being generated due to early exit.

2023-02-18 10:44:54,531 - WARNING - Since sample geotags have been written in EXIFs when you sampled videos by distance (3.0 meter(s)), so we force the option "geotag_source" to be "exif" to avoid unnecessary geotagging from the videos again

This indicates it tried to use distance based sampling, which will of course fail if your video is empty and you are trying to add gps data.

My solution was to switch to time based sampling.

ptpt commented 1 year ago

@Zaneo made the point there. Switching to interval-based sampling can fix the issue:

# add --video_sample_distance=-1 --video_sample_interval=2 to enable interval-based sampling
mapillary_tools video_process YOUR_VIDEO_PATH --video_sample_distance=-1 --video_sample_interval=2 --geotag_source "gpx" --geotag_source_path GPX_PATH

Meanwhile I am fixing it either by adding proper message or default to interval-based sampling when geotag_source is specified.

Thank you!

ptpt commented 1 year ago

Fixed by simply adding the error message "Geotagging from "gpx" works with the legacy interval-based sampling only. To switch back, rerun the command with "--video_sample_distance -1 --video_sample_interval 2". Let me know if it makes sense.

Ideally we should handle this GPX geotagging in sample_video with distance-based sampling but it requires some effort. Maybe next step.