Repository navigation
Sync a GPX track to video time 0, not to the first video GPS point - #847
Merged
Merged
Conversation
GPXVideoExtractor computed the GPX offset against the first GPS point of the video, and _rebase_times() then put that instant at video time 0. When the video's GPS starts later than the video, the GPX track landed early by that point's time. GoPro drops noisy fixes at the start of a recording, so the first point it keeps can be minutes into the video: on a HERO7 capture whose first kept fix is 221.6 s in, a GPX exported from the video's own GPS was synced 222.8 s off, and is now within 2 s. Subtract the video time of that point, so the offset is to video time 0.
This was referenced Oct 19, 2026
caglarpir
added a commit
to caglarpir/mapillary_tools
that referenced
this pull request
Oct 20, 2026
main reworked GPXVideoExtractor (mapillary#831, mapillary#847, mapillary#849): it syncs a GPX through a VideoClock, with a rate for timelapses, falls back to the start of the video when the video's GPS has no usable clock, and reports a GPX it cannot parse. This branch changed the same method, so take main's and re-apply this branch's changes to it: - Drop GPX points timestamped before 1980, and sort the rest. - Place the GPX by --video_start_time wherever the video has no clock to sync it with: no usable GPS, as before, and now also GPS without a clock, such as noise with a placeholder date, which main places at the start of the video. - Apply --interpolation_offset_time after the sync. The offset is in GPS seconds, so with a timelapse clock the track moves by offset / rate seconds of video; by the whole offset, frames would be picked offset * (rate - 1) seconds of track away from where they are geotagged. In factory.py, keep both main's EXTERNAL_GPS_SOURCES and this branch's _ALL_VIDEO_TYPES. Tests cover the clockless placement and the timelapse offset.
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.
Problem
GPXVideoExtractor._gpx_offset()computes the GPX offset against the first GPS point of the video, and_rebase_times()then puts that instant at video time 0. When the video's GPS starts later than the video, the GPX track lands early by that point's time.GoPro drops noisy fixes at the start of a recording, so the first point it keeps can be minutes into the video.
Change
Subtract the video time of that point, so that the offset is to video time 0.
Verification
ruff check,ruff format --check,usort diffandmypyare clean.This touches the same lines of
_gpx_offsetas #846. Whichever lands second needs a small rebase.