mapillary / mapillary_tools

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

Feature request: GPS info from Viofo A139 Pro dashcam videos #619

Closed stefanbj closed 8 months ago

stefanbj commented 1 year ago

Basic information

Steps to reproduce behavior

  1. Process video: python3.exe -m mapillary_tools.commands video_process --skip_process_errors --interpolate_directions .\2023_0516_192739_F.MP4
  2. Verify presence of GPS data: exiftool.exe -p 'C:\Program Files\exiftool\gpx.fmt' -api largefilesupport=1 -ee -ext MP4 -w 2023_0516_192739_F.gpx .\2023_0516_192739_F.MP4

    Expected behavior

  1. The video_process sub-command would extract images with GPS latitude/longitude info.
  2. exiftool do generate uabel .gpx file.

Actual behavior

  1. Processing failure, as the GPS info ins not found ("missing" feature):
> python3.exe -m mapillary_tools.commands video_process  --skip_process_errors --interpolate_directions .\2023_0516_192739_F.MP4
2023-05-20 10:45:36,078 - INFO    - Extracting video information: ffprobe -print_format json -hide_banner -show_format -show_streams 2023_0516_192739_F.MP4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2023_0516_192739_F.MP4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2023-05-16T18:27:39.000000Z
  Duration: 00:00:33.63, start: 0.000000, bitrate: 29720 kb/s
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 3840x2160, 29458 kb/s, 30 fps, 30 tbr, 60k tbn (default)
    Metadata:
      creation_time   : 2023-05-16T19:33:05.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : h264
2023-05-20 10:45:36,211 - INFO    - Extracting video metdata
2023-05-20 10:45:36,214 - **WARNING - No GPS data found from the video**
2023-05-20 10:45:36,214 - WARNING - Force the option "filetypes" to be "image" to avoid processing and uploading both the video samples and the videos themselves
2023-05-20 10:45:36,222 - ERROR   - MapillaryFileNotFoundError: Import file or directory not found: C:\Users\luser\Downloads\mapillary_sampled_video_frames
  1. Verification of GPS data does succeed, and while there are issues, these should not necessarily blocking processing:
Warning: [Minor] Tag 'Main:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Main:gpsdatetime' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc9:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc10:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc11:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc12:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc13:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc14:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc15:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc16:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc17:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc18:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc1:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc19:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc20:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc21:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc22:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc23:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc24:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc25:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc26:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc27:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc28:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc2:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc29:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc30:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc31:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc32:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc33:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc3:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc4:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc5:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc6:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc7:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
Warning: [Minor] Tag 'Doc8:gpsaltitude' not defined - ./2023_0516_192739_F.MP4
    1 output files created

Corresponding data

Additional information

...

stefanbj commented 1 year ago

I have successfully processes a video, after a bit of manipulation of the .MP4 files metadata using exiftool and light editing of the extracted .gpx file; but this a bit too error prone and time consuming for regular uploads.

ptpt commented 1 year ago

@stefanbj thanks for providing the sample videos. We are planning to integrate exiftool and mapillary_tools to ease the processing for the other video formats.

after a bit of manipulation of the .MP4 files metadata using exiftool and light editing of the extracted .gpx file

Could you elaborate how did you manipulate the video files?

stefanbj commented 1 year ago

Sorry, it was very late when I opened the case, and I don't recall what the exactly issues was, but it likely had something correlating the timestamps; could not reproduce the issue today.

Some observations

  1. While I do like exiftool, not everyone have it installed, and it isn't exactly the fastest at processing the video metadata and generating the the .gpx file. Thus I would advise against making it a requirement, but as a fallback it would likely be a great improvement.

  2. exiftool is good, but the current version seems to have a few bugs.

2.1. I believe the first trackpoint in the .gpx file is extracted for the .MP4 header (if available), and while the position seems to be OK, the timestamp never seem to be usable. Specifically for Ricoh Theta X videos, it in local time, that is NOT synchronized with the GPS time for the rest of the trackpoints, thus it useless. (The first trackpoint can be several minutes before the regular 1 second interval gps positions start at the second trackpoint, and G.S.V. refuses imports with this issue.)
The workaround seems to he to hardcode this to be 1 second before the second before the second trackpoint, again specifically this works fine for Ricoh Theta X.

This is not an issue for the Viofo A139 Pro dashcam videos, as these do have a GPS position in the .MP4 header. Unfortunately not all videos have a 1 second GPS intervall, so probably safer to instead just the interval between the second and third trackpoint; specifically GPS interval seems to be configurable on the Viofo dashcams.

2.2. I believe the .gpx file is expected to be in local time, and thus most SW seems to ignore the 'Z' Zulu/Greenwich time zone indication in the timestamps that exiftool adds. (Specifically both G.S.V. has issues with both issues, so .gpx needs to be corrected for both before uploads of videos cut by ffmpeg (e.g. without camm data).) This seems to be an issue with mapillary_tools, as there doesn't seem to be any safe generic way to correlate the absolute times of the video file and .gpx file, a workaround is needed. Would suggest assuming that the video files local time timestamp is within 15 minutes of the correct local time, and then calculate the offset to the second trackpoint in the .gpx file, round this down to even 30 min offset, and then use that offset for any conversion between local time and GPS time in the .gpx file.

  1. Check the interval of the GPS track positions -- and complain loudly if it more then 1 second apart -- if so, it's most likely a configuration in the dashcam fault that user need correct for (power saving feature).

  2. The video file my not have a full set of timestamps, i.e. both local time and GPS time; specifically the Viofo A139 Pro dashcam videos seems to be missing most of the usual metadata attributes in the file header, including the GPS time stamp. So probably safest to verify that the .gpx track has the same length in time as the video file, and ignore the absolute values of time-stamps entirely, and consider instead to do the processing using relative

Recipe

  1. Extract the .gpx data, eg.: exiftool -p 'C:\Program Files\exiftool\gpx.fmt' -api largefilesupport=1 -ee -ext MP4 -w %f/%f.gpx  *.MP4

Example 2:

PS J:\Dashcam\Movie> exiftool.exe  -p 'C:\Program Files\exiftool\gpx.fmt' -api largefilesupport=1 -ee -ext MP4 -w 2023_0527_134513_F.gpx 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc1:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc2:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc11:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc12:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc13:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc14:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc15:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc16:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc17:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc18:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc19:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc20:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc3:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc21:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc22:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc23:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc24:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc25:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc26:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc27:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc28:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc29:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc30:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc4:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc31:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc32:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc33:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc34:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc35:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc36:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc37:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc38:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc39:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc40:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc5:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc41:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc42:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc43:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc6:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc7:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc8:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc9:gpsaltitude' not defined - 2023_0527_134513_F.MP4
Warning: [Minor] Tag 'Doc10:gpsaltitude' not defined - 2023_0527_134513_F.MP4
    1 output files created
PS J:\Dashcam\Movie>

 

  1. Edit and convert the .gpx file to local time; In my case adding 1 hour to the timestamps to convert from Zulu to CET TZ seems to work.

  2. Process the video:

PS J:\Dashcam\Movie> python3.exe -m mapillary_tools.commands --verbose video_process --rerun  --video_sample_distance -1 --video_sample_interval 1 --duplicate_distance 3 --overwrite_all_EXIF_tags  --interpolate_directions --skip_process_errors --geotag_source gpx --geotag_source_path  .\2023_0527_111351_F\2023_0527_111351_F_d2.gpx .\2023_0527_111351_F.MP4
2023-05-27 20:58:15,116 - DEBUG   - mapillary_tools version 0.10.0.git
2023-05-27 20:58:15,117 - DEBUG   - CLI param: verbose: True
2023-05-27 20:58:15,117 - DEBUG   - CLI param: video_import_path: 2023_0527_111351_F.MP4
2023-05-27 20:58:15,118 - DEBUG   - CLI param: video_sample_distance: -1.0
2023-05-27 20:58:15,118 - DEBUG   - CLI param: video_sample_interval: 1.0
2023-05-27 20:58:15,118 - DEBUG   - CLI param: video_duration_ratio: 1.0
2023-05-27 20:58:15,118 - DEBUG   - CLI param: skip_subfolders: False
2023-05-27 20:58:15,118 - DEBUG   - CLI param: rerun: True
2023-05-27 20:58:15,118 - DEBUG   - CLI param: skip_sample_errors: False
2023-05-27 20:58:15,118 - DEBUG   - CLI param: skip_process_errors: True
2023-05-27 20:58:15,118 - DEBUG   - CLI param: filetypes: image, gopro, camm, blackvue
2023-05-27 20:58:15,118 - DEBUG   - CLI param: overwrite_all_EXIF_tags: True
2023-05-27 20:58:15,119 - DEBUG   - CLI param: overwrite_EXIF_time_tag: False
2023-05-27 20:58:15,119 - DEBUG   - CLI param: overwrite_EXIF_gps_tag: False
2023-05-27 20:58:15,119 - DEBUG   - CLI param: overwrite_EXIF_direction_tag: False
2023-05-27 20:58:15,119 - DEBUG   - CLI param: overwrite_EXIF_orientation_tag: False
2023-05-27 20:58:15,119 - DEBUG   - CLI param: add_file_name: False
2023-05-27 20:58:15,119 - DEBUG   - CLI param: add_import_date: False
2023-05-27 20:58:15,119 - DEBUG   - CLI param: geotag_source: gpx
2023-05-27 20:58:15,119 - DEBUG   - CLI param: geotag_source_path: 2023_0527_111351_F\2023_0527_111351_F_d2.gpx
2023-05-27 20:58:15,119 - DEBUG   - CLI param: interpolation_use_gpx_start_time: False
2023-05-27 20:58:15,120 - DEBUG   - CLI param: interpolation_offset_time: 0.0
2023-05-27 20:58:15,120 - DEBUG   - CLI param: offset_angle: 0.0
2023-05-27 20:58:15,120 - DEBUG   - CLI param: offset_time: 0.0
2023-05-27 20:58:15,120 - DEBUG   - CLI param: cutoff_distance: 600.0
2023-05-27 20:58:15,120 - DEBUG   - CLI param: cutoff_time: 60.0
2023-05-27 20:58:15,120 - DEBUG   - CLI param: interpolate_directions: True
2023-05-27 20:58:15,120 - DEBUG   - CLI param: duplicate_distance: 3.0
2023-05-27 20:58:15,120 - DEBUG   - CLI param: duplicate_angle: 5.0
2023-05-27 20:58:15,123 - INFO    - Removing the sample directory J:\Dashcam\Movie\mapillary_sampled_video_frames\2023_0527_111351_F.MP4
2023-05-27 20:58:15,191 - INFO    - Extracting video information: ffprobe -print_format json -hide_banner -show_format -show_streams 2023_0527_111351_F.MP4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2023_0527_111351_F.MP4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2023-05-27T11:59:47.000000Z
  Duration: 00:01:32.40, start: 0.000000, bitrate: 29580 kb/s
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 3840x2160, 29358 kb/s, 30 fps, 30 tbr, 60k tbn (default)
    Metadata:
      creation_time   : 2023-05-27T11:59:47.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : h264
2023-05-27 20:58:15,332 - DEBUG   - Extracted video duration: 92.400000
2023-05-27 20:58:15,332 - DEBUG   - Extracted video creation time: 2023-05-27T11:59:47.000000Z
2023-05-27 20:58:15,337 - INFO    - Extracting frames: ffmpeg -hide_banner -nostdin -i 2023_0527_111351_F.MP4 -vf fps=1/1.0 -qscale:v 2 J:\Dashcam\Movie\mapillary_sampled_video_frames\.mly_ffmpeg_2023_0527_111351_F.MP4_1992_1685213895\2023_0527_111351_F_NA_%06d.jpg
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2023_0527_111351_F.MP4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2023-05-27T11:59:47.000000Z
  Duration: 00:01:32.40, start: 0.000000, bitrate: 29580 kb/s
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 3840x2160, 29358 kb/s, 30 fps, 30 tbr, 60k tbn (default)
    Metadata:
      creation_time   : 2023-05-27T11:59:47.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : h264
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Output #0, image2, to 'J:\Dashcam\Movie\mapillary_sampled_video_frames\.mly_ffmpeg_2023_0527_111351_F.MP4_1992_1685213895\2023_0527_111351_F_NA_%06d.jpg':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    encoder         : Lavf59.27.100
  Stream #0:0(eng): Video: mjpeg, yuvj420p(pc, bt709, progressive), 3840x2160, q=2-31, 200 kb/s, 1 fps, 1 tbn (default)
    Metadata:
      creation_time   : 2023-05-27T11:59:47.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.37.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame=   92 fps=4.2 q=2.0 Lsize=N/A time=00:01:32.00 bitrate=N/A speed=4.24x
video:98721kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
2023-05-27 20:58:38,091 - WARNING - Force the option "filetypes" to be "image" to avoid processing and uploading both the video samples and the videos themselves
2023-05-27 20:58:38,586 - DEBUG   - Final time offset for interpolation: 0.0
The image time is 0.6 seconds beyond the GPX end point
The image time is 1.6 seconds beyond the GPX end point
The image time is 2.6 seconds beyond the GPX end point
The image time is 3.6 seconds beyond the GPX end point
The image time is 4.6 seconds beyond the GPX end point
The image time is 5.6 seconds beyond the GPX end point
The image time is 6.6 seconds beyond the GPX end point
The image time is 7.6 seconds beyond the GPX end point
The image time is 8.6 seconds beyond the GPX end point
The image time is 9.6 seconds beyond the GPX end point
The image time is 10.6 seconds beyond the GPX end point
The image time is 11.6 seconds beyond the GPX end point
2023-05-27 20:58:38,756 - INFO    - Check the description file for details: J:\Dashcam\Movie\mapillary_sampled_video_frames\mapillary_image_description.json
2023-05-27 20:58:38,756 - INFO    -       92 image(s) read in total
2023-05-27 20:58:38,757 - INFO    -             4 image(s) are ready to be uploaded
2023-05-27 20:58:38,757 - WARNING -            12 image(s) skipped due to MapillaryOutsideGPXTrackError
2023-05-27 20:58:38,757 - WARNING -            76 image(s) skipped due to MapillaryDuplicationError
PS J:\Dashcam\Movie>
stefanbj commented 1 year ago

A longer example file, demonstrating the 1 minute GPS intervall issue:

This also seem to be a image time offset problem, so all 42 images are 366 seconds beyond the GPX end point...

Think this was accidentally captured in timelapse mode, in theory this should be fine as the velocity is ignored, but the infrequent GPS positions is an issue - a 1 minute interval isn't really useful for mapping at highway speeds...

stefanbj commented 1 year ago

A few more (low bitrate) sample videos to Viofo139, in case this would be useful for verification.

stefanbj commented 1 year ago

Tried to see if I could find a way to generate and read the .gpx file, as a pathfinder, and this worked sort of, see:

Also noted that some seemingly related work has been done in the feature branch:

Output example, from a test run:

$ python3.exe -d -m mapillary_tools.commands video_process --rerun K:/Dashcam/2023-06-01/Movie/RO/2023_0601_063550_F.MP4 2023_0601_063550_F
2023-06-02 19:38:20,337 - INFO    - Removing the sample directory 2023_0601_063550_F\2023_0601_063550_F.MP4
2023-06-02 19:38:20,338 - INFO    - Extracting video information: ffprobe -print_format json -hide_banner -show_format -show_streams K:\Dashcam\2023-06-01\Movie\RO\2023_0601_063550_F.MP4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'K:\Dashcam\2023-06-01\Movie\RO\2023_0601_063550_F.MP4':
[[...]]
2023-06-02 19:38:20,382 - INFO    - Extracting video metdata
2023-06-02 19:38:20,384 - INFO    - Attempting to extracting video metdata using exiftool
2023-06-02 19:38:20,384 - INFO    - C:extract_camera_model file : K:\Dashcam\2023-06-01\Movie\RO\2023_0601_063550_F.MP4
2023-06-02 19:38:20,384 - INFO    - Videofile as .gpx source : K:\Dashcam\2023-06-01\Movie\RO\2023_0601_063550_F.MP4
2023-06-02 19:38:20,385 - INFO    - File to create gpx : K:\Dashcam\2023-06-01\Movie\RO\2023_0601_063550_F.gpx.tmp
12.55
2023-06-02 19:38:20,781 - INFO    - The exiftool command OK: exiftool
2023-06-02 19:38:20,784 - INFO    - formatfile file is: 'C:\cygwin64\tmp\gpx.fmt_4x9090oy.tmp'
2023-06-02 19:38:20,873 - INFO    - Creating .GPX file : exiftool -p C:\cygwin64\tmp\gpx.fmt_4x9090oy.tmp -api largefilesupport=1 -ee -w %d/%f.gpx.tmp K:\Dashcam\2023-06-01\Movie\RO\2023_0601_063550
_F.MP4
Warning: [Minor] Tag 'Doc1:gpsaltitude' not defined - K:/Dashcam/2023-06-01/Movie/RO/2023_0601_063550_F.MP4
Warning: [Minor] Tag 'Doc2:gpsaltitude' not defined - K:/Dashcam/2023-06-01/Movie/RO/2023_0601_063550_F.MP4
Warning: [Minor] Tag 'Doc11:gpsaltitude' not defined - K:/Dashcam/2023-06-01/Movie/RO/2023_0601_063550_F.MP4
Warning: [Minor] Tag 'Doc101:gpsaltitude' not defined - K:/Dashcam/2023-06-01/Movie/RO/2023_0601_063550_F.MP4
[[...]]
Warning: [Minor] Tag 'Doc100:gpsaltitude' not defined - K:/Dashcam/2023-06-01/Movie/RO/2023_0601_063550_F.MP4
    1 output files created
2023-06-02 19:38:23,503 - INFO    - Found total 230 GPS points
2023-06-02 19:38:23,503 - INFO    - Extracting video samples
2023-06-02 19:38:23,505 - INFO    - Extracting video samples
2023-06-02 19:38:23,554 - INFO    - Found total 6913 video samples
2023-06-02 19:38:23,554 - INFO    - Interpolating video samples in the time range from 1685597748.0 to 1685597977.0
2023-06-02 19:38:23,557 - INFO    - Found total 0 interpolated video samples
2023-06-02 19:38:23,557 - INFO    - Selected 0 video samples by the minimal sample distance 3.0
2023-06-02 19:38:23,562 - WARNING - Force the option "filetypes" to be "image" to avoid processing and uploading both the video samples and the videos themselves
Extracting geotags from images: 0images [00:00, ?images/s]
2023-06-02 19:38:23,779 - INFO    - Validating 0 metadatas
2023-06-02 19:38:23,779 - INFO    - Checking upload status for 0 metadatas
2023-06-02 19:38:23,780 - INFO    - Check the description file for details: 2023_0601_063550_F\mapillary_image_description.json
ptpt commented 1 year ago

Thanks for providing all the useful samples and information.

The branch feat-exiftool-parsing is mainly focus on parsing exiftool XML outuput for images.

For videos, it's coming soon in another branch. Hopefully, you will process all images/videos with this workflow

exiftool -X -n -ee -r -api LargeFileSupport=1 videos/ > exiftool_output.xml

# local sampling
mapillary_tools video_process --geotag_source=exiftool --geotag_source_path=exiftool_output.xml videos/

# or directly process and upload
mapillary_tools process_and_upload --geotag_source=exiftool --geotag_source_path=exiftool_output.xml videos/

Let me know if it makes things easier.

ptpt commented 1 year ago

BTW You can manually align the video sample timestamps and the GPS track timestamps with these parameters in the process command:

  --interpolation_use_gpx_start_time
                        If supplied, the first image will use the first GPX point time for interpolation, which means the image location will be interpolated to the first GPX point too. Only works for geotagging from gpx, gopro_videos, nmea, blackvue_videos, camm.
  --interpolation_offset_time INTERPOLATION_OFFSET_TIME
                        Time offset, in seconds, that will be added for GPX interpolation, which affects image locations. Note that it is applied after --interpolation_use_gpx_start_time. Only works for geotagging from gpx, gopro_videos, nmea, blackvue_videos, camm. [default 0.0]
stefanbj commented 1 year ago

I'm sure I could make that work; in fact I think it would be very good to have that option, as I have found a few videos where the recorded orientation most likely isn't correct - and this would likely make it easier to resolve/workaround that issue.

However feel equally sure most users would prefer a solution that can be more easily memorized, and doesn't require copy&pasting from the manual each time they start over. Unfortunately many user tend to give up if things don't work more or less immediately out of the box, e.g. people that have just figured out that the Desktop uploader does not work for their use case... (As a "former" engineer, I tend to be surprised by how much ease of use matters in practice, and how much that changes from person to person and thus the amount of support needed.)

ptpt commented 1 year ago

Try out the latest alpha https://github.com/mapillary/mapillary_tools/releases/tag/v0.10.3a

Here is the workflow:

exiftool -r -n -ee -api LargeFileSupport=1 -X Viofo139_videos > /tmp/Viofo139.xml
mapillary_tools video_process Viofo139_videos /tmp/Viofo139_samples \
    --geotag_source exiftool \
    --geotag_source_path /tmp/Viofo139.xml \
    --video_sample_distance -1 \
    --video_sample_interval 2

2023-06-12 11:17:31,931 - INFO    - Checking upload status for 469 metadatas
2023-06-12 11:17:31,970 - INFO    - Check the description file for details: /tmp/Viofo139_samples/mapillary_image_description.json
2023-06-12 11:17:31,970 - INFO    -      469 image(s) read in total
2023-06-12 11:17:31,970 - INFO    -           441 image(s) are ready to be uploaded
2023-06-12 11:17:31,970 - ERROR   -             1 image(s) failed due to MapillaryOutsideGPXTrackError
2023-06-12 11:17:31,970 - WARNING -            27 image(s) skipped due to MapillaryDuplicationError
2023-06-12 11:17:31,970 - ERROR   - MapillaryProcessError: Failed to process 1 files. To skip these errors, specify --skip_process_errors

Alternatively, you can just process the videos for directly uploading them later:

mapillary_tools process Viofo139_videos \
    --geotag_source exiftool \
    --geotag_source_path /tmp/Viofo139.xml

Extracting geotags from ExifTool XML: 0images [00:00, ?images/s]
Extracting GPS tracks from ExifTool XML: 0videos [00:00, ?videos/s]
Extracting GPS tracks from ExifTool XML: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 19/19 [00:01<00:00, 13.21videos/s]
2023-06-12 11:22:50,154 - INFO    - Validating 19 metadatas
2023-06-12 11:22:50,262 - INFO    - Checking upload status for 19 metadatas
2023-06-12 11:22:50,272 - INFO    - Check the description file for details: /tmp/image.json
2023-06-12 11:22:50,272 - INFO    -       19 video(s) read in total
2023-06-12 11:22:50,272 - INFO    -            19 video(s) are ready to be uploaded
stefanbj commented 1 year ago

Alternative seems to work, if the --skip_process_errors option is used, which does not seem to be the wanted default solution:

Tested with: commit f3c98bdfb46a7df29d8ce8283a4c0fee29d8e185 (HEAD, tag: v0.10.5, origin/main, origin/HEAD) Test file: https://drive.google.com/file/d/1xtH88H-Kq2259kyx8kZc-lmSBv1rAfWh/view?usp=drive_link 1.16 GB

$ exiftool -r -n -ee -api LargeFileSupport=1 -X K:/Dashcam/2023-07-22 > K:/Dashcam/2023-07-22/Viofo139.xml
    3 directories scanned
 1073 image files read

...
$ python3.exe -m mapillary_tools.commands video_process  K:/Dashcam/2023-07-22/2023_0721_080836_F.MP4 D:/Viofo139_0722     --geotag_source exiftool     --geotag_source_path K:/Dashcam/2023-07-22/Viofo139.xml --video_sample_distance -1 --video_sample_interval 2  --skip_process_errors
2023-07-23 05:13:57,043 - WARNING - Skip sampling video 2023_0721_080836_F.MP4 as it has been sampled in D:\Viofo139_0722\2023_0721_080836_F.MP4. Specify --rerun to resample it
2023-07-23 05:13:57,043 - WARNING - Force the option "filetypes" to be "image" to avoid processing and uploading both the video samples and the videos themselves
Extracting geotags from ExifTool XML:   0%|                                                                                                  | 0/150 [00:00<?, ?images/s]
Extracting GPS tracks from ExifTool XML: 100%|█████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:02<00:00,  2.97s/videos]
Interpolating 2023_0721_080836_F.MP4: 100%|███████████████████████████████████████████████████████████████████████████████████████| 150/150 [00:01<00:00, 141.09images/s]
Validating metadatas: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████| 150/150 [00:00<00:00, 254.23metadata/s]
2023-07-23 05:14:06,870 - INFO    - Checking upload status for 150 metadatas
2023-07-23 05:14:06,940 - INFO    - Check the description file for details: D:\Viofo139_0722\mapillary_image_description.json
2023-07-23 05:14:06,941 - INFO    -      150 image(s) read in total
2023-07-23 05:14:06,941 - INFO    -           128 image(s) are ready to be uploaded
2023-07-23 05:14:06,941 - WARNING -            11 image(s) skipped due to MapillaryOutsideGPXTrackError
2023-07-23 05:14:06,942 - WARNING -            11 image(s) skipped due to MapillaryDuplicationError

