Skip to content

Warn, rather than refuse, when a GPX track and a video differ in length - #944

Merged
caglarpir merged 2 commits into
mapillary:mainfrom
caglarpir:align-gpx-with-video-start
Oct 30, 2026
Merged

caglarpir merged 2 commits into
mapillary:mainfrom
caglarpir:align-gpx-with-video-start

Conversation

@caglarpir

@caglarpir caglarpir commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #946, which is to be merged first; review the last commit.

A video without a GPS clock of its own gives no trustworthy time to place a GPX track by: its creation time and file times come from the camera's clock, which can be off, and mark the start or the end of the recording depending on the camera. The GPX, whose times come from GPS, is taken to be right. Without --video_start_time, the track is now assumed to start with the video in process and in every kind of sampling, and is never refused for its length.

When the track lasts more than a minute longer or shorter than the video, geotagging warns:

The GPX track in track.gpx lasts 27.1 minutes and the video clip.mp4 10.8 minutes, so the track is assumed to start with the video. Please align the video start time with the GPX track: trim the GPX to the video, or sample the video with video_process and --video_start_time. If the video is a timelapse, its GPX track is expected to last longer, and is uploaded whole

A longer track warns only if it also lasts more than 1.5 times as long as the video, and only then does the warning mention timelapses, whose tracks last longer by design. In sampling, the advice is --video_start_time and, for a timelapse, --video_duration_ratio. With --interpolation_offset_time, the offset places the video along the track, and nothing is warned of.

Video without a GPS clock, GPX given, no --video_start_time Before After
process, track more than twice the video from the start of the GPX, with a warning that it runs on past the video unchanged, with the warning above
process, track 1.5 to 2 times the video, and more than a minute longer silent the warning above
process, track more than a minute shorter a warning that the track covers only part of the video the warning above, without the timelapse sentence
process, --interpolation_offset_time, track more than twice the video a warning to check the offset silent
video_process by distance, or with --video_geotag_source gpx, track more than twice the video refused, MapillaryGPXVideoStartUnknownError from the start of the GPX, with the warning
video_process by distance, track 2 s to twice the video longer a warning that the frames may be placed too early the warning above, past a minute and 1.5 times
video_process by interval, --geotag_source gpx samples stamped from the creation time, and placed there along the GPX, or outside it; "Unable to extract video start time" without one stamped from the start of the GPX, with the warning

--interpolation_use_gpx_start_time still refuses, in sampling, a track too long to end with the video at --video_duration_ratio. A video whose GPS has no timestamps is still sampled by interval with its creation time as the capture time, when no GPX geotags the samples: its positions come from its own GPS, and the time only labels them.

The warning is a MapillaryGPXAlignmentWarning, which carries the durations and the start and end times of the track, for a follow-up to list in the process report. #946 reverts #940, which placed the track by the creation time: this handles such videos instead.

Tests: unit and integration suites, with and without ExifTool.

…apillary#940)

This reverts the merge of mapillary#940 (3fcf6ca), back to main as it was
after mapillary#939.

mapillary#940 placed a GPX track along a video without GPS timestamps by the
video's creation time. It was decided, after mapillary#940 was opened, that the
creation time, which comes from the camera's clock, is never to be used
to place a track: only a video's own GPS timestamps and its duration
are. mapillary#944 handles videos without GPS timestamps that way instead,
warning when the video and the track differ in length, and is stacked
on mapillary#939, so it applies once mapillary#940 is reverted.
A video without a GPS clock of its own gives no trustworthy time to place a
GPX track by: its creation time and file times come from the camera's clock.
The track, whose times come from GPS, is then assumed to start with the video,
in process and in video_process alike.

When the track lasts more than a minute longer or shorter than the video,
geotagging warns that the video start time needs aligning with the track,
with what to do about it. A longer track warns only if it also lasts more
than 1.5 times as long as the video, and the warning mentions timelapses,
whose tracks last longer by design. Nothing is refused any more: sampling
used to refuse a track that ran on past twice the video, and now places it
from its start as process does. With --interpolation_offset_time the offset
places the video along the track, and nothing is warned of.

The warning is a MapillaryGPXAlignmentWarning, kept by the extractor with
the durations and times of the track and the video, for a later change to
pass on to the process report.

Interval sampling stamps the samples of such a video from the start of the
GPX track that geotags them, rather than from its creation time, which it
now only falls back to for a video with neither a GPS clock nor a track.
@caglarpir
caglarpir force-pushed the align-gpx-with-video-start branch from 0505300 to 6b2095d Compare October 30, 2026 09:28
@caglarpir
caglarpir merged commit df714ce into mapillary:main Oct 30, 2026
16 checks passed
caglarpir added a commit to caglarpir/mapillary_tools that referenced this pull request Oct 30, 2026
- A track assumed to start with a video without GPS is never refused
  for its length, in process or in sampling, and the creation time is
  never used to place it: a MapillaryGPXAlignmentWarning says when the
  track and the video differ in length (mapillary#944). Only
  --interpolation_use_gpx_start_time still refuses a long track.
- A file that a GPX or NMEA track missed fails with the miss when no
  later source geotags it (mapillary#938).
- The process report lists the geotagging warnings (mapillary#945).
- upload caches the checksums of the files, and shows progress while
  computing them (mapillary#942, mapillary#943).
caglarpir added a commit to caglarpir/mapillary_tools that referenced this pull request Oct 30, 2026
A GPX is assumed to start with a video without GPS, in process and in
every kind of sampling, with a warning when the two differ in length,
and is never placed by the creation time: only
--interpolation_use_gpx_start_time still refuses a long track, in
video_process. The process report lists the geotagging warnings.
caglarpir added a commit that referenced this pull request Nov 3, 2026
A video without a GPS clock of its own gives nothing to place a GPX track
by, and the track is assumed to start with it. A track that runs on past the
end of the video for longer than the whole video was not recorded for the
video alone: the video could start anywhere along it. Sampling refused such
a track from #841 until #944, which only warns that the video start time
needs aligning with the track. Since then, sampling places the video at the
start of whatever the track recorded, such as the first trip of a log of
several.

Sampling refuses it again, by distance and by interval alike, with the
MapillaryGPXVideoStartUnknownError and the message it gave before, which
for a track of a day or more says that the track covers more than the
video. Nothing is refused when --video_start_time places the video along
the track, when --interpolation_offset_time looks the video up along it, or
when the video spans the track at --video_duration_ratio. A track shorter
than the video, or longer by less than the video lasts, keeps the warning.

process, which takes neither --video_start_time nor --video_duration_ratio,
still uploads such a track whole, with the warning, as the track of a
timelapse runs on past the end of its video too. It refuses only a track of
a day or more, a log of several trips whose start is that of the first,
unless the video lasts more than half as long.

The creation time of the video still places nothing.
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