Repository navigation
Reject GPX tracks that miss the video, as placed on its timeline - #848
Merged
Merged
Conversation
This was referenced Oct 19, 2026
Check a GPX track against the video once it is placed on the video's timeline, by the video's GPS clock (including a timelapse's), by --video_start_time, or by assuming that it starts with the video, and after --interpolation_offset_time: - A track that misses the video raises MapillaryOutsideGPXTrackError, whatever the gap: a GPX file from another day or another clip, an epoch mix-up, or naive GPX timestamps read in the wrong time zone. Before, the video was synced to a track with no position for any moment of it, and process exited 0, with a warning only for an offset over a day. The message names both files, their times and the gap, in GPS time. - A track that covers only part of the video warns with how much of it is left uncovered, allowing 2 s of GPS time for a once-a-second logger started and stopped with the camera. - If the duration cannot be read, a gap warns up to a day and raises beyond. A track assumed to start with the video only warns. MapillaryOutsideGPXTrackError is now a geotagging error, so the next geotag source gets its turn, for images too, and a warning says so when that source geotags the file: one per video, and one per GPX source for images. With GPX as the only or last source the error is final, as before. The error is made picklable, since video geotagging raises it in a worker process. The GPX module keeps one duration formatter. It rounds instead of truncating, since timestamps often fall a hair short of a whole unit, which humanize reported as "4 seconds" for 4.999 and "an hour" for 1 h 59 min. Tests: - test_good_clock_days_away_is_still_used now expects the rejection. - Two GPX sync tests used a GPX 8 hours before the sample video's GPS, which started at 23:44:42Z, not 15:44:47Z as their comment said. - Two integration tests paired the 2019 GoPro sample video with a 2025 GPX file and asserted success. They now shift the GPX to the video's time, and a new test asserts that the unrelated pairing fails. - video_process with a GPX two hours before --video_start_time still fails with exit 7, now with MapillaryOutsideGPXTrackError.
caglarpir
force-pushed
the
reject-gpx-outside-video
branch
from
October 20, 2026 11:57
f1123b8 to
9f04bed
Compare
This was referenced Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #842. Reworked on top of #841, #847 and #849.
Problem
A GPX track that does not overlap the video in time is synced anyway: the video gets a track with no position for any moment of it, and
processexits 0. Main only warns when the offset is over a day, so a GPX in the wrong time zone, the GPX of the next clip, or a wrong--video_start_timegoes through silently.Changes
The track is checked against the video once it is placed on the video's timeline, so the check sees what the frames will see: placed by the video's GPS clock (a timelapse's included, #849), by
--video_start_time, or by assuming that it starts with the video (#841), and after--interpolation_offset_time. The video runs from video time 0 to itsmvhdduration.MapillaryOutsideGPXTrackError, whatever the gap. The message names both files and their times, gives the gap in GPS time, and suggests checking that the GPX belongs to the video, then the camera clock and the time zone of the GPX timestamps. This replaces main's warning for an offset over a day.MapillaryOutsideGPXTrackErroris now a geotagging error, so the next geotag source gets its turn, for images too. When that source geotags the file, a warning says so, so a GPX that does not belong to the file does not go unnoticed: one warning per video, and one per GPX source for images. With GPX as the only or last source the error is final, as before. The error is made picklable, since video geotagging raises it in a worker process.The module keeps one duration formatter, used by #841's messages too. It rounds rather than truncates: timestamps often fall a hair short of a whole unit, which
humanize.naturaldeltareports as "4 seconds" for 4.999 s and "an hour" for 1 h 59 min.Behaviour
processon the 12 s GoPro sample video and a sample image from the test data:MapillaryOutsideGPXTrackErrornativeMapillaryOutsideGPXTrackErrorexifVerification on real files
processon 45 sample videos from GoPro, BlackVue, Labpano, Insta360 and Ricoh cameras: output identical to main.Tests
tests/unit/test_gpx_video_coverage.py, throughextract()on CAMM videos and GPX files: covering, partial, missing, the gap in a readable unit, the error's times, no duration, an epoch mix-up,--interpolation_offset_time, pickling, timelapses (a GPX of the whole recording, half of it, and the gap in GPS time),--video_start_time, the assumed start, and falling through to the next source with a warning, for videos and images.test_good_clock_days_away_is_still_used(Sync a GPX to the GPS clock of a timelapse, even one too noisy to publish #849) now expects the rejection.video_processwith a GPX two hours before--video_start_timestill fails with exit 7, now withMapillaryOutsideGPXTrackErrorrather than finding no frames.ruff check,ruff format --check,usort diffandmypyare clean.Known limitations