ALso tried the "video_process_and_upload" option:

$ python3.exe -m mapillary_tools.commands video_process_and_upload --user_name bruno360   --interpolate_directions   K:/Dashcam/2023-07-22/tmp/2023_0721_080836_F.MP4 D:/Dashcam/tmp/2023_0721_080836_F --geotag_source exiftool     --geotag_source_path K:/Dashcam/2023-07-22/Viofo139.xml --video_sample_distance -1 --video_sample_interval 2 --skip_process_errors

Unfortunately there seems to be a mix up with the input-and output paths, so this fails with:

2023-07-23 05:52:55,828 - INFO    - Extracting video information: ffprobe -print_format json -hide_banner -show_format -show_streams K:\Dashcam\2023-07-22\tmp\2023_0721_0
80836_F.MP4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'K:\Dashcam\2023-07-22\tmp\2023_0721_080836_F.MP4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2023-07-21T08:13:37.000000Z
  Duration: 00:05:00.00, start: 0.000000, bitrate: 33151 kb/s
  Stream #0:0[0x1](eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 3840x2160, 32769 kb/s, 30 fps, 30 tbr, 60k tbn (default)
    Metadata:
      creation_time   : 2023-07-21T08:13:37.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 64 kb/s (default)
    Metadata:
      creation_time   : 2023-07-21T08:13:37.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
2023-07-23 05:52:55,879 - INFO    - Extracting frames: ffmpeg -hide_banner -nostdin -i K:\Dashcam\2023-07-22\tmp\2023_0721_080836_F.MP4 -vf fps=1/2.0 -qscale:v 2 D:\Dashc
am\tmp\2023_0721_080836_F\.mly_ffmpeg_2023_0721_080836_F.MP4_17404_1690087975\2023_0721_080836_F_NA_%06d.jpg
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'K:\Dashcam\2023-07-22\tmp\2023_0721_080836_F.MP4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2023-07-21T08:13:37.000000Z
  Duration: 00:05:00.00, start: 0.000000, bitrate: 33151 kb/s
  Stream #0:0[0x1](eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 3840x2160, 32769 kb/s, 30 fps, 30 tbr, 60k tbn (default)
    Metadata:
      creation_time   : 2023-07-21T08:13:37.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 64 kb/s (default)
    Metadata:
      creation_time   : 2023-07-21T08:13:37.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> mjpeg (native))
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 000001d3986eb240] New audio stream with index 1 at pos:1384596 and DTS:0s
Output #0, image2, to 'D:\Dashcam\tmp\2023_0721_080836_F\.mly_ffmpeg_2023_0721_080836_F.MP4_17404_1690087975\2023_0721_080836_F_NA_%06d.jpg':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    encoder         : Lavf60.5.100
  Stream #0:0(eng): Video: mjpeg, yuvj420p(pc, bt709, progressive), 3840x2160, q=2-31, 200 kb/s, 0.50 fps, 0.50 tbn (default)
    Metadata:
      creation_time   : 2023-07-21T08:13:37.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.14.101 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
[out#0/image2 @ 000001d398726fc0] video:209241kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
frame=  150 fps=1.2 q=2.0 Lsize=N/A time=00:04:58.00 bitrate=N/A speed=2.39x
2023-07-23 05:55:01,472 - WARNING - Force the option "filetypes" to be "image" to avoid processing and uploading both the video samples and the videos themselves
Extracting geotags from ExifTool XML:   0%|                                                                                                  | 0/150 [00:00<?, ?images/s]
Extracting GPS tracks from ExifTool XML:   0%|                                                                                                 | 0/1 [00:00<?, ?videos/s]
Failed to geotag video K:\Dashcam\2023-07-22\2023_0721_080836_F.MP4: [Errno 2] No such file or directory: 'K:\\Dashcam\\2023-07-22\\2023_0721_080836_F.MP4'
Extracting GPS tracks from ExifTool XML: 100%|█████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  3.62videos/s]
Validating metadatas: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 150/150 [00:00<?, ?metadata/s]
2023-07-23 05:55:06,902 - INFO    - Checking upload status for 150 metadatas
2023-07-23 05:55:06,902 - INFO    -      150 image(s) read in total
2023-07-23 05:55:06,903 - WARNING -           150 image(s) skipped due to FileNotFoundError
2023-07-23 05:55:06,970 - INFO    - Nothing uploaded. Bye.

The "process" alternative seems to want to upload the raw .MP4 file (which will likely be slower then to process and uploaded the selected images); and then I just don't see the point of using mapillary_tools for most users -- would likely be better to simply offer upload of .MP4 files in the web-front-end...

Also interrupting the process doesn't work correctly on windows/cygwin -- it gets tuck in some kind of limbo state:

$ python3.exe -m mapillary_tools.commands process  K:/Dashcam/2023-07-22/tmp/2023_0721_080836_F.MP4     --geotag_source exiftool     --geotag_source_path K:/Dashcam/2023-07-22/tmp/Viofo139.xml
Extracting geotags from ExifTool XML: 0images [00:00, ?images/s]
Extracting GPS tracks from ExifTool XML: 0videos [00:00, ?videos/s]
Extracting GPS tracks from ExifTool XML:   0%|                                                                                                 | 0/1 [00:00<?, ?videos/s]P
rocess SpawnPoolWorker-24:
Process SpawnPoolWorker-23:
Process SpawnPoolWorker-22:
Process SpawnPoolWorker-21:
Process SpawnPoolWorker-20:
Process SpawnPoolWorker-19:
Process SpawnPoolWorker-18:
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\pool.py", line 114, in worker
    task = get()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\queues.py", line 364, in get
    with self._rlock:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\pool.py", line 114, in worker
    task = get()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\pool.py", line 114, in worker
    task = get()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\pool.py", line 114, in worker
    task = get()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\pool.py", line 114, in worker
    task = get()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\pool.py", line 114, in worker
    task = get()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\pool.py", line 114, in worker
    task = get()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\synchronize.py", line 95, in __enter__
    return self._semlock.__enter__()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\queues.py", line 364, in get
    with self._rlock:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\queues.py", line 364, in get
    with self._rlock:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\queues.py", line 364, in get
    with self._rlock:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\queues.py", line 364, in get
    with self._rlock:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\queues.py", line 364, in get
    with self._rlock:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\queues.py", line 365, in get
    res = self._reader.recv_bytes()
KeyboardInterrupt
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\synchronize.py", line 95, in __enter__
    return self._semlock.__enter__()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\synchronize.py", line 95, in __enter__
    return self._semlock.__enter__()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\synchronize.py", line 95, in __enter__
    return self._semlock.__enter__()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\synchronize.py", line 95, in __enter__
    return self._semlock.__enter__()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\synchronize.py", line 95, in __enter__
    return self._semlock.__enter__()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\connection.py", line 216, in recv_bytes
    buf = self._recv_bytes(maxlength)
KeyboardInterrupt
KeyboardInterrupt
KeyboardInterrupt
KeyboardInterrupt
KeyboardInterrupt
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\connection.py", line 305, in _recv_bytes
    waitres = _winapi.WaitForMultipleObjects(
KeyboardInterrupt
Process SpawnPoolWorker-17:
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "C:\Users\stefanb\Desktop\OUTDIR\mt\mapillary_tools\mapillary_tools\geotag\geotag_videos_from_exiftool_video.py", line 76, in geotag_video
    video_metadata.update_md5sum()
  File "C:\Users\stefanb\Desktop\OUTDIR\mt\mapillary_tools\mapillary_tools\types.py", line 93, in update_md5sum
    self.md5sum = utils.md5sum_fp(fp).hexdigest()
  File "C:\Users\stefanb\Desktop\OUTDIR\mt\mapillary_tools\mapillary_tools\utils.py", line 15, in md5sum_fp
    buf = fp.read(1024 * 1024 * 32)
KeyboardInterrupt
stefanbj commented 8 months ago

Uploading 'A138 videos using the new Mapillary Uploader seems to work fine, so seems the feature as such is working as is should. (Thanks, much appreciated.)

Unfortunately I'm having less luck with getting the New video geotagging features interface working, to verify this from the command line, and the trackbacks are not exactly helpful w.r.t. understating what I'm (most likely) doing incorrectly...

  1. gpx source, implicit pattern:
PS I:\Dashcam\2023-07-28> exiftool -ver
12.55
PS I:\Dashcam\2023-07-28> python.exe -m mapillary_tools.commands --version
mapillary_tools version 0.11.1
PS I:\Dashcam\2023-07-28> ls  2023_0728_111630_F.*

    Directory: I:\Dashcam\2023-07-28

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        2024-01-08     01:23          30791 2023_0728_111630_F.gpx
-a----        2023-07-28     11:21     1243169655 2023_0728_111630_F.MP4

PS I:\Dashcam\2023-07-28> ls D:/Bilder/tmp/2023_0728_111630_F

    Directory: D:\Bilder\tmp\2023_0728_111630_F

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        2024-01-08     01:03          30791 2023_0728_111630_F.gpx

PS I:\Dashcam\2023-07-28> python.exe -m mapillary_tools.commands --verbose video_process_and_upload --user_name bruno360 --video_geotag_source gpx --interpolate_directions 2023_0728_111630_F.MP4 D:/Bilder/tmp/2023_0728_111630_F
2024-01-08 08:17:40,319 - DEBUG   - mapillary_tools version 0.11.1
2024-01-08 08:17:40,319 - DEBUG   - CLI param: verbose: True
2024-01-08 08:17:40,320 - DEBUG   - CLI param: video_import_path: 2023_0728_111630_F.MP4
2024-01-08 08:17:40,321 - DEBUG   - CLI param: import_path: D:\Bilder\tmp\2023_0728_111630_F
2024-01-08 08:17:40,322 - DEBUG   - CLI param: video_sample_distance: 3.0
2024-01-08 08:17:40,323 - DEBUG   - CLI param: video_sample_interval: -1.0
2024-01-08 08:17:40,323 - DEBUG   - CLI param: video_duration_ratio: 1.0
2024-01-08 08:17:40,324 - DEBUG   - CLI param: skip_subfolders: False
2024-01-08 08:17:40,324 - DEBUG   - CLI param: rerun: False
2024-01-08 08:17:40,324 - DEBUG   - CLI param: skip_sample_errors: False
2024-01-08 08:17:40,325 - DEBUG   - CLI param: skip_process_errors: False
2024-01-08 08:17:40,325 - DEBUG   - CLI param: overwrite_all_EXIF_tags: False
2024-01-08 08:17:40,326 - DEBUG   - CLI param: overwrite_EXIF_time_tag: False
2024-01-08 08:17:40,326 - DEBUG   - CLI param: overwrite_EXIF_gps_tag: False
2024-01-08 08:17:40,326 - DEBUG   - CLI param: overwrite_EXIF_direction_tag: False
2024-01-08 08:17:40,327 - DEBUG   - CLI param: overwrite_EXIF_orientation_tag: False
2024-01-08 08:17:40,327 - DEBUG   - CLI param: add_file_name: False
2024-01-08 08:17:40,327 - DEBUG   - CLI param: add_import_date: False
2024-01-08 08:17:40,329 - DEBUG   - CLI param: geotag_source: exif
2024-01-08 08:17:40,330 - DEBUG   - CLI param: video_geotag_source: gpx
2024-01-08 08:17:40,330 - DEBUG   - CLI param: interpolation_use_gpx_start_time: False
2024-01-08 08:17:40,330 - DEBUG   - CLI param: interpolation_offset_time: 0.0
2024-01-08 08:17:40,331 - DEBUG   - CLI param: offset_angle: 0.0
2024-01-08 08:17:40,333 - DEBUG   - CLI param: offset_time: 0.0
2024-01-08 08:17:40,333 - DEBUG   - CLI param: cutoff_distance: 600.0
2024-01-08 08:17:40,333 - DEBUG   - CLI param: cutoff_time: 60.0
2024-01-08 08:17:40,333 - DEBUG   - CLI param: interpolate_directions: True
2024-01-08 08:17:40,334 - DEBUG   - CLI param: duplicate_distance: 0.1
2024-01-08 08:17:40,334 - DEBUG   - CLI param: duplicate_angle: 5.0
2024-01-08 08:17:40,335 - DEBUG   - CLI param: filetypes: blackvue, camm, gopro, image, video
2024-01-08 08:17:40,335 - DEBUG   - CLI param: user_name: bruno360
2024-01-08 08:17:40,335 - DEBUG   - CLI param: dry_run: False
2024-01-08 08:17:40,338 - INFO    - Extracting video information: ffprobe -print_format json -hide_banner -show_format -show_streams 2023_0728_111630_F.MP4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2023_0728_111630_F.MP4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2023-07-28T11:21:30.000000Z
  Duration: 00:05:00.00, start: 0.000000, bitrate: 33151 kb/s
  Stream #0:0[0x1](eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 3840x2160, 32768 kb/s, 30 fps, 30 tbr, 60k tbn (default)
    Metadata:
      creation_time   : 2023-07-28T11:21:30.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 64 kb/s (default)
    Metadata:
      creation_time   : 2023-07-28T11:21:30.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
2024-01-08 08:17:40,392 - DEBUG   - Extracted video duration: 300.000000
2024-01-08 08:17:40,394 - DEBUG   - Extracted video creation time: 2023-07-28T11:21:30.000000Z
2024-01-08 08:17:40,399 - INFO    - Extracting video metdata
2024-01-08 08:17:40,401 - WARNING - Failed to geotag video 2023_0728_111630_F.MP4: No GPS data found from the video
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\geotag\geotag_videos_from_video.py", line 155, in geotag_video
    raise exceptions.MapillaryVideoError("No GPS data found from the video")
mapillary_tools.exceptions.MapillaryVideoError: No GPS data found from the video
2024-01-08 08:17:40,401 - WARNING - No GPS data found from the video
2024-01-08 08:17:40,402 - WARNING - Force the option "filetypes" to be "image" to avoid processing and uploading both the video samples and the videos themselves
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\__main__.py", line 177, in <module>
    main()
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\__main__.py", line 168, in main
    args.func(argvars)
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\video_process_and_upload.py", line 18, in run
    VideoProcessCommand().run(args)
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\video_process.py", line 31, in run
    ProcessCommand().run(args)
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\process.py", line 270, in run
    metadatas = process_geotag_properties(
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\process_geotag_properties.py", line 234, in process_geotag_properties
    metadatas.extend(_process_videos_beta(vars_args))
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\process_geotag_properties.py", line 295, in _process_videos_beta
    return extractor.process()
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\video_data_extraction\extract_video_data.py", line 35, in process
    self._check_paths(paths)
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\video_data_extraction\extract_video_data.py", line 134, in _check_paths
    for path in import_paths:
TypeError: 'WindowsPath' object is not iterable
PS I:\Dashcam\2023-07-28>
  1. gpx source, explicit pattern:
    
    PS I:\Dashcam\2023-07-28> python.exe -m mapillary_tools.commands --verbose video_process_and_upload --user_name bruno360 --video_geotag_source '{"source": "gpx", "pattern": "%g.gpx"}' --interpolate_directions 2023_0728_111630_F.MP4 D:/Bilder/tmp/2023_0728_111630_F
    2024-01-08 08:16:36,927 - DEBUG   - mapillary_tools version 0.11.1
    2024-01-08 08:16:36,927 - DEBUG   - CLI param: verbose: True
    2024-01-08 08:16:36,929 - DEBUG   - CLI param: video_import_path: 2023_0728_111630_F.MP4
    2024-01-08 08:16:36,930 - DEBUG   - CLI param: import_path: D:\Bilder\tmp\2023_0728_111630_F
    2024-01-08 08:16:36,930 - DEBUG   - CLI param: video_sample_distance: 3.0
    2024-01-08 08:16:36,931 - DEBUG   - CLI param: video_sample_interval: -1.0
    2024-01-08 08:16:36,931 - DEBUG   - CLI param: video_duration_ratio: 1.0
    2024-01-08 08:16:36,931 - DEBUG   - CLI param: skip_subfolders: False
    2024-01-08 08:16:36,932 - DEBUG   - CLI param: rerun: False
    2024-01-08 08:16:36,932 - DEBUG   - CLI param: skip_sample_errors: False
    2024-01-08 08:16:36,932 - DEBUG   - CLI param: skip_process_errors: False
    2024-01-08 08:16:36,933 - DEBUG   - CLI param: overwrite_all_EXIF_tags: False
    2024-01-08 08:16:36,933 - DEBUG   - CLI param: overwrite_EXIF_time_tag: False
    2024-01-08 08:16:36,933 - DEBUG   - CLI param: overwrite_EXIF_gps_tag: False
    2024-01-08 08:16:36,934 - DEBUG   - CLI param: overwrite_EXIF_direction_tag: False
    2024-01-08 08:16:36,934 - DEBUG   - CLI param: overwrite_EXIF_orientation_tag: False
    2024-01-08 08:16:36,934 - DEBUG   - CLI param: add_file_name: False
    2024-01-08 08:16:36,935 - DEBUG   - CLI param: add_import_date: False
    2024-01-08 08:16:36,935 - DEBUG   - CLI param: geotag_source: exif
    2024-01-08 08:16:36,935 - DEBUG   - CLI param: video_geotag_source: {source: gpx, pattern: %g.gpx}
    2024-01-08 08:16:36,936 - DEBUG   - CLI param: interpolation_use_gpx_start_time: False
    2024-01-08 08:16:36,936 - DEBUG   - CLI param: interpolation_offset_time: 0.0
    2024-01-08 08:16:36,937 - DEBUG   - CLI param: offset_angle: 0.0
    2024-01-08 08:16:36,939 - DEBUG   - CLI param: offset_time: 0.0
    2024-01-08 08:16:36,939 - DEBUG   - CLI param: cutoff_distance: 600.0
    2024-01-08 08:16:36,939 - DEBUG   - CLI param: cutoff_time: 60.0
    2024-01-08 08:16:36,940 - DEBUG   - CLI param: interpolate_directions: True
    2024-01-08 08:16:36,940 - DEBUG   - CLI param: duplicate_distance: 0.1
    2024-01-08 08:16:36,941 - DEBUG   - CLI param: duplicate_angle: 5.0
    2024-01-08 08:16:36,941 - DEBUG   - CLI param: filetypes: blackvue, camm, gopro, image, video
    2024-01-08 08:16:36,941 - DEBUG   - CLI param: user_name: bruno360
    2024-01-08 08:16:36,942 - DEBUG   - CLI param: dry_run: False
    2024-01-08 08:16:36,944 - INFO    - Extracting video information: ffprobe -print_format json -hide_banner -show_format -show_streams 2023_0728_111630_F.MP4
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2023_0728_111630_F.MP4':
    Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2023-07-28T11:21:30.000000Z
    Duration: 00:05:00.00, start: 0.000000, bitrate: 33151 kb/s
    Stream #0:0[0x1](eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 3840x2160, 32768 kb/s, 30 fps, 30 tbr, 60k tbn (default)
    Metadata:
      creation_time   : 2023-07-28T11:21:30.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
    Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 64 kb/s (default)
    Metadata:
      creation_time   : 2023-07-28T11:21:30.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
    2024-01-08 08:16:36,992 - DEBUG   - Extracted video duration: 300.000000
    2024-01-08 08:16:36,992 - DEBUG   - Extracted video creation time: 2023-07-28T11:21:30.000000Z
    2024-01-08 08:16:36,995 - INFO    - Extracting video metdata
    2024-01-08 08:16:36,997 - WARNING - Failed to geotag video 2023_0728_111630_F.MP4: No GPS data found from the video
    Traceback (most recent call last):
    File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\geotag\geotag_videos_from_video.py", line 155, in geotag_video
    raise exceptions.MapillaryVideoError("No GPS data found from the video")
    mapillary_tools.exceptions.MapillaryVideoError: No GPS data found from the video
    2024-01-08 08:16:36,998 - WARNING - No GPS data found from the video
    2024-01-08 08:16:36,998 - WARNING - Force the option "filetypes" to be "image" to avoid processing and uploading both the video samples and the videos themselves
    2024-01-08 08:16:37,001 - ERROR   - MapillaryBadParameterError: ('Unknown beta source %s or invalid JSON', '{source: gpx, pattern: %g.gpx}')
    Traceback (most recent call last):
    File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\process_geotag_properties.py", line 271, in _process_videos_beta
    parsed_opts = json.loads(source)
    File "C:\Program Files\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
    File "C:\Program Files\Python310\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "C:\Program Files\Python310\lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
    json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands__main__.py", line 168, in main args.func(argvars) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\video_process_and_upload.py", line 18, in run VideoProcessCommand().run(args) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\video_process.py", line 31, in run ProcessCommand().run(args) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\process.py", line 270, in run metadatas = process_geotag_properties( File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\process_geotag_properties.py", line 234, in process_geotag_properties metadatas.extend(_process_videos_beta(vars_args)) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\process_geotag_properties.py", line 274, in _process_videos_beta raise exceptions.MapillaryBadParameterError( mapillary_tools.exceptions.MapillaryBadParameterError: ('Unknown beta source %s or invalid JSON', '{source: gpx, pattern: %g.gpx}') PS I:\Dashcam\2023-07-28>


3. exiftool_runtime, implicit pattern:

PS I:\Dashcam\2023-07-28> python.exe -m mapillary_tools.commands --verbose video_process_and_upload --user_name bruno360 --video_geotag_source exiftool_runtime --interpolate_directions 2023_0728_111630_F.MP4 D:/Bilder/tmp/2023_0728_111630_F 2024-01-08 08:15:43,471 - DEBUG - mapillary_tools version 0.11.1 2024-01-08 08:15:43,472 - DEBUG - CLI param: verbose: True 2024-01-08 08:15:43,472 - DEBUG - CLI param: video_import_path: 2023_0728_111630_F.MP4 2024-01-08 08:15:43,472 - DEBUG - CLI param: import_path: D:\Bilder\tmp\2023_0728_111630_F 2024-01-08 08:15:43,472 - DEBUG - CLI param: video_sample_distance: 3.0 2024-01-08 08:15:43,472 - DEBUG - CLI param: video_sample_interval: -1.0 2024-01-08 08:15:43,472 - DEBUG - CLI param: video_duration_ratio: 1.0 2024-01-08 08:15:43,472 - DEBUG - CLI param: skip_subfolders: False 2024-01-08 08:15:43,472 - DEBUG - CLI param: rerun: False 2024-01-08 08:15:43,472 - DEBUG - CLI param: skip_sample_errors: False 2024-01-08 08:15:43,473 - DEBUG - CLI param: skip_process_errors: False 2024-01-08 08:15:43,473 - DEBUG - CLI param: overwrite_all_EXIF_tags: False 2024-01-08 08:15:43,473 - DEBUG - CLI param: overwrite_EXIF_time_tag: False 2024-01-08 08:15:43,473 - DEBUG - CLI param: overwrite_EXIF_gps_tag: False 2024-01-08 08:15:43,473 - DEBUG - CLI param: overwrite_EXIF_direction_tag: False 2024-01-08 08:15:43,473 - DEBUG - CLI param: overwrite_EXIF_orientation_tag: False 2024-01-08 08:15:43,473 - DEBUG - CLI param: add_file_name: False 2024-01-08 08:15:43,473 - DEBUG - CLI param: add_import_date: False 2024-01-08 08:15:43,473 - DEBUG - CLI param: geotag_source: exif 2024-01-08 08:15:43,474 - DEBUG - CLI param: video_geotag_source: exiftool_runtime 2024-01-08 08:15:43,474 - DEBUG - CLI param: interpolation_use_gpx_start_time: False 2024-01-08 08:15:43,475 - DEBUG - CLI param: interpolation_offset_time: 0.0 2024-01-08 08:15:43,475 - DEBUG - CLI param: offset_angle: 0.0 2024-01-08 08:15:43,475 - DEBUG - CLI param: offset_time: 0.0 2024-01-08 08:15:43,476 - DEBUG - CLI param: cutoff_distance: 600.0 2024-01-08 08:15:43,476 - DEBUG - CLI param: cutoff_time: 60.0 2024-01-08 08:15:43,476 - DEBUG - CLI param: interpolate_directions: True 2024-01-08 08:15:43,477 - DEBUG - CLI param: duplicate_distance: 0.1 2024-01-08 08:15:43,477 - DEBUG - CLI param: duplicate_angle: 5.0 2024-01-08 08:15:43,478 - DEBUG - CLI param: filetypes: blackvue, camm, gopro, image, video 2024-01-08 08:15:43,480 - DEBUG - CLI param: user_name: bruno360 2024-01-08 08:15:43,480 - DEBUG - CLI param: dry_run: False 2024-01-08 08:15:43,483 - INFO - Extracting video information: ffprobe -print_format json -hide_banner -show_format -show_streams 2023_0728_111630_F.MP4 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2023_0728_111630_F.MP4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isomavc1mp42 creation_time : 2023-07-28T11:21:30.000000Z Duration: 00:05:00.00, start: 0.000000, bitrate: 33151 kb/s Stream #0:00x1: Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 3840x2160, 32768 kb/s, 30 fps, 30 tbr, 60k tbn (default) Metadata: creation_time : 2023-07-28T11:21:30.000000Z handler_name : VideoHandler vendor_id : [0][0][0][0] Stream #0:10x2: Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 64 kb/s (default) Metadata: creation_time : 2023-07-28T11:21:30.000000Z handler_name : SoundHandler vendor_id : [0][0][0][0] 2024-01-08 08:15:43,531 - DEBUG - Extracted video duration: 300.000000 2024-01-08 08:15:43,532 - DEBUG - Extracted video creation time: 2023-07-28T11:21:30.000000Z 2024-01-08 08:15:43,535 - INFO - Extracting video metdata 2024-01-08 08:15:43,537 - WARNING - Failed to geotag video 2023_0728_111630_F.MP4: No GPS data found from the video Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\geotag\geotag_videos_from_video.py", line 155, in geotag_video raise exceptions.MapillaryVideoError("No GPS data found from the video") mapillary_tools.exceptions.MapillaryVideoError: No GPS data found from the video 2024-01-08 08:15:43,538 - WARNING - No GPS data found from the video 2024-01-08 08:15:43,538 - WARNING - Force the option "filetypes" to be "image" to avoid processing and uploading both the video samples and the videos themselves Traceback (most recent call last): File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands__main__.py", line 177, in main() File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands__main__.py", line 168, in main args.func(argvars) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\video_process_and_upload.py", line 18, in run VideoProcessCommand().run(args) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\video_process.py", line 31, in run ProcessCommand().run(args) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\process.py", line 270, in run metadatas = process_geotag_properties( File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\process_geotag_properties.py", line 234, in process_geotag_properties metadatas.extend(_process_videos_beta(vars_args)) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\process_geotag_properties.py", line 295, in _process_videos_beta return extractor.process() File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\video_data_extraction\extract_video_data.py", line 35, in process self._check_paths(paths) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\video_data_extraction\extract_video_data.py", line 134, in _check_paths for path in import_paths: TypeError: 'WindowsPath' object is not iterable PS I:\Dashcam\2023-07-28>


3. exiftool_runtime, explicit pattern:

PS I:\Dashcam\2023-07-28> python.exe -m mapillary_tools.commands --verbose video_process_and_upload --user_name bruno360 --video_geotag_source '{"source": "exiftool_runtime", "pattern": "%f"}' --interpolate_directions 2023_0728_111630_F.MP4 D:/Bilder/tmp/2023_0728_111630_F 2024-01-08 08:13:39,864 - DEBUG - mapillary_tools version 0.11.1 2024-01-08 08:13:39,864 - DEBUG - CLI param: verbose: True 2024-01-08 08:13:39,865 - DEBUG - CLI param: video_import_path: 2023_0728_111630_F.MP4 2024-01-08 08:13:39,865 - DEBUG - CLI param: import_path: D:\Bilder\tmp\2023_0728_111630_F 2024-01-08 08:13:39,867 - DEBUG - CLI param: video_sample_distance: 3.0 2024-01-08 08:13:39,867 - DEBUG - CLI param: video_sample_interval: -1.0 2024-01-08 08:13:39,868 - DEBUG - CLI param: video_duration_ratio: 1.0 2024-01-08 08:13:39,868 - DEBUG - CLI param: skip_subfolders: False 2024-01-08 08:13:39,868 - DEBUG - CLI param: rerun: False 2024-01-08 08:13:39,869 - DEBUG - CLI param: skip_sample_errors: False 2024-01-08 08:13:39,869 - DEBUG - CLI param: skip_process_errors: False 2024-01-08 08:13:39,869 - DEBUG - CLI param: overwrite_all_EXIF_tags: False 2024-01-08 08:13:39,870 - DEBUG - CLI param: overwrite_EXIF_time_tag: False 2024-01-08 08:13:39,870 - DEBUG - CLI param: overwrite_EXIF_gps_tag: False 2024-01-08 08:13:39,870 - DEBUG - CLI param: overwrite_EXIF_direction_tag: False 2024-01-08 08:13:39,871 - DEBUG - CLI param: overwrite_EXIF_orientation_tag: False 2024-01-08 08:13:39,871 - DEBUG - CLI param: add_file_name: False 2024-01-08 08:13:39,871 - DEBUG - CLI param: add_import_date: False 2024-01-08 08:13:39,872 - DEBUG - CLI param: geotag_source: exif 2024-01-08 08:13:39,872 - DEBUG - CLI param: video_geotag_source: {source: exiftool_runtime, pattern: %f} 2024-01-08 08:13:39,872 - DEBUG - CLI param: interpolation_use_gpx_start_time: False 2024-01-08 08:13:39,873 - DEBUG - CLI param: interpolation_offset_time: 0.0 2024-01-08 08:13:39,873 - DEBUG - CLI param: offset_angle: 0.0 2024-01-08 08:13:39,873 - DEBUG - CLI param: offset_time: 0.0 2024-01-08 08:13:39,874 - DEBUG - CLI param: cutoff_distance: 600.0 2024-01-08 08:13:39,874 - DEBUG - CLI param: cutoff_time: 60.0 2024-01-08 08:13:39,874 - DEBUG - CLI param: interpolate_directions: True 2024-01-08 08:13:39,876 - DEBUG - CLI param: duplicate_distance: 0.1 2024-01-08 08:13:39,877 - DEBUG - CLI param: duplicate_angle: 5.0 2024-01-08 08:13:39,878 - DEBUG - CLI param: filetypes: blackvue, camm, gopro, image, video 2024-01-08 08:13:39,878 - DEBUG - CLI param: user_name: bruno360 2024-01-08 08:13:39,879 - DEBUG - CLI param: dry_run: False 2024-01-08 08:13:39,881 - INFO - Extracting video information: ffprobe -print_format json -hide_banner -show_format -show_streams 2023_0728_111630_F.MP4 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2023_0728_111630_F.MP4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isomavc1mp42 creation_time : 2023-07-28T11:21:30.000000Z Duration: 00:05:00.00, start: 0.000000, bitrate: 33151 kb/s Stream #0:00x1: Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 3840x2160, 32768 kb/s, 30 fps, 30 tbr, 60k tbn (default) Metadata: creation_time : 2023-07-28T11:21:30.000000Z handler_name : VideoHandler vendor_id : [0][0][0][0] Stream #0:10x2: Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 64 kb/s (default) Metadata: creation_time : 2023-07-28T11:21:30.000000Z handler_name : SoundHandler vendor_id : [0][0][0][0] 2024-01-08 08:13:39,931 - DEBUG - Extracted video duration: 300.000000 2024-01-08 08:13:39,931 - DEBUG - Extracted video creation time: 2023-07-28T11:21:30.000000Z 2024-01-08 08:13:39,934 - INFO - Extracting video metdata 2024-01-08 08:13:39,936 - WARNING - Failed to geotag video 2023_0728_111630_F.MP4: No GPS data found from the video Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\geotag\geotag_videos_from_video.py", line 155, in geotag_video raise exceptions.MapillaryVideoError("No GPS data found from the video") mapillary_tools.exceptions.MapillaryVideoError: No GPS data found from the video 2024-01-08 08:13:39,946 - WARNING - No GPS data found from the video 2024-01-08 08:13:39,948 - WARNING - Force the option "filetypes" to be "image" to avoid processing and uploading both the video samples and the videos themselves 2024-01-08 08:13:39,951 - ERROR - MapillaryBadParameterError: ('Unknown beta source %s or invalid JSON', '{source: exiftool_runtime, pattern: %f}') Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\process_geotag_properties.py", line 271, in _process_videos_beta parsed_opts = json.loads(source) File "C:\Program Files\Python310\lib\json__init__.py", line 346, in loads return _default_decoder.decode(s) File "C:\Program Files\Python310\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Program Files\Python310\lib\json\decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands__main__.py", line 168, in main args.func(argvars) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\video_process_and_upload.py", line 18, in run VideoProcessCommand().run(args) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\video_process.py", line 31, in run ProcessCommand().run(args) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\process.py", line 270, in run metadatas = process_geotag_properties( File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\process_geotag_properties.py", line 234, in process_geotag_properties metadatas.extend(_process_videos_beta(vars_args)) File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\process_geotag_properties.py", line 274, in _process_videos_beta raise exceptions.MapillaryBadParameterError( mapillary_tools.exceptions.MapillaryBadParameterError: ('Unknown beta source %s or invalid JSON', '{source: exiftool_runtime, pattern: %f}') PS I:\Dashcam\2023-07-28>

stefanbj commented 8 months ago

Hm, seems the JSON snippet needs to be quoted in the windows Power Shell, but then it's the same issue as with the implicit pattern examples:

PS I:\Dashcam\2023-07-28> python.exe -m mapillary_tools.commands --verbose video_process --video_geotag_source '{\"source\": \"gpx\", \"pattern\": \"%g.gpx\"}' --interpolate_directions 2023_0728_111630_F.MP4 D:/Bilder/tmp/2023_0728_111630_F
2024-01-08 12:38:41,288 - DEBUG   - mapillary_tools version 0.11.1
2024-01-08 12:38:41,288 - DEBUG   - CLI param: verbose: True
2024-01-08 12:38:41,289 - DEBUG   - CLI param: video_import_path: 2023_0728_111630_F.MP4
2024-01-08 12:38:41,289 - DEBUG   - CLI param: import_path: D:\Bilder\tmp\2023_0728_111630_F
2024-01-08 12:38:41,289 - DEBUG   - CLI param: video_sample_distance: 3.0
2024-01-08 12:38:41,289 - DEBUG   - CLI param: video_sample_interval: -1.0
2024-01-08 12:38:41,289 - DEBUG   - CLI param: video_duration_ratio: 1.0
2024-01-08 12:38:41,289 - DEBUG   - CLI param: skip_subfolders: False
2024-01-08 12:38:41,289 - DEBUG   - CLI param: rerun: False
2024-01-08 12:38:41,289 - DEBUG   - CLI param: skip_sample_errors: False
2024-01-08 12:38:41,289 - DEBUG   - CLI param: skip_process_errors: False
2024-01-08 12:38:41,290 - DEBUG   - CLI param: filetypes: blackvue, camm, image, gopro, video
2024-01-08 12:38:41,290 - DEBUG   - CLI param: overwrite_all_EXIF_tags: False
2024-01-08 12:38:41,290 - DEBUG   - CLI param: overwrite_EXIF_time_tag: False
2024-01-08 12:38:41,290 - DEBUG   - CLI param: overwrite_EXIF_gps_tag: False
2024-01-08 12:38:41,290 - DEBUG   - CLI param: overwrite_EXIF_direction_tag: False
2024-01-08 12:38:41,290 - DEBUG   - CLI param: overwrite_EXIF_orientation_tag: False
2024-01-08 12:38:41,290 - DEBUG   - CLI param: add_file_name: False
2024-01-08 12:38:41,290 - DEBUG   - CLI param: add_import_date: False
2024-01-08 12:38:41,290 - DEBUG   - CLI param: geotag_source: exif
2024-01-08 12:38:41,290 - DEBUG   - CLI param: video_geotag_source: {"source": "gpx", "pattern": "%g.gpx"}
2024-01-08 12:38:41,291 - DEBUG   - CLI param: interpolation_use_gpx_start_time: False
2024-01-08 12:38:41,291 - DEBUG   - CLI param: interpolation_offset_time: 0.0
2024-01-08 12:38:41,291 - DEBUG   - CLI param: offset_angle: 0.0
2024-01-08 12:38:41,291 - DEBUG   - CLI param: offset_time: 0.0
2024-01-08 12:38:41,291 - DEBUG   - CLI param: cutoff_distance: 600.0
2024-01-08 12:38:41,291 - DEBUG   - CLI param: cutoff_time: 60.0
2024-01-08 12:38:41,291 - DEBUG   - CLI param: interpolate_directions: True
2024-01-08 12:38:41,291 - DEBUG   - CLI param: duplicate_distance: 0.1
2024-01-08 12:38:41,291 - DEBUG   - CLI param: duplicate_angle: 5.0
2024-01-08 12:38:41,294 - INFO    - Extracting video information: ffprobe -print_format json -hide_banner -show_format -show_streams 2023_0728_111630_F.MP4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2023_0728_111630_F.MP4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2023-07-28T11:21:30.000000Z
  Duration: 00:05:00.00, start: 0.000000, bitrate: 33151 kb/s
  Stream #0:0[0x1](eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 3840x2160, 32768 kb/s, 30 fps, 30 tbr, 60k tbn (default)
    Metadata:
      creation_time   : 2023-07-28T11:21:30.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 64 kb/s (default)
    Metadata:
      creation_time   : 2023-07-28T11:21:30.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
2024-01-08 12:38:41,344 - DEBUG   - Extracted video duration: 300.000000
2024-01-08 12:38:41,344 - DEBUG   - Extracted video creation time: 2023-07-28T11:21:30.000000Z
2024-01-08 12:38:41,347 - INFO    - Extracting video metdata
2024-01-08 12:38:41,350 - WARNING - Failed to geotag video 2023_0728_111630_F.MP4: No GPS data found from the video
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\geotag\geotag_videos_from_video.py", line 155, in geotag_video
    raise exceptions.MapillaryVideoError("No GPS data found from the video")
mapillary_tools.exceptions.MapillaryVideoError: No GPS data found from the video
2024-01-08 12:38:41,350 - WARNING - No GPS data found from the video
2024-01-08 12:38:41,351 - WARNING - Force the option "filetypes" to be "image" to avoid processing and uploading both the video samples and the videos themselves
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\__main__.py", line 177, in <module>
    main()
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\__main__.py", line 168, in main
    args.func(argvars)
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\video_process.py", line 31, in run
    ProcessCommand().run(args)
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\commands\process.py", line 270, in run
    metadatas = process_geotag_properties(
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\process_geotag_properties.py", line 234, in process_geotag_properties
    metadatas.extend(_process_videos_beta(vars_args))
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\process_geotag_properties.py", line 295, in _process_videos_beta
    return extractor.process()
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\video_data_extraction\extract_video_data.py", line 35, in process
    self._check_paths(paths)
  File "C:\Program Files\Python310\lib\site-packages\mapillary_tools\video_data_extraction\extract_video_data.py", line 134, in _check_paths
    for path in import_paths:
TypeError: 'WindowsPath' object is not iterable
PS I:\Dashcam\2023-07-28>
stefanbj commented 8 months ago

Sorry, tried the new interface, was confused by a RTFM issue, accidentally using the 'video_process' instead of the 'process' command; that stated, I will likely not be the last one making that mistake, and get confused, so might be a good idea to improve the error handling 'video_process' to better handle this type of mistake.

stefanbj commented 8 months ago

As the new experimental interface works, I guess the feature as such is implemented. The older video_process interface does sort of work, but stills suffers from the time correlation issue, but I think we can consider that a "bug" at this point as the code has been released.

The new interface seems to be a good first step towards simplifying the upload process, shifting the most of the processing to the server-side, so it can be replaced with a web-based interface eventually, at the expense of significantly increasing the amount of data to be uploaded (e.g. from ~250MB to 1.2 GB, so about 5x); and when doing this from locations that does not have the fastes upload speed this can be an issue. However a web-based interface would make it much easier for people to contribute, so I guess overall this might be a good direction to change towards overall.

Though I think I still prefer that older method, as it was usually able to complete the processing and upload in about half the time, OTOH I'm not too keen on going back to the older intervall based sampling - as it has is't issues...