mapillary / mapillary/mapillary_tools
Video Timestamping Bugs with GoPro MAX
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 315
- Forks
- 145
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 2
Description
Extracting timestamps from GoPro MAX video files is basically completely broken in mapillary_tools. However, it is not purely mapillary_tools’ fault. Multiple bugs and design blunders compound here.
- GoPro MAX has no timezone support.
Hence, its RTC basically always runs in local time. Of course, only as long as the user has set the RTC correctly. This is the default case.- Rarely occasionaly, the user may deliberately set the RTC to UTC. However, there is no way to tell programmatically. Well, maybe if you are ready to do some algorithmic educated guessing against the GPMF’s GPS clock signal.
- The extracted video start timestamp is always strangely many seconds or more off from
creation_time(the RTC timestamp), even when you have properly synced the RTC via https://gopro.github.io/labs/control/precisiontime before video recording and/or the video file has no GPS signal in its GPMF stream. - Because GoPro MAX has no timezone support
creation_timeis always written in local time, although the spec requirescreation_timetimestamps to be in UTC. So, this is broken by design by GoPro. Again, unless the user deliberately sets the RTC to UTC you may get away with everything. - When you
sample_videothe frames are timestamped to UTC (OffsetTimeOriginal==+00:00) butDateTimeOriginalandGPSDateStamp/GPSTimeStampare falsely written local time values and are weirdly off from GPMF timestamps. It is a nonissue if the user has set the RTC to UTC. - When you
video_processa video file that has a GPMF stream but no clock signal in it with a GPX file thenmapillary_toolserrors out with[{"error":{"message":"Empty GPS data found","type":"MapillaryGPXEmptyError"},"filename":"video.mp4","filetype":"video"}]. In this case, the GPS data should be sourced from the GPX file as specified. A GPX file and a video file without a GPMF stream always work fine though. - GoPro MAX always writes an RTC sourced timecode, which fortunately is in sync with the
creation_timetag and is also the preferred means by which to sync video edits. The RTC is and actually should be the source for proper time keeping on GoPro MAX.
So, as you can see it is a total mess, mostly caused by GoPro though. For the least amount of fuss, a user should record GPMF videos with GPS positions and clock signal or set the RTC to UTC in order to work around all this hassle. The vast majority of users however understandably do not set the RTC to UTC.
Why All of This Actually Matters?
Unless a contributor actually pays attention to timezones or only uploads video files with GPS and clock signal data in the GPMF stream, there is a high chance that already many sequences have been uploaded with timestamps in the incorrect timezone. Of course, this does not apply to users who capture in the UTC timezone by default and set the RTC correctly.
What Needs a Fix
-
sample_videofor GoPro MAX and cameras that write local time tocreation_time.
Although users of such cameras can use the--video_start_timeoption to rectify timestamping, it uses a proprietary timestamp format in UTC only. It might be perhaps better to add a--timezoneoption. Alternatively, make the--video_start_time(also) accept the ISO 8601 format because it includes timezone support.GoPro MAX is a Mapillary recommended camera. Hence, imho this camera should receive extra care and attention, despite or perhaps because of all its quirks. Not all users upload GPMF with GPS data video files directly. MAX2 solves all these issues through full timezone support.
- The strange time discrepancy between GPMF sourced timestamps and RTC sourced
creation_timetag and timecode timestamps.
- The strange time discrepancy between GPMF sourced timestamps and RTC sourced
-
video_process: GPMF video files without GPS data should fall back to sourcing data from--geotag_source gpx.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the sample_video and video_process entry points and trace how GoPro MAX creation_time, GPMF timestamps, and --geotag_source gpx are handled. Reproduce the reported cases, including a GPMF stream without a clock signal, then define completion as correct timezone-aware timestamping and GPX fallback without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- audio-video-rtc, cli
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100