Skip to content

Warn of a file named for process that is not an image or a video - #871

Merged
caglarpir merged 3 commits into
mapillary:mainfrom
caglarpir:warn-unsupported-import-file
Oct 22, 2026
Merged

caglarpir merged 3 commits into
mapillary:mainfrom
caglarpir:warn-unsupported-import-file

Conversation

@caglarpir

Copy link
Copy Markdown
Contributor

Stacked on #870; review the last commit.

Problem

process skips the files it cannot process when it searches a directory. It skipped a file named explicitly the same way, without a word:

mapillary_tools process VID_20240705_083711_00_001.insv   # "Processing 0 files", [], exit 0, nothing on stderr

Fix

Warn of such a file: "Skipping X, which is not a supported image or video". It is still skipped and the run does not fail: callers that pass the files a user selected rely on that (#830), and find the skipped files in the process report (--process_report_path). A zip file is not warned of, as process_and_upload uploads it.

Verification

  • The command above warns once; output and exit code are unchanged. Folder scans are unchanged.
  • New unit test. Unit and integration tests, doctests, mypy --python-version 3.9, ruff check, ruff format --check and usort diff are clean.

The README lists NMEA among the sources that geotag videos, but no video
was read from an NMEA file: process and video_process gave the video no
description at all, and exited 0, so it was silently left out. Sampling
fell back to the GPS in the video, which a video recorded with an
external logger does not have.

Read the NMEA file into a track and place it on the video exactly as a
GPX track is: synced by the GPS clock of the video, or by
--video_start_time, or assumed to start with the video, with the
interpolation options, the coverage checks and the clipping of process.
GPXVideoExtractor now reads its file through _parse_tracks(), which
NMEAVideoExtractor overrides, and names the format of the file in its
messages. A file that is not valid NMEA is reported as an invalid GPX
file is. Interval sampling checks an NMEA track started with the video
by --interpolation_use_gpx_start_time as it checks a GPX track.

On an action camera video with a GPX and the same track as NMEA, process gives
the same track, and video_process samples the same frames at the same
positions.
Images geotagged from an NMEA file failed with a traceback when the
file had an RMC sentence without a date, such as the last one of a log
cut short (TypeError), or GGA sentences and no RMC sentence at all
(UnboundLocalError), and a video was failed as if the file were not
NMEA. A void RMC sentence, which receivers log before they acquire a
fix, gave the date of their unset clock, and a GGA sentence without a
fix added a point at 0, 0. Only $GP sentences were read, so a log of a
receiver of several systems, which writes $GN sentences, gave no points
at all.

Skip RMC sentences that are void or have no date or time, and GGA
sentences without a time or a fix, and read the sentences of any
talker, keeping the first fix of each time, so that a receiver that logs
a fix from two talkers does not give two points at the same time. GGA
sentences without the date of any RMC sentence give no points, with a
warning. The points read from valid files are the same.
process searches a directory for the images and videos it can process,
and skips the other files. It skipped a file named explicitly the same
way, without a word: `process VID.insv` processed 0 files and exited 0,
with nothing on stderr, so a user could not tell why the video was not
there.

Warn of such a file. It is still skipped, and the run does not fail:
callers that pass the files a user selected rely on that, and find the
skipped files in the process report (--process_report_path). A zip file
is not warned of, as process_and_upload uploads it.
@caglarpir
caglarpir force-pushed the warn-unsupported-import-file branch from 3e5481b to d3f9e29 Compare October 22, 2026 20:18
@caglarpir
caglarpir merged commit f6d49df into mapillary:main Oct 22, 2026
16 checks passed
caglarpir added a commit that referenced this pull request Oct 24, 2026
Since #897, a file named for process that is not a supported image or
video fails with MapillaryUnsupportedFileError. That includes the files
that cameras and other tools write beside images and videos, which a
user names along with them by selecting all the files of a camera
folder: `process_and_upload DCIM/100GOPRO/*` named the GoPro thumbnails
(.THM) and low-resolution proxies (.LRV) beside the videos, and GPS and
metadata files beside them, so the run exited 6 and uploaded nothing,
zip files included, unless --skip_process_errors was given. An
AppleDouble file, which macOS writes as ._NAME beside each file it
copies to a drive that cannot hold its metadata, has the extension of
that file: named, ._GOPR0001.JPG was read as an image and failed as one
without GPS, and ._GH010001.MP4 as a video that cannot be parsed. The
AppleDouble file of a zip file, named for upload or process_and_upload,
was read as a zip file and stopped the run with a BadZipFile traceback
before any zip file was uploaded.

Skip a named file with a known sidecar or companion extension (.thm,
.lrv, .gpx, .nmea, .xml, .json, .srt, .txt, .csv, .log, .md5, in any
case), an AppleDouble file and .DS_Store, with the warning that #871
printed: "Skipping ..., which is not a supported image or video". The
process report still lists them as unsupported_format, AppleDouble files
too, which it counted among the processed files for the extension of an
image or video. Upload skips the AppleDouble file of a zip file with the
same warning, and uploads the zip files named with it. Any other named
unsupported file, such as an Insta360 original (.insv), a PNG or a HEIC
image, still fails with #897's error and hint. A folder scan, which
leaves hidden files and these files alone, does not change.

Checked process on a camera folder named file by file, with an image, a
video, a zip file, a thumbnail, a proxy, a GPX, an XML, a text file, the
AppleDouble files of the image and the video, .DS_Store, an Insta360
original and a PNG: the 8 sidecar files are skipped with 8 warnings and
listed in the report as before, and the original and the PNG fail as
before. Named without the last two, the folder now exits 0 (was 6).
process_and_upload of named zip files with sidecar files beside them
uploads the zip files and exits 0 without --skip_process_errors, also
with the AppleDouble file of one of them, which made process_and_upload
and upload exit 1 with nothing uploaded. Folders of images, videos of
several cameras, a mixed folder, a GPX run, and video_process and
sample_video on named videos and folders give the same descriptions and
exit codes as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant