Repository navigation
Conversation
|
Hi @ypcyc! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
caglarpir
left a comment
There was a problem hiding this comment.
Thanks for working on this, @ypcyc! Reading 70mai GPS natively would be really useful, and pairing the hint samples with the video track by sample count is a neat approach. A few things need to change before this can go in.
1. The fixed +8 hour offset (TIMEZONE_OFFSET)
The point timestamps (epoch_time) are more than labels. On upload they go into the CAMM GPS track that sets the capture time, and video_process uses them as the capture time of each sampled frame. A fixed offset is only right for cameras set to one time zone, and the record doesn't say which zone the camera was set to. The Novatek parser doesn't guess in the same situation: when the GPS clock is local time, it returns no points and leaves the video to ExifTool (_UnsupportedBlockError("Local time") in novatek_parser.py). Unless the field turns out to be UTC, epoch_time should stay None.
2. Times shift when the first fix is late
If the timestamp stays, note that extract_points gives it to the first point with a fix, not to video time 0 (first_epoch_time + point.time - first_point_time). With synthetic records whose first fix comes 10 s into the clip, every point comes out 10 s early. That happens on the first clip after the camera starts. The docstring of novatek_parser.py describes the same pitfall. If the timestamp is the clip start, anchor + point.time avoids the shift.
3. Course, speed and altitude are read as single bytes
_parse_record reads record[0x17], record[0x1B] and record[0x1F], but these look like 4-byte little-endian integers, like lat/lon: the fields start at 0x0F, 0x13, 0x17, 0x1B and 0x1F, 4 bytes apart. ExifTool's QuickTimeStream.pl has a hex dump of the same 493-byte record (70mai A810, same 03 00 ed 01 header, under GPSType 19; its offsets are 0x10 higher because the dump starts at the freeGPS header). There the int32 at 0x17 is 349, which this PR decodes as 93. As written, the course can't go above 255°, the speed above 2.55 m/s, or the altitude above 255 m or below 0. video_process writes course and altitude into each frame's EXIF, so these values would end up in uploads. ExifTool reads the speed as an int32, possibly in km/h.
4. CI checks
- mypy reports 3 errors:
max(timestamp_counts, key=timestamp_counts.get)(line 143) andhdlr["data"]["handler_type"](line 196). ruff format --checkandusort diffwant changes in all three files (native.pyalso needs two blank lines between the classes).
Smaller things
- Keeping the earliest record of each video second can attach a position up to about 1 s old, since each fix repeats over many frames. Emitting a point at the frame where the position changes avoids that lag.
- One record with out-of-range coordinates makes the whole video return no GPS (
Invalid 70mai coordinates). Skipping just that record would be gentler. - The tests patch out
MovieBoxParserand_extract_tracks, so finding the hint track in a real file isn't tested.tests/unit/test_novatek_parser.pybuilds a small MP4 in memory and could serve as a model. A test with a late first fix would cover point 2. - The new files are missing the license header the other modules have.
extract_pointsre-checks the sample sizes and counts that_extract_tracksalready guarantees.- ExifTool decodes lat/lon in this record as ddmm.mmmmm × 1e5, while the PR uses degrees × 1e7. You compared against
GPSData000001.txt, so it may be a firmware difference, but it's worth a second look.
Two questions
- Could you share a short sample clip with this hint track, and the matching lines of
GPSData000001.txt? We don't have a 70mai video in this format to test against. - Do you know what the timestamp at 0x15D is: GPS time or the camera clock? Does it change during a clip, or stay at the clip start?
|
HI @caglarpir Thank you for so detailed and fast feedback. I was busy these days and couldn't reply faster. I can't give full feedback now, just some additional information.
|
|
Thanks again, @ypcyc, and for asking 70mai support about the timestamps: their explanation of the 8 hours helped a lot. Since then, mapillary_tools main reads the GPS log that 70mai cameras write next to the clips ( I also had a 70mai clip with both a hint track and the log, so I compared the two:
As the log has the GPS time and the hint track doesn't, and your camera writes the log too (you compared the hint track against it), I'm closing this PR in favour of the log reader. If you have clips that were recorded without the log next to them, samples of those would help us see whether a hint-track reader is worth adding. |

Title
Add GPS extraction for 70mai Dashcam videos
Description
This PR adds native GPS extraction for 70mai front-camera videos that store GPS records in an MP4
hinttrack.What changed
TIMEZONE_OFFSETof +8 hours, and advance subsequent point timestamps by their video-relative time.Validation
Notes
The altitude unit is believed to be meters based on the record template. The timestamp offset is currently a code constant set to +8 hours.