Fix SRT telemetry parsing for DJI videos - #2065
Merged
Merged
Conversation
The zero-coordinate guard compared the regex match, a string, against the integer 0, so it never fired and frames recorded before GPS lock parsed to (0, 0) instead of None. Those positions entered the GPS track and were interpolated against valid fixes. Shutter speed was parsed with the default int transform, so a decimal denominator such as "1/60.0" raised ValueError. The handler meant to report that called ODM_WARNING with two positional arguments and raised TypeError instead, aborting the parse. video2dataset catches the failure and drops the parser, so an affected video silently lost its GPS and camera metadata. Of the formats we claim to support only Phantom4 RTK survived, its "SS 60" being the one without a decimal. Split the block-reading loop out of parse() into parse_lines(), so parsing no longer requires a file on disk, and move the sample of each supported format out of a comment block and into a test that asserts what it parses to. The formats had drifted: the layout the dji_video dataset uses was not among them.
smathermather
approved these changes
Aug 11, 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.
This started as a fix for #2063 but while attempting to test it I hit other bugs with the parsing.
We have one DJI dataset we use in oats. I'm not entirely sure which model was used but we also had some examples as comments in the parser.
I split out the "parsing" from the file loading to make it possible to transfer these all to tests. All of the tests bar one failed which was Phantom4 RTK.
The issue was two parts - firstly
match_singledefaults to ints but the "shutter speed" was a float (in all but the one test case) so it threw a ValueError. Next, was a bugged log warning which caused the parser to throw which eventually causes all SRT data to be silently dropped in video2dataset.The fix was for the bug was
and
I also fixed the original issue in #2063 by adding the
nonzero_float(v)function. The rest of the changes are restructuring so I could add the tests